Yourlabs

best-practice

GitLab Dynamic Environments with Docker-Compose instead of K8S

| by jpic | gitlab continuous-delivery best-practice
Dynamic Environment is when your pipeline creates a branchname.example.com deployment, for integration tests or manual review. Gitlab in autodevops mode and with Kubernetes lets you enjoy this kind of stuff by just starting projects from their template images. Note that YourLabs offers consulting if you need help to setup/maintain your baremetal K8S or GitLab instance to do this kind of thing. (Please forgive horrible sound recording in our demo) This article however, demonstrates how to acheive dynamic environments for integration testing and reviews with the product team with just docker-compose and nginx-proxy. Read More

free-pdf-ebook-continuous-delivery-and-devops

| by jpic | devops best-practice
https://www.packtpub.com/packt/free-ebook/devops-quickstart Brilliant DevOps & CD QuickStart FREE ebook by Paul Swartout.

coreos

| by jpic | linux devops best-practice
https://coreos.com/rkt/docs/latest/rkt-vs-other-projects.html

yourlabsplaylabs

| by jpic | devops python ansible best-practice
https://github.com/yourlabs/playlabs GitHub release of part of my current production practice to Continuous Integration and Continuous Delivery. It's the main monolyth that combines well in CI with our Python & PHP distributions. Actually some parts of the monorepo in the process of being extracted and rewritten to smaller sized units and that's the development track that's issued recent tools such as cli2 that is the library for decorating another CLI in python extracted as a generic engine, base for djcli (also extracted from injected code from ansible django plugin), shyml, with other parts that are yet to be installed in a production pipeline such as ansible-apply ansible modern command line wrapper, compoctl docker-compose decorator that's shorter to write but also provides experimental commands to improve automated deployments, backups and restores. Read More

red-hat-enterprise-linux-8-beta-a-new-set-of

| by jpic | docker containers best-practice
https://www.redhat.com/en/blog/red-hat-enterprise-linux-8-beta-new-set-container-tools After docker …

Django & JS research report

| by jpic | python django best-practice npm nodejs js
This article aims to report the current state of research about dealing with both JS and Django, for people that aim to primarly deal with Django and enjoy the same workflow they have with python package with their frontend development, and find patterns to connect them while keeping them loosely coupled at whatever limit feels right for them. Nuff said, let's hack ! crudlfap relies on django-webpack-loader, which does its job very well. Read More

nerdocs-gdaps

| by jpic | python django best-practice
https://gitlab.com/nerdocs/gdaps GDAPS - Generic Django Apps Plugin System Awesome app by Christian González, undergoing research & development for frontend framework plugin EPIC !!! This is the README so far: This library allows Django to make real “pluggable” apps. A standard Django “app” is reusable (if done correctly), but is not really pluggable, like being distributed and “plugged” into a Django main application without modifications. CAVE: This software is in a very early development state. Read More

well-thats-a-nice-way-to-automate-backups-and

| by jpic | docker-compose best-practice devops ci cd
Well that's a nice way to automate backups and rollbacks during my deploys and make another CI Dev-Perfect(tm)

yourlabs/python container adds security audit tools

| by jpic | gitlab-ci security python gitlab best-practice
The new version of yourlabs/python docker image, which bundles npm and pip3 on alpine and a bunch of testing tools, was released with bandit and safety baked in. You can benefit from it in your Open Source software by adding .gitlab-ci.yml: py-sec-bandit:image:yourlabs/pythonscript:bandit-v-xcommands,tests{posargs:-rsrc}py-sec-safety:image:yourlabs/pythonscript:safetycheck

Automatic test rewrite for django-dbdiff/django-responsediff/cli2

| by jpic | python django best-practice tdd
Still in the competition for most code coverage with least test code that is written manually and needs to be maintained manually, all our test autowriting software has been updated to support a new environment variable : FIXTURE_REWRITE. Instead of deleting fixtures manually to regenerate them by running the tests, you can now just run your tests with the FIXTURE_REWRITE env var. This will overwrite the fixtures and make the tests look like it passed. Read More

zsimicsetupmeta

