Set up the local development environment¶
In order to work on your project, we need to set it up in the local development environment. This also uses Docker.
Docker makes it possible to run and work on a project in the same environment as on the cloud, thus side-stepping some of the most troublesome problems faced by development teams, in which something works well in development, but runs into problems as a result of different environment conditions in production, or when another team member tries to set it up on their own machine.
Using Docker means that not only does every member of the development team work in the same environment - versions of installed packages, environment variables, database and other services - but they’re all in the same environment that the application will have in production.
Older versions of Macintosh OS X and Windows
Older versions of Macintosh OS X and Windows do not support the native Docker application. Instead, they require Docker to be run in a virtual machine (in VirtualBox) while the Docker Toolbox application provides a set of tools to interact with it.
This is considerably more difficult to set up than Docker running natively. It’s possible to manage, but we are not able to provide support for this combination.
You will need to have the following installed or configured, and know at least the basics of using them, before proceeding:
- Git (GitHub’s set up Git guide)
- SSH, so that you can provide your public key to a server (GitHub’s guides to setting up SSH)
- Pip, the Python Package Installer
Install the Divio CLI package¶
The Divio CLI application is installable using Pip (depending on your system, use
the examples below):
pip install divio-cli
If you already have it installed, check that they are up-to-date:
pip install --upgrade divio-cli
You can do this in a virtual environment if you prefer not to install it globally. Otherwise, it’s a lightweight component and can easily be removed later if you decide you don’t require it.
The Divio CLI needs to be authenticated with the Control Panel in order to interact with it:
This will open your browser at https://control.divio.com/account/desktop-app/access-token/, where you can copy an access token to paste into the prompt.
Add your public SSH key to the Control Panel¶
The Control Panel needs your public key, so that you can interact with our Git server and so on. Visit SSH Keys in the Control Panel. Add your public key. If you’re not sure how to manage SSH keys, see the excellent GitHub articles on how to connect with SSH.
Test that your key is set up correctly; you should receive a
No interactive access response:
ssh -T email@example.com
Install Docker and Docker Compose¶
- Macintosh users: Docker for Mac
- Windows users: Docker for Windows
- Linux users: Docker CE and Docker Compose
(Windows users should consult the checklist below).
Launch Docker. You can check that it’s running correctly with:
docker run --rm busybox true
Additional checklist for Docker installation on Windows¶
- In Docker’s settings, make sure that it is set to use Linux containers.
- Ensure that your Windows user is in the
- When you launch Docker, make sure that you do so as a Windows administrator.
You’re now ready to set up the project you created in the previously step in your local environment for development work.