The developer sandbox runs on your workstation as a set of docker-based containers mimicking the operating environment of production servers.
Read these instructions carefully. These instructions describe how to download, install, and configure software and/or virtual machines on your workstation and run a set of scripts to build the containers and code base.
- Linux users can install and run Docker and containers directly on workstation
- OSX users are recommended to run Docker for Mac
- Git 2.0+
- Docker 1.10.0+
- OSX users install Docker for Mac
- Linux users install Docker
- Docker Compose 1.7.0+ Linux users additionally need to install Docker Compose (OSX users get Docker Composed installed automatically with Docker for Mac)
- Make sure you can successfully run docker commands without sudo. See Ubuntu example.
- For the docker proxy to work you must stop anything using port 80 and 8080
The ops team needs your public SSH Key to grant you access to the repository. Provide them with your public SSHkey (e.g., ~/.ssh/id_rsa.pub
). Never share your private key.
See also the Git Workflow document for setting up your remotes correctly.
cd ~/workspace
git clone PROJECT_GIT_URL
cd PROJECT
cd ~/workspace/PROJECT
. bin/activate
Note the "dot space" is intentional. Once activated, to get a list of available commands and see info about your containers run this:
bowline
Pull a recent, sanitized copy of the database in the base directory.
rsync -P [email protected]:latest/sanitized-drupal.sql.gz .snapshot.sql.gz
Also download the latest docker images for building the containers:
docker-compose pull
Docker creates virtual instances of Linux on your local machine, and this next step installs those machines, then sets the ~/workspace/PROJECT directory to work with the Linux environments installed here.
build
import
- Your first build can take some time as it downloads virtual Linux environments but subsequent builds will be fast.
- After the build completes, you should see a link to http://PROJECT.localtest.me (based on the PROJECT directory name). If that does not load in your browser then you need to find what is using port 80 and 8080 then re-run
build
.
Unlike other docker based projects that mount the project files directly into the container, this project syncs the files from the project into the container. Thus, there are two copies of the project files: one on the host (your machine) and one in the docker volume.
Files are copied to the container on the initial build
step. The sync container periodically monitors changes using unison and copies files to and from the container automatically. Unfortunately, the sync container can be very slow so the project includes an additional file-watching utility to speed updates for development: modd.
In a new terminal, activate bowline then run the following:
Linux users:
modd.linux
Mac users:
modd.osx
This will start the golang modd utility to watch for file changes. As you edit files you should see output as it copies files and corrects file permissions. Hit ctrl
+c
to stop modd.
If you would like to use drush
on the newly built containers, activate your bash session:
(Assumes cd ~/workspace/PROJECT; . bin/activate)
. bin/activate
drush st
- This will add a special drush script which overrides your installed drush
- If you want to use your normal drush, simply open another terminal or run
deactivate
You will need to restart a few functions each time rebuild your container or restart your computer.
Activate
. bin/activate
build
Logging in via drush
one time login
drush uli
Then, paste generated link into browser
If you like, you can stop the container when done:
stop
Restart with:
build
You may be able to boost your performance by adjusting the CPU and memory allocation for docker engine. Click the whale icon and increase the CPU and memory to about 1/2 of what is available or more to see if it helps. Note that docker engine will have to restart for the change to take effect. If your contains don't restart automatically, simply run `build' again.