Skip to content
Kjell-Magne Øierud edited this page Jan 7, 2015 · 20 revisions

Architecture

The system requires one or more linux servers running Docker.

First time setup

Configuration

curl -L -O https://raw.githubusercontent.com/matematikk-mooc/mmooc/master/env-example
mv env-example /root/env
vi /root/env

Create volume containers

docker run -v /var/log/apache2 -v /opt/canvas-lms/log -v /opt/canvas-lms/tmp/files --name=web-data busybox /bin/echo "Volume created"
docker run -v /var/lib/postgresql/9.1/main --name=db-data busybox /bin/echo "Volume created"

Set up the postgresql cluster, create database users and schemas.

docker run --rm -t -i --env-file=env --user=root --volumes-from=db-data mmooc/db /bin/bash /root/initdb

Start the PostgreSQL container.

docker run --name=db -d -P --env-file=env --volumes-from=db-data mmooc/db

Then we need create tables and other schema objects, and insert initial data.

docker run --rm --env-file=env -w /opt/canvas-lms --link db:db mmooc/canvas bundle exec rake db:initial_setup

Finally we can start up the rest of the containers.

docker run --name=cache   -d -P --env-file=env mmooc/cache
docker run --name=web     -d -P --env-file=env --volumes-from=web-data --link=db:db --link=cache:cache mmooc/canvas
docker run --name=haproxy -d -p 80:80 -p 443:443 --env-file=env --link=web:web mmooc/haproxy
docker run --name=jobs    -d --env-file=env --volumes-from=web-data --link db:db --link=cache:cache mmooc/canvas /opt/canvas-lms/script/canvas_init run

Upgrading

docker pull IMAGE
docker stop CONTAINER
docker rm CONTAINER
docker run ...

Upgrading canvas

Before restarting, run:

docker run --rm -t -i --env-file=env --link db:db --link cache:cache mmooc/canvas /bin/bash
cd /opt/canvas-lms
bundle exec rake db:migrate
bundle exec rake db:load_notifications

Process management

Metrics

Logs

STDOUT and STDERR from the process running inside a container

docker logs [db|cache|web|haproxy|jobs]

Apache log files

docker run --rm -t -i --volumes-from=web-data busybox /bin/sh
# ls /var/log/apache2
docker run --rm -t -i --volumes-from=web-data busybox /bin/tail /var/log/apache2/access.log

Rails log

docker run --rm -t -i --volumes-from=web-data busybox /bin/tail /opt/canvas-lms/log/production.log

Canvas error messages are logged to the database. Run

docker run --rm -t -i --link db:db mmooc/tools

to get a menu where you can choose which type of errors you would like to examine.

FIXME logs for haproxy and redis

Log rotation

FIXME

Backups

Test releases

Docker images that are test releases will be tagged with :test

Clone this wiki locally