Skip to content

Latest commit

 

History

History
147 lines (92 loc) · 4.92 KB

sandbox.md

File metadata and controls

147 lines (92 loc) · 4.92 KB

Drupal Installation with Docker

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

Step 1. Requirements

  • Git 2.0+
  • Docker 1.10.0+
  • 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

Step 2. Cloning the repository

2.1. Provide Your Public SSH Key to Infrastructure Support

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.

2.2. Get the latest code

See also the Git Workflow document for setting up your remotes correctly.

cd ~/workspace
git clone PROJECT_GIT_URL
cd PROJECT

Step 3. Activate Bowline

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

Step 4. Pull Database and Support Files

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

Step 5. Build and Run Containers

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.

Synchronizing files

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.

Using drush

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

Daily Usage

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

Docker for Mac

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.