Canvas LMS/Upgrading
Contents |
Instruction source
All instructions are from the Canvas LMS Github wiki
Requirements
These upgrade instructions make the following assumptions:
- you installed canvas lms via git
- redis is running at a version greater than 2.6
- you are logged in as the original user who installed canvas and ran the git and gem installs
- you've created a backup or snapshot before continuing
- there are no local changes you've made to the canvas code that are different than the stable version on github
Upgrade Source
Start by logging in as the original user that installed Canvas. This is very important as you'll encounter permission issues with git.
~/var/canvas$ sudo su helpdesk ~/var/canvas$ git fetch && git reset --hard origin/stable ... HEAD is now at da056ac treesame commit of origin/stable/2016-01-09
Upgrade and Install Bundled Gems
~/var/canvas$ bundle update addressable ~/var/canvas$ bundle install
Reason:
If you get the same error as I did:
/var/canvas$ bundle install Fetching source index from https://rubygems.org/ Resolving dependencies..... You have requested: addressable = 2.3.8 The bundle currently has addressable locked at 2.3.5. Try running `bundle update addressable`
Then instead first run:
~/var/canvas$ bundle update addressable
and you should get:
Your bundle is updated! Gems in the groups sqlite and mysql were not installed.
Follow that up with:
~/var/canvas$ bundle install
and you should get:
Your bundle is complete! Gems in the groups sqlite and mysql were not installed. It was installed into ./vendor/bundle
Upgrade and Install Node Modules
~/var/canvas$ npm install
Set Permissions
You'll need to temporarily change permissions to allow the update (my user that performs updates is helpdesk):
/var/canvas$ sudo chmod 660 ./config/*.yml /var/canvas$ sudo chown canvasuser:helpdesk ./config/*.yml
Complied Assets
With the permissions set:
~/var/canvas$ RAILS_ENV=production bundle exec rake canvas:compile_assets
Reason:
If you get an error:
rake aborted! Undumpable Exception -- #<Errno::EACCES: Permission denied @ rb_sysopen - /var/canvas/config/domain.yml>
Then you'll need to temporarily change permissions to allow the update:
/var/canvas$ sudo chmod 660 ./config/domain.yml
The above makes the assumption that the user you are logged in as is either the file owner or part of the group owner.
Once the permission is set, try to upgrade again. If successful then:
/var/canvas$ sudo chmod 400 ./config/domain.yml
Database Migrations
With the permissions set:
~/var/canvas$ RAILS_ENV=production bundle exec rake db:migrate
For some odd reason I still got an unspecified error, even with the permissions set. I ran it a second time with --trace so I could see a more verbose error output and it completed successfully?
Reason:
If you get an error:
rake aborted! Errno::EACCES: Permission denied @ rb_sysopen - /var/canvas/config/cache_store.yml Errno::EACCES: Permission denied @ rb_sysopen - /var/canvas/config/redis.yml Errno::EACCES: Permission denied @ rb_sysopen - /var/canvas/config/database.yml encryption key required, see security.yml.example Errno::EACCES: Permission denied @ rb_sysopen - /var/canvas/config/outgoing_mail.yml Errno::EACCES: Permission denied @ rb_sysopen - /var/canvas/config/file_store.yml StandardError: An error has occurred, this and all later migrations canceled:
Just like before, you'll need to set the appropriate permissions:
/var/canvas$ sudo chmod 660 ./config/*.yml
The above makes the assumption that the user you are logged in as is either the file owner or part of the group owner. I was not, so I had to:
/var/canvas$ sudo chown canvasuser:canvasgroup ./config/*.yml
Once the permission is set, try to upgrade again. If successful then:
/var/canavs$ sudo chown canvasuser:canvasgroup ./config/*.yml sudo chown canvasuser:canvasgroup ./config/cache_store.yml sudo chown canvasuser:canvasgroup ./config/redis.yml /var/canvas$ sudo chmod 400 ./config/*.yml
Notification types
~/var/canvas$ RAILS_ENV=production bundle exec rake db:load_notifications
If you get an error:
rake aborted! Errno::EACCES: Permission denied @ rb_sysopen - /var/canvas/config/brandable_css.yml
Just like before, you'll need to set the appropriate permissions:
/var/canvas$ sudo chmod 660 ./config/*.yml
The above makes the assumption that the user you are logged in as is either the file owner or part of the group owner. I was not, so I had to:
/var/canvas$ sudo chown canvasuser:canvasgroup ./config/*.yml
Once the permission is set, try to upgrade again. If successful then:
/var/canavs$ sudo chown canvasuser:canvasgroup ./config/*.yml sudo chown canvasuser:root ./config/cache_store.yml sudo chown canvasuser:root ./config/redis.yml /var/canvas$ sudo chmod 400 ./config/*.yml
Restart Services
~/var/canvas$ sudo service postgresql restart ~/var/canvas$ sudo service apache2 restart
Troubleshooting
During my install, once I was done, I got the following message:
Permission denied @ rb_sysopen - /var/canvas/config/cache_store.yml (Errno::EACCES)
It appears that the update restart the file permission for /var/canvas/config.ru back to the installation user I was running as, rather than the user canvas runs as. As such, I had to run:
~/var/canvas$ sudo chown canvasuser ./config.ru