| by jpic | python continuous-delivery best-practice
https://github.com/zsimic/setupmeta If you're unhappy with the current state of your setup.py, you should definitely try setupmeta by famous haxor Zoran Simic. I've been upgrading my setup.py to setupmeta, which gives me 10 times more useful features than the crappy script I had in my delivery pipelines, and I'm going directly with setupmeta for all new packages. So far, we have at least the following packages with setupmeta (probably more): - cli2 - shyml - djcli - crudlfap - playlabs Even if you don't maintain python packages, I highly recommend that you check setupmeta because it's really well thought of. Read More

did-you-know-gitlab-ci-jobs-can-depend-on-changed

| by jpic | gitlab best-practice
Did you know GitLab-CI jobs can depend on changed files of a commit ? A neat way to optimize your CI pipeline !

docdevelopmentcontributingissueworkflowmd

| by jpic | gitlab best-practice
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/contributing/issue_workflow.md Excellent read about GitLab's internal issue workflow, safe to assume they automated as much as possible in GitLab itself.

podman-the-next-generation-of-linux-container

| by jpic | docker linux containers best-practice
https://developers.redhat.com/articles/podman-next-generation-linux-container-tools/

why-you-should-pay-a-hacker-10kyear-to-maintain

| by jpic | best-practice
Why you should pay a hacker 10k/year to maintain your GitLab-CI/Drone-CI/etc server on baremetal With LOVE

DevOps since 2005: a  retrospective

| by jpic | python ansible best-practice
This article shares some history of DevOps testing in France during the last few years. How it looked like when I started in the industry in 2004 and almost 15 years later today. Background Just a 1337c0d3 that somehow made it so far with the help of a lot of shadow hacking, now somewhat known as “DevOps” in some places … Pre-DevOps era: the obscurity In 2004 i was hacking for Jouve which had high tech digital printers which meant that they could make small batches of books, at the time where the market was filled with offset printers that made the minimal batch have to be 1500 or something. Read More

building-images-with-kaniko-and-gitlab-cicd

| by jpic | gitlab best-practice
https://docs.gitlab.com/ee/ci/docker/using_kaniko.html kaniko is a tool to build container images from a Dockerfile, inside a container or Kubernetes cluster. kaniko solves two problems with using the docker-in-docker build method: Docker-in-docker requires privileged mode in order to function, which is a significant security concern. Docker-in-docker generally incurs a performance penalty and can be quite slow Read more at docs.gitlab.com

thommignotprocesscontroller

| by jpic | python best-practice automation
https://github.com/thommignot/processcontroller/blob/master/processcontroller/__init__.py How Thomas Mignot, YourLabs hacker, re-implemented pexpect in 2018 with less than 100 SLOCs. Sorry for windows support, it's not part of our plans. “Expect” a release in the following days (pun intended).

clilabs 1.1.1 release

| by jpic | django python best-practice
Clilabs now benefit a new command that automates a series of 3 lines that's I've been typing over and over again during 10 years of Django hacking. $ clilabs help +django:settings Setting up django has failed ! DJANGO_SETTINGS_MODULE env var not set ! Show settings from django. How many times have you done the following ? python manage.py shell from django.conf import settings settings.DATABASES # or something Well it's over now ! Read More

Quote post

| by jpic | best-practice
jpic, h4x0|2 & founder @ YourLabs Phase 1: believe the world is waiting for you, Phase 2: realize the world is not waiting for you, Phase 3: stop waiting for the world.

extreme-devops-screenshot-where-you-see

| by jpic | python django best-practice devops playlabs
“Extreme DevOps” screenshot, where you see branchname == lastbuildjobname, designed for dynamic environments, demonstrates auto-deploy an environment per push on a subdomain with the branch name. From betagouv/MRS#636, with PlayLabs, currently in Alpha stage.

playlabs: 30 seconds overview

