Docker provisioning for Canvas integration tests (via LTI, etc)
- Docker Engine
- Docker Compose
- Large amount (~4GB) of memory allocated to your docker machine (Canvas uses a lot of memory)
git clone https://github.com/ubc/docker-canvas.git docker-canvas
Initialize data by first starting the database:
docker-compose up -d db
Wait a few moments for the database to start then (command might fail if database hasn't finished first time startup):
docker-compose run --rm app bundle exec rake db:create db:initial_setup
When prompted enter default account email, password, and display name. Also choose to share usage data or not.
The branding assets must also be manually generated when canvas is in production mode:
docker-compose run --rm app bundle exec rake canvas:compile_assets
docker-compose run --rm app bundle exec rake brand_configs:generate_and_upload_all
Finally startup all the services (the build will create a docker image for you):
docker-compose up -d --build
Canvas is accessible at
http://localhost:8900/
MailHog (catches all out going mail from canvas) is accessible at
http://localhost:8901/
docker-compose up -d
# app
docker logs -f docker-canvas_app_1
# more detailed app logs
docker exec -it docker-canvas_app_1 tail -f log/production.log
# worker
docker logs -f docker-canvas_worker_1
# db
docker logs -f docker-canvas_db_1
# redis
docker logs -f docker-canvas_redis_1
# mail
docker logs -f docker-canvas_mail_1
docker-compose stop
docker-compose down
rm -rf .data
You can try rebuilding the image if you are experiencing issues importing course content, etc. Before running this command, stop the server (if it's running) using docker-compose down
docker-compose build
docker-compose run --rm app bundle exec rake db:migrate
The official Canvas docker image might not be up-to-date with the version available on github. If you need an updated image, you will have to build it yourself. Check out Canvas from Instructure's github (make sure you're on the branch you need, e.g.: stable) and run:
docker build -t instructure/canvas-lms:stable .
Note that Instructure recommends at least 8 GB of RAM to build this image. This will build and tag the image as a newer version in your docker cache. You will need to rebuild the app and worker images to incorporate this new image:
docker-compose build app worker
You might also need to update the DB and rebuild assets. After this, you should be able to start Canvas as usual.
It may be hard to link to the Canvas container in some situations using only localhost
. This can be mitigated using the IP address of your host machine to access the canvas instance or by using virtual hosts if that is not feasible.
Better instructions on getting this working will be add in the future (sorry!).
For LTI you need to use your machine's IP address (Change the DOMAIN
environment variable to your IP address).
Increase the PASSENGER_STARTUP_TIMEOUT environment variable in docker-compose.yml. First time startup can take a while and the timeout might be too short.