Set up the local development environment¶
This is the part of the tutorial with the greatest potential for stumbling-blocks, because it involves the installation of software. However the components are very reliable and the vast majority of users encounter no problems at all.
If you do run into any difficulties, please don’t hesitate to contact Divio support, who will be glad to help you out.
Why is the local development environment so important?¶
Docker makes it possible to run and work on a project locally in the same environment as it runs on in the cloud. This side-steps some of the most troublesome problems faced by development teams, in which something works well in development, but then runs into trouble 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 - which includes 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.
The local development environment includes the tools and software that allow you to work on your project, testing it as you go on your own computer. This uses Docker, just like our cloud deployment architecture. The local environment is also integrated with the cloud infrastructure - it’s like having a hotline to the cloud.
In this section we will:
Older versions of Macintosh OS X and Windows
Older versions of Macintosh OS X and Windows do not support the native Docker application, but require Docker to be run using VirtualBox. This is considerably more complex to set up than Docker running natively. We do not support for this combination. Check the system requirements for Macintosh and Windows.
Before you start¶
You will need to have the following installed or configured, and know at least the basics of using them, before proceeding:
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.
Install the Divio CLI package¶
The Divio CLI application is installable using Pip. Note that it requires Python 3.6 or higher.
Depending on your system, you may need to use
pip3 in 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.
Make sure you are logged in to your account on the Divio Control Panel. If you don’t already have one, now is the time to create it (a Divio account is free to set up and use indefinitely).
The Divio CLI needs to be authenticated with the Control Panel in order to interact with it, using the command:
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