| by jpic | playlabs linux python ansible best-practice
Quick version of the previous article on playlabs $ playlabs Playlabs: the obscene ansible distribution. Init your ssh user with your key and secure sshd and passwordless sudo: playlabs init root@1.2.3.4 # all options are ansible options are proxied playlabs init @somehost --ask-become-pass Now your user can install roles: playlabs install docker,firewall,nginx @somehost And deploy a project, examples: playlabs @somehost deploy image=betagouv/mrs:master playlabs @somehost deploy image=betagouv/mrs:master plugins=postgres,django,uwsgi backup_password=foo prefix=ybs instance=hack env. Read More

PlayLabs: the Obscene Ansible Distribution, long version

| by jpic | python linux ansible best-practice playlabs
From baremetal to deploying docker images on a PaaS in one command ? PlayLabs is the result of a refactor of playbooks we've had in production for a while to acheive hackable docker-based PaaS. The refactor was designed to be Open Source, almost there to beta. PlayLabs combines simple ansible patterns with packaged roles to create a docker orchestrated paas to prototype products for development to production. PlayLabs does not deal with HA, for HA you will need to do the ansible plugins yourself, or use kubernetes … but until then, PlayLabs do everything else, even configure your own sentry or kubernetes servers ! Read More

open-source-software-django-collectdir

| by jpic | python django best-practice
https://git.yourlabs.org/oss/django-collectdir Want to split your react components accross your django apps or anything like that ? Try django-collectdir, which implements a instant realtime django-app directory watcher with beautiful colors for development !

nagare-integrated-development-environment-nagare

| by jpic | python framework django best-practice
http://www.nagare.org/ide/guide.html#debugging Nagare, a brilliant Python framework definitely worth studying ;)

tbinetruychip

| by jpic | python best-practice
https://github.com/tbinetruy/CHIP Python's functional implementation of ReactJS, fast moving and very promising, by YourLabs Dev Team ! Thomas Binetruy has taken over jpic's PoC of React in Python, which I've also seen an implementation attempt in the v2 branch of django-material. This is part of the milestone of migrating from MaterializeCSS to Material Design Components Web in CRUDLFA+. But know that YourLabs has never released any Django form rendering plugin so far. Read More

demonstration-of-our-baremetal-devops-platform

| by jpic | gitlab kubernetes best-practice
Demonstration of our baremetal devops platform. By YourLabs DevOps team, at your service. With many thanks to Yann Perchec, CTO of PeopleDoc, for inspiring me on the quest to the most advanced pipelines on baremetal servers.

all-software-sucks

| by jpic | best-practice
http://harmful.cat-v.org/software/ Legendary site by respected hacker Uriel, RIP.

open-source-software-djnext

| by jpic | python django javascript react djnext best-practice
https://git.yourlabs.org/oss/djnext Django-NextJS Isomorphic UI Development with Decorator pattern for Django with: - nextjs out of the box experience for frontend development, - rendering of nextjs pages with context in Django with NextJS template engine. For fun & profit ## Run the example project Run this commands as non root:: git clone https://git.yourlabs.org/oss/djnext cd djnext pip install –user –editable .[dev] yarn install djnext watchstatic # maintains nextjs pages/ directory for yarn dev yarn dev # run localhost:3000 djnext dev # run localhost:8000 ## Choose NextJS page template in Django Example project lives in src/djnext_example, see src/djnext_example/artist/urls. Read More

gitlab-web-ide-screenshot

| by jpic | gitlab best-practice
GitLab Web-IDE screenshot

indietypdjango-automated-logging

| by jpic | python django best-practice
https://github.com/indietyp/django-automated-logging Pretty cool alternative to django.contrib.admin.LogEntry

deploying-scalable-django-app-on-kubernetes

| by jpic | python django kubernetes best-practice
http://danielhnyk.cz/deploying-scalable-django-app-on-kubernetes/

apparently-browser-testing-stack-for-crudlfa

| by jpic | best-practice crudlfap
Apparently, browser testing stack for CRUDLFA+ based on CircleCI, SauceLabs, NightWatchJS, TypeScript, is getting operational. All configurations are Open Source. Have a beautiful day

any-kind-of-dev-workflow-thats-not-as-efficient

| by jpic | best-practice
Any kind of dev workflow that's not as efficient as this one is considered deprecated / obsolete by YourLabs. Have a beautiful day

