canvas-lms
canvas-lms copied to clipboard
Docker Dev Setup: Wrong containers up when creating db; With fix
Summary: I was trying to run the docker_dev_setup.sh script and noticed it failed with not being able to resolve the address for
redis and postgres. I looked at the recent edits to the file and noticed on line 81 of build_helps.sh it was bringing up just the web containers. After removing "web" on line 81 it fixed the issue but, from a brief understanding, it messes up the ability to not use mutagen if desired. It also has issues in the next step dropping the database if it exists
Steps to reproduce:
- Copy current version of the repository
- After all the dependencies are met, run script/docker_dev_setup.sh
- See that creating_db fails with error regarding name resolution for postgres and redis
Expected behavior:
Script runs to completion.
Actual behavior:
Script stops after creating_db by not able to find postgres and redis
Additional notes:
Removing "web" on line 81 in build_helpers.sh fixed the issue @jbutte I noticed the change was made by you while trying to add support for not using mutagen-compose; It would be great if you could advise on if this behavior is correct and I am doing something wrong
With line 81 "web" still i place in build_helpers.sh and the error: docker_dev_setup_line_81.log
Without "web" line 81: docker_dev_setup_wo_line_81.log
Again, please note that removing "web" on line 81 causes issue with db:drop with an error related to canvas-development being in use. But, to fix that I either skip the drop or delete the db manually. Running the script from scratch but with the above fix should yield expected behavior
Thanks!
Here is the full run after I manually delete the database and start fresh.
To manually delete the database I used
mutagen-compose run --rm web bundle exec rake db:drop
After reviewing your logs I think I found the issue. Can you confirm your docker-compose.override.yml looks like this:
# See doc/docker/README.md or https://github.com/instructure/canvas-lms/tree/master/doc/docker
version: '2.3'
services:
jobs: &BASE
build:
context: .
volumes:
- code:/usr/src/app
- bundle:/home/docker/.bundle/
- canvas-docker-gems:/home/docker/.gem/
- yarn-cache:/home/docker/.cache/yarn
environment: &BASE-ENV
ENCRYPTION_KEY: facdd3a131ddd8988b14f6e4e01039c93cfa0160
RAILS_ENV: development
webpack:
<<: *BASE
command: yarn run webpack
web:
<<: *BASE
environment:
<<: *BASE-ENV
VIRTUAL_HOST: .canvas.docker
VIRTUAL_PORT: 80
HTTPS_METHOD: noredirect
postgres:
volumes:
- pg_data:/var/lib/postgresql/data
githook_installer:
build:
context: .
dockerfile: 'Dockerfile.githook'
volumes:
- ./.git:/tmp/.git
- ./hooks:/tmp/hooks
- ./script:/tmp/script
volumes:
code: {}
bundle: {}
canvas-docker-gems: {}
pg_data: {}
yarn-cache: {}
x-mutagen:
sync:
defaults:
ignore:
vcs: true
code:
mode: "two-way-resolved"
alpha: "."
beta: "volume://code"
configurationBeta:
permissions:
defaultOwner: "id:9999"
defaultGroup: "id:9999"
ignore:
paths:
- "/.bundle/"
- "/.byebug_history"
- "/.ruby-version"
- "!/packages/*/node_modules/"
- "!/packages/*/es/"
- "!/packages/*/lib/"
- "/packages/*/node_modules/*"
- "/packages/*/es/*"
- "!/packages/canvas-rce/es/*"
- "/packages/*/lib/*"
- "!/packages/translations/lib/*"
- "!/gems/**/node_modules/"
- "/gems/**/node_modules/*"
- "/packages/canvas-planner/.babel-cache"
- "!/public/doc/api/"
- "/public/doc/api/*"
- "!/app/stylesheets/brandable_css_brands/"
- "/app/stylesheets/brandable_css_brands/*"
- "/packages/canvas-rce/canvas"
- "!/public/dist/"
- "/public/dist/*"
- "!/config/locales/generated/"
- "/config/locales/generated/*"
- "!/log/"
- "/log/*"
- "!/node_modules/"
- "/node_modules/*"
- "!/pacts/"
- "/pacts/*"
- "!/reports/"
- "/reports/*"
- "!/app/views/info/"
- "/app/views/info/*"
- "!/tmp/"
- "/tmp/*"
- "!/public/javascripts/translations/"
- "/public/javascripts/translations/*"
- "!/.yardoc/"
- "/.yardoc/*"
- "/.vscode"
- "/tags"
- "/tags.*"
- "/vendor/bundle/"
I believe it will not match this. There is a bug I found where the script is copying the wrong docker-compose.override.yml due to IS_MUTAGEN not getting set. You can test this by deleting your current docker-compose.override.yml and manually copying over the mutagen one with cp docker-compose/mutagen/docker-compose.override.yml docker-compose.override.yml, then running docker_dev_setup.sh again.