{"id":21258571,"url":"https://github.com/ubc/docker-canvas","last_synced_at":"2025-07-11T02:32:45.295Z","repository":{"id":48889978,"uuid":"94259692","full_name":"ubc/docker-canvas","owner":"ubc","description":"Docker provisioning for Canvas integration tests","archived":false,"fork":false,"pushed_at":"2022-09-01T00:04:27.000Z","size":46,"stargazers_count":18,"open_issues_count":1,"forks_count":13,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-05T19:34:13.087Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ubc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-13T21:28:41.000Z","updated_at":"2023-05-17T04:32:56.000Z","dependencies_parsed_at":"2023-01-17T16:58:22.725Z","dependency_job_id":null,"html_url":"https://github.com/ubc/docker-canvas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ubc/docker-canvas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fdocker-canvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fdocker-canvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fdocker-canvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fdocker-canvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ubc","download_url":"https://codeload.github.com/ubc/docker-canvas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fdocker-canvas/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264712867,"owners_count":23652679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T04:09:43.129Z","updated_at":"2025-07-11T02:32:44.998Z","avatar_url":"https://github.com/ubc.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Docker Canvas for Integration Testing\n-------------------------------\n\nDocker provisioning for Canvas integration tests (via LTI, etc)\n\n## Prerequisites\n\n* [Docker Engine](https://docs.docker.com/engine/installation/)\n* [Docker Compose](https://docs.docker.com/compose/install/)\n* Large amount of memory allocated to your docker machine (Canvas uses a lot of memory). You need ~10GB to build the image and ~6GB to run the image.\n\n# Setting Up via Vendor Quick Start\n\n## As of release/2022-09-14.120\n\n- Mutagen has disappeared, which probably led to the below permission issues\n- On Linux, you're likely to encounter permission errors during setup. You have two options:\n  1. Easiest fix is to comment out the `CANVAS_SKIP_DOCKER_USERMOD='true'` line in `script/docker_dev_setup.sh`. \n  2. Alternatively, you can follow the instructions in `doc/docker/README.md` before running setup. The `CANVAS_SKIP_DOCKER_USERMOD` option is set to true by default in `script/docker_dev_setup.sh`, so you don't need to set it manually.\n\n## As of release/2022-06-08.121\n\n- Skipping Dory setup now works, see [Skip Dory](#skip-dory) for an alternative setup that still allows the use of the `canvas.docker` domain.\n- Mutagen and mutagen-compose are used for file synchronization between docker and host.\n- Skipping Mutagen results in the build failing later on at `bundle install`\n\n## **Note: As of 2022-02-14 and release/2022-02-16.01**\n\nUsing Canvas commit [`60fe0e86c40a346b6ff845e86b3156c7fbf5d32a`](https://github.com/instructure/canvas-lms/releases/tag/release%2F2022-02-16.01)\n\nRefer to the [Quick Start](https://github.com/instructure/canvas-lms/wiki/Quick-Start/3b9ade72fd0cb8a98fea2241c8b8f138bb4b8286) instructions.\n\nThe `script/docker_dev_setup.sh` automated setup script is currently working\non Debian 11 with the following notes:\n\n- [dory](https://github.com/FreedomBen/dory/tree/3420fddf14ae7cfa443612c4cc50d11073311649) appears to be mandatory. Install it on the host, not in a container.\n- To reset the state of the build, remember to delete both images and volumes.\n- Apply the following patch:\n\n```diff\ncommit a30dd213fee92f452160065f50ade61805d87330 (HEAD)\nAuthor: William Ono \u003cwilliam.ono@ubc.ca\u003e\nDate:   Mon Feb 14 16:21:39 2022 -0800\n\n    Account for different CLI syntax\n\ndiff --git a/script/common/os/linux/impl.sh b/script/common/os/linux/impl.sh\nindex 6223f790..fedf0430 100644\n--- a/script/common/os/linux/impl.sh\n+++ b/script/common/os/linux/impl.sh\n@@ -3,10 +3,10 @@ source script/common/utils/spinner.sh\n \n function set_service_util {\n   if installed service; then\n-    service_manager='service'\n+    docker_status='service docker status'\n     start_docker=\"sudo service docker start\"\n   elif installed systemctl; then\n-    service_manager='systemctl'\n+    docker_status='systemctl status docker'\n     start_docker=\"sudo systemctl start docker\"\n   else\n     echo \"Unable to find 'service' or 'systemctl' installed.\"\n@@ -15,7 +15,7 @@ function set_service_util {\n }\n \n function start_docker_daemon {\n-  eval \"$service_manager docker status \u0026\u003e /dev/null\" \u0026\u0026 return 0\n+  eval \"$docker_status \u0026\u003e /dev/null\" \u0026\u0026 return 0\n   prompt 'The docker daemon is not running. Start it? [y/n]' confirm\n   [[ ${confirm:-n} == 'y' ]] || return 1\n   eval \"$start_docker\"\n```\n\n## Skip Dory\n\nThis is using the same method laid out in [Communicating between projects](#communicating-between-projects). Where we put Canvas on a docker network named `docker_canvas_bridge` with an alias of `canvas.docker`. Containers that need to talk to Canvas directly, e.g.: for LTI 1.3 service calls, can reach Canvas via the `canvas.docker` domain as long as they're added to the `docker_canvas_bridge` network too. An example docker-compose.override.yml file with this implemented is in this repo as `docker-compose.override.skip-dory-example.yml`.\n\nIn the example, there's an additional complication, as we're exposing Canvas externally on port 9100 instead of the default port 80. Containers within the same network don't use the external port and needs to talk to the internal port. To maintain consistency, it would be ideal if we can reach Canvas internally on port 9100 too. To this end, the example uses the `socat` utility to internally port forward 9100 to the Canvas web service on port 80. It is to the `socat` service that we attach the `docker_canvas_bridge` network to, since it is the one that'll receive all the requests on port 9100.\n\n---\n---\n\n# Old Non-Vendor Method\n\nRetained for reference.\n\n## Clone Repo\n\n    git clone https://github.com/ubc/docker-canvas.git docker-canvas\n\n## Generate Canvas Docker Image (with issues encountered on stable branch as of 2021-05-18)\n\nBased on SHA `9ad21650ebbee144bd96a28aab53507a1bcefc6c`. Still working as of tag `release\\2021-06-23.26`.\n\nThe 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). *You will also need to copy the `Dockerfile.prod.with.fixes` file into the Canvas-lms repo* and run:\n\n    docker build -t instructure/canvas-lms:stable -f Dockerfile.prod.with.fixes .\n\nNote that Instructure recommends at around 10 GB of RAM to build this image. This will build and tag the image as a newer version in your docker cache.\n\nNotes:\n- There is currently no Dockerfile in Canvas that will generate an easily runnable image. `Dockerfile.prod.with.fixes` is a stopgap to getting a working version of Canvas running without dory/dinghy.\n- It is a combination of Canvas repo's `Dockerfile` and `ubuntu.development.Dockerfile` files.\n- `yarn install` needs the `--network-timeout 600000 --network-concurrency 1` options or it will fail.`\n\n## If it is the first time running:\n\nInitialize data by first starting the database:\n\n    docker compose up -d db\n\nWait a few moments for the database to start then (command might fail if database hasn't finished first time startup):\n\n    CANVAS_RAILS5_2=1 docker compose run --rm app bundle exec rake db:create db:initial_setup\n\nWhen prompted enter default account email, password, and display name. Also choose to share usage data or not.\n\nThe branding assets must also be manually generated when canvas is in production mode:\n\n    docker compose run --rm app bundle exec rake canvas:compile_assets\n    docker compose run --rm app bundle exec rake brand_configs:generate_and_upload_all\n\nEdit `/ect/hosts` and add the line:\n\n    127.0.0.1 docker_canvas_app\n\nFinally startup all the services:\n\n    docker compose up -d\n\nCanvas is accessible at\n\n    http://docker_canvas_app:8900/\n\nMailHog (catches all out going mail from canvas) is accessible at\n\n    http://localhost:8902/\n\n# Running\n\n## Start Server\n\n    docker compose up -d\n\n## Check Logs\n\n    # app\n    docker logs -f docker-canvas_app_1\n\n    # more detailed app logs\n    docker exec -it docker-canvas_app_1 tail -f log/production.log\n\n    # worker\n    docker logs -f docker-canvas_worker_1\n\n    # db\n    docker logs -f docker-canvas_db_1\n\n    # redis\n    docker logs -f docker-canvas_redis_1\n\n    # mail\n    docker logs -f docker-canvas_mail_1\n\n## Stop Server\n\n    docker compose stop\n\n## Stop Server and Clean Up\n\n    docker compose down\n    rm -rf .data\n\n## Update the DB\n\n    CANVAS_RAILS5_2=1 docker compose run --rm app bundle exec rake db:migrate\n\n## Communicating between projects\n\nThe `docker-compose.yml` is setup to allow other docker compose projects to connect via external networks. In `docker-compose.yml` you will see\n\n```\nversion: '3.8'\nservices:\n  ...\n  app: \u0026app\n    ...\n    networks:\n      default:\n        aliases:\n          - app\n      docker_canvas_bridge:\n        aliases:\n          - docker_canvas_app\n  ...\nnetworks:\n  docker_canvas_bridge:\n    name: docker_canvas_bridge\n```\n\nTo include the network in another project you just need to add the network (in additional to the default network) and then you can use the alias `docker_canvas_app:8900` to connect to the canvas app. For example in another project do:\n\n```\nversion: '3.8'\nservices:\n  ...\n  app:\n    ...\n    networks:\n      - default\n      - docker_canvas_bridge\n  ...\nnetworks:\n  docker_canvas_bridge:\n    external: true\n```\n\nFinally you need to edit your `/ect/hosts` and add the line (if you haven't already):\n\n    127.0.0.1 docker_canvas_app\n\nSo your local machine can connect to Canvas using the same alias (this is important for LTI launch redirects).\n\n# Environment Variable Configuration\n\n## Passenger\n\n`PASSENGER_STARTUP_TIMEOUT`: Increase to avoid first time startup Passenger timeout errors (can take a while and the timeout might be too short).\n\n# Update postgres version (from 9.6 to 12.4)\n\n1. `docker compose down`\n1. open `docker-compose.yml` in an editor\n    - comment out the regular section of `db`\n    - uncomment the `tianon/postgres-upgrade` section of `db`\n1. in file explorer / Finder, open the `.data` folder\n    - back a backup copy of the entire `postgres` folder\n    - rename the `postgres` folder to `postgres-9.6`\n1. `docker compose up -d`\n1. wait a few minutes for the upgrade to happen\n1. `docker compose down`\n1. in file explorer / Finder, open the `.data` folder\n    - rename the `postgres-12` folder to `postgres`\n    - edit the `pg_hba.conf` file in `postgres` and add `host all all all md5` to the bottom\n1. open `docker-compose.yml` in an editor\n    - uncomment the regular section of `db`\n    - comment out the `tianon/postgres-upgrade` section of `db`\n1. `docker compose up -d`\n\nAfter you verify that the update worked, you can remove the backup copy of `postgres` and the `postgres-9.6` folders (or keep them as backups for later)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubc%2Fdocker-canvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fubc%2Fdocker-canvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubc%2Fdocker-canvas/lists"}