delitamakandadjango-react

| by jpic | python django javascript react best-practice
https://github.com/delitamakanda/django-react Beautiful example of Django/React integration !

yarn

| by jpic | javascript best-practice
https://yarnpkg.com/lang/en/docs/migrating-from-npm/ Example: https://github.com/betagouv/mrs/pull/176

wildfish

| by jpic | python django javascript best-practice
https://github.com/wildfish Django isomorphic research !

jpicdjango-adapters

| by jpic | python django best-practice adapters
https://github.com/jpic/django-adapters/blob/master/docs/source/tutorial.rst django-adapters new proposal ! This time less clumsy and I hope probably more like what Marc had in mind !

django-adapters audit writeup

| by jpic | best-practice python django
It's been probably 30 hours I've spent trying to contribute to the django-adapters. This article describes the approach we take when making investment audits on software @ YourLabs, and my conclusions on this project. I started by reading what had been done and issues. My first mistake was to not be patient enough to really read and profoundly understand absolutely every piece that had been done. It seems to me that what django-adapters tries to do is invent a new pattern to solve the kind of problems we usually deal with as developers: Read More

welcome-to-the-virtual-open-space

| by jpic | best-practice
https://tech.people-doc.com/welcome-to-the-virtual-open-space.html This tells a story of a 24/7 ongoing hackaton with remote workers from the world.

How I failed at documentation driven design

| by jpic | best-practice
A small anecdote about one of my most recent failures ! Now it's up to me to be a better coder next time ;) When I rewrote django-dynamic-fields into facond, I still had Form/Rule/Action/Conditions from ddf. When the code got to the point where i was satisfied with it i wrote the tutorial. This is how I figured this lib had just no need for the “Rule” component. Hopefuly, both python and js had serious unit test coverage, so I just removed the Rule stuff from Python and JS, changed all function signatures, and kept on fixing stuff until tests passed again. Read More

JS TDD in your Django apps

| by jpic | javascript best-practice
Yesterday, I confessed my guilt of writing shitty DOM manipulating JS code live in the browser, and said no, never again. Due to positive feedback in the django-users mailing list, I'm writing how I actually plan to change how I do JS in Django apps. Believe me, it's preventively fixing issues i've had with JS in Django apps during the last ten years. Nuff said, let's hack ! Let's create an index. Read More

victory-on-javascript-lets-build-another-django

| by jpic | python django-dynamic-fields best-practice javascript
Victory on JavaScript, let's build another Django on top of Django :) With LOVE

Djangonauts: Say no to selenium drug

| by jpic | selenium best-practice python django js
When you start applying best development practices such as TDD, you discover that you make much better software. First, you can TDD your python code with anything, django has a test runner, otherwise you have pytest and many friends. Then, you make python to interact with javascript. In the Django community, it seems that there is a conscensus around “use selenium to test your JS”. I've been like this myself for years, but the thing with selenium is that it's functional testing, not unit testing, it does bring short term ROI, but on the long term it becomes costy to maintain over time. Read More

GitLab OpenShift: best Continuous Delivery pipeline 2016

| by jpic | gitlab openshift cd ci best-practice
The From idea to production video demo which demonstrates in a stunning a 12 minute video how to deploy GitLab on OpenShift, then login to GitLab and create a project with a pipeline that deploys the project on OpenShift itself.

French: CD & DevOps & Free Pipeline

| by jpic | french best-practice
A presentation by James Pic, founder of YourLabs, was filmed at djangocong 2016 Rennes: video (french) slides (english) docs to reproduce demo source code Only the video is in french: Slides in english:

django-dbdiff 0.6.0 release

| by jpic | python django best-practice django-dbdiff
django-dbdiff was released. It allows to exclude fields from tests with the new exclude parameter, ie:: Fixture( 'tweets/tests/after_create_retweet.json', models=[Tweet, Retweets], ).assertNoDiff( exclude={ 'tweets.tweet': ['datetime'], 'tweets.retweets': ['datetime'], }, } This was initially requested by Nicolas Joyard for the Political Memory project. Note that you shouldn't use exclude for datetimes like in the above example, but instead use something like freezegun to force datetimes to an arbitrary fixture.

