/docker-canvas

Simple docker configuration for running Canvas-LMS

docker-canvas

Simple docker configuration for running Canvas-LMS

Installation

  • Clone code to /canvas-lms
  • Edit puma config to bind the app to correct place:
threads 0,1
bind 'unix:///canvas/shared/puma.sock'
  • Copy configuration file and fill with yours:
    • security.yml
    production:
    # replace this with a random string of at least 20 characters
    encryption_key: 12345
    
    development:
      encryption_key: facdd3a131ddd8988b14f6e4e01039c93cfa0160
      previous_encryption_keys:
       - 0610afc39c93010e4e6f41b8898ddd131a3ddcaf
    
    test:
      encryption_key: facdd3a131ddd8988b14f6e4e01039c93cfa0160
    • database.yml
    test:
      adapter: postgresql
      encoding: utf8
      database: canvas_test
      host: localhost
      username: canvas
      timeout: 5000
    
    development:
      adapter: postgresql
      encoding: utf8
      database: canvas_development
      timeout: 5000
    
    production:
      adapter: postgresql
      encoding: utf8
      database: canvas
      host: localhost
      username: canvas
      password: 123123
      timeout: 5000
    • domain.yml
    test:
      domain: localhost
    
    development:
      domain: "localhost:3000"
    
    production:
      domain: "yourdomainhere"
      # whether this instance of canvas is served over ssl (https) or not
      # defaults to true for production, false for test/development
      # ssl: true
      # files_domain: "canvasfiles.example.com"
    • redis.yml
    production:
      # only tests that are exercising the integration with redis require redis to run.
      servers:
        - redis://redis
      # warning: the redis database will get cleared before each test, so if you
      # use this server for anything else, make sure to set aside a database id for
      # these tests to use.
      database: 1
    • cache_store.yml
    production:
      cache_store: redis_store
    • delayed_jobs.yml
    production:
      workers:
      - queue: canvas_queue
        workers: 2
        max_priority: 10
      - queue: canvas_queue
        workers: 4
  • Run docker-compose run web bash and then following commands to initialize canvas:
mkdir -p log tmp/pids public/assets app/stylesheets/brandable_css_brands && \
    touch app/stylesheets/_brandable_variables_defaults_autogenerated.scss && \
    chown -R $CANVAS_USER config/environment.rb log tmp public/assets \
    app/stylesheets/_brandable_variables_defaults_autogenerated.scss \
    app/stylesheets/brandable_css_brands Gemfile.lock config.ru && \
    bundle exec rake canvas:compile_assets && \
    chown $CANVAS_USER config/*.yml && \
    chmod 400 config/*.yml && \
    bundle exec rake db:initial_setup && \
    bundle exec rake brand_configs:generate_and_upload_all

TODO

  • Add nginx
  • postgresql pg_collkey
  • Add redis
  • Container for background jobs
  • Run puma with correct user