Introducing Docker Starter 3.0
Last year, we released our Docker Starter project. This starter kit is the working basis for nearly every project here at JoliCode. It’s a real pleasure for us to work with, shared with some gentle contributors 💛.
Today, we are very happy to announce the release of the version 3.0! 🎉
Docker Starter in it's previous version was based on Fabric, and therefore Python 2. To follow the lifecycle of these technologies, we had to make huge modifications, including a BC break.
Python 2.7 has reached his End Of Life
Since we had Fabric as a main dependency, locked on Python 2.7, we were trapped in this version of Python. We had 2 choices:
- using a fork 😕
- moving forward and upgrading Python and finding a new way to run our stack.
But why did we need Fabric?
Fabric was used as a task launcher in Docker Starter since the beginning, when it was just a Python file we used to copy and paste from project to project.
Internally, we discussed other solutions like switching to one of the dozen existing task launchers, or eventually writing our own with PHP. Beyond the challenges of writing such a tool, we finally decided to be pragmatic and chose to stay on a Python based tool, to ease the maintenance of our existing project based on Docker Starter, and avoid rewriting all our tasks.
So let's find another task launcher, … by the way, is Fabric based on a library? 😏
Since Fabric is built on top of Invoke, we decided to use Invoke directly as our new task launcher 😎.
It’s fully Python 3 compliant, and exposes quite the same API as Fabric!
The only difference is with CLI task names. If one of your tasks is named "webpack_watch", Invoke will expose it in CLI as "webpack-watch" (note the "-" in place of the "_"). To avoid misunderstanding issues, we recommend to use the autocomplete script included in Invoke using the following command, and copying/pasting the output it in your shell configuration file (.bashrc, .zshrc, …):
$ invoke --print-completion-script=$SHELL
All the commands are now
inv [cmd] instead of
Good bye Alpine
The second main change in Docker Starter 3.0 is the switch from Alpine to Debian based image for PHP.
After a very interesting discussion about switching from Alpine to Debian in our Github repository we finally decided to switch. The main advantages were the need to have a dev environment closer to the production one and the possibility to have latest versions of PHP which were not available on Alpine.
Traefik, used as a reverse proxy, has been updated from 2.0 to 2.2 without needed changes in our configuration.
PostgreSQL version has also been upgraded from 11 to 12, with a dedicated test in CircleCI to ensure the database responds correctly 🎉.
Elasticsearch cookbook was upgraded to 7.8 too and we removed the very small HEAP site default value.
MacOS and Windows support
We took another deep look at Docker Desktop for Windows and it was hard!
One of the biggest challenges we faced was this strange error:
frontend_1 | runsv nginx: fatal: unable to start ./run: file does not exist
After some digging we found out that any file destined to run inside a container must use Unix style \n line endings on Windows.
The solution was to add a .gitattributes file to force the End Of Line:
We also had issues with PowerShell and Invoke, the environment variables are not passed along properly so Windows users will get a warning and must initialize them via a copy and paste.
Another difference is that the awesome
network_mode=host is not available on Windows and MacOS. That's our default value because it allows us to run multiple projects at the same time, we just had to override this for the two Docker Desktop runtime and use ports instead.
Our Docker Compose stack is now fully operational on MacOS. On Windows, we still miss a critical part of the tooling: the "builder" as we call it is a container where the developer can run commands. We connect to it via Invoke but sadly, there is no PTY on Windows and that makes the shell unusable.
Time flies, and our different projects stacks too, so we added some new cookbooks in the documentation:
- Webpack Encore, to get benefit of the hot-reload. It's quite useful for frontend developers who work mainly with CSS and JS files.
- Mercure, the real-time communications protocol designed and developed by our friends from Les-Tilleuls.
You want to upgrade?
If you are using Docker Starter and want to upgrade to this new version, you can follow our guide! However, if you are comfortable with the old version, it's of course not mandatory to upgrade.
The complete changelog is available here.
Feel free to contribute if you like Docker Starter, don’t hesitate to open an issue if you have any problem with, or just open a PR to share with us your cookbooks!