Skip to content
Jonathan Stray edited this page Jul 25, 2017 · 37 revisions

Welcome to the cjworkbench wiki!

Running docker image, debug/development

First pull down the image. You'll need to repeat this whenever it needs an update.

docker pull jonathanstray/cjworkbench

Then start the container. You can do this interactively (container goes away with ^C)

docker run -it --rm -p 8000:8000 cjworkbench

Remove the --rm flag if you want the container and its contents to persist -- e.g. all users and created workflows. Or you can run as a background process:

docker run -p 8000:8000 cjworkbench

Either way, since this is debug mode, all data is stored in sqlite.db as usual.

Running docker image, production

Production mode uses docker-compose, with a the compose file in the cjworkbench-docker repo:

git clone https://github.com/jstray/cjworkbench-docker
docker-compose up

This pulls all necessary images, including a Postgres database. The server runs on port 8000 by default. The first time you run, you will need to manually create an admin user. After the server is up, run

docker exec -i -t cjw-web python manage.py createsuperuser

You can also run arbitrary Python code from within the context of the server process by doing something like

docker exec -i -t cjw-web python manage.py shell -c "from django.contrib.auth.models import User; User.objects.get(email='[email protected]').delete()"

Shell into running container

Do

docker exec -i -t <container name> /bin/bash

where container-name is cjw-web or cjw-db

Building docker image

For rapid iteration, the docker build is split into two images: cjworkbench-reqs starts with a base python image and installs all of the modules in requirements.txt. (Dockerfile) This can take quite a long time, maybe 30 minutes, as some of the modules (like pandas) require compilation For this reason this image does not build automatically; you must trigger it whenever you change requirements.txt or requirements-dev.txt.

The second image is the main cjworkbench which clones the repo, installs npm modules, and creates a default admin user. (Dockerfile) It's set up to rebuild on dockerhub whenever anything is committed to the main repo.