django-responsediff 0.3.0

| by jpic | python django best-practice django-responsediff
django-responsediff 0.3.0 has been released ! It now also checks the status_code, and has a cute mixin: from responsediff.test import ResponseDiffTestMixin class MixinTest(ResponseDiffTestMixin, test.TestCase): def test_admin(self): self.assertResponseDiffEmpty(test.Client().get('/admin/')) The above will fail on the first time with FixtureCreated to indicate that it has written responsediff/tests/response_fixtures/MixinTest.test_admin/{content,status_code}. This file is meant to be added to version control. So next time this will run, it will check that response.status_code and response.content is the same, in future version, or in other configurations (ie. Read More

Automatic fixtures for HTTP Response assertions

| by jpic | python django test django-responsediff best-practice
As stated in the “Database state assertion” article: I'm pretty lazy when it comes to writing tests for existing code, however, I'm even lazier when it comes to repetitive manual testing action. When my user tests my website, they browse it and check that everything is rendered fine. In the same fashion, django-responsediff eases doing the high-level assertions of page HTML rendering. Consider this example: class TestYourView(TestCase): def test_your_page(self): result = test. Read More

Using Ghost.py to test Django applications with LiveServerTestCase

| by jpic | django python best-practice
I'm posting this because it took me quite a few hours to get to this point: Ghost.py seem to have a nicer API and to be faster than selenium so far.

“One of my most productive days was throwing away 1000 lines of code.”

| by jpic | phisolophy best-practice
By Ken Thompson.

Surviving django.contrib.staticfiles (or: how to manage static files with django)

| by jpic | django best-practice
This article describes how to use django.contrib.staticfiles as this is a FAQ StackOverflow and IRC. Structure The HTTP server is to serve static files directly from a public folder, without going through Django at all. Uploaded files If the HTTP server configuration serves /srv/project/media_root/ on url /media_url/, for example with this nginx configuration: location ^~ /media_url/ { alias /srv/project/media_root/; autoindex off; } Then: settings.MEDIA_ROOT should be /srv/project/media_root/ settings. Read More

Design patterns in Python

| by jpic | best-practice python
I just came across this fantastic repo, which contains many design pattern implementations in Python. My advice: read them all :)

Never hardcode absolute paths

| by jpic | python django best-practice
This is nonono: STATIC_ROOT = '/home/coat/www/site/app/static/' Never hardcode absolute paths, you're just making your settings file less portable and probably killing kittens. Adapt this to your needs: import os.path import posixpath PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..') STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static') # fix STATICFILES_DIRS too # and TEMPLATE_DIRS

Coding standards for Django apps: names

| by jpic | django best-practice
This post shows a coding standard which emerged from the Pinax community (formerly hot-club)[source needed] for predictive and consistent URL naming patterns. While this is still supported by Django, namespaced URL include() has been as well for some years now and urls should be translated when upgrading Django versions. Django Contributing Commons maintains a technical description which you can reuse in your project. Check it out and try to contribute, this could be a nice community driven git based coding standards for Django ! Read More

How to override a view from an external Django app

| by jpic | django python best-practice
This article describes how to override a view from an external Django app which is a FAQ on StackOverflow and IRC. You should understand that your urls.py is a really central and critical part of your django project. You don't touch external app code You are not supposed to edit the code from an external app. Unless you fork it first on github. How to override without forking Overriding a template If you want to override templates/userena/activate_fail. Read More

Django, Pinax, virtualenv, setuptools, pip, easy_install and requirements.txt

| by jpic | django pinax python virtualenv best-practice
This article describes how to build project dependencies with virtualenv. It is appliable to Pinax. Pinax uses virtualenv by default. It lets the developer have a project-specific python directory, including binaries, packages etc … OpenSuse for example supplies very bad Pinax packages which allows the user to mess with his operating system. It is much better to isolate project dependencies from a project to another for more granular control of the maintenance cost; for example if a package upgrade breaks the user project. Read More
1 of 6 Next Page