Authors: Håvard Pedersen & Øyvind Guttvik Årnes
A tool for syncing timetables from TP to Canvas.
Set CANVAS_TOKEN
, DB_USER
, DB_PASS
, MQ_USER
, MQ_PASS
as environment variable
Use ruby 2.5.1, Recommend https://github.com/rbenv/rbenv to install Ruby.
Migrate database
mysql:
sequel -m . mysql2://[username]:[password]@appbase.uit.no/tp_canvas_prod
Note: special characters must be url-encoded in username/password
Sequel migrations: https://github.com/jeremyevans/sequel/blob/master/doc/migration.rdoc
To run: ruby tp-canvas-sync.rb --help
Add proxy=http://swproxy.uit.no:3128
to /etc/yum.conf
Install packages: sudo yum install -y git openssl-devel readline-devel zlib-devel postgresql-devel mysql-devel
sudo adduser sua
export http_proxy=http://swproxy.uit.no:3128
export https_proxy=https://swproxy.uit.no:3128
export TMPDIR=/home/sua/tmp
Follow instructions: https://github.com/rbenv/rbenv
git config --global http.proxy http://swproxy.uit.no:3128
git clone git@github.com:uit-no/tp-canvas.git /home/sua/tp-canvas
Set ENV: CANVAS_TOKEN DB_USER DB_PASS MQ_USER MQ_PASS
in /home/sua/tp-canvas
:
gem install bundler
bundle install
ruby tp-canvas-sync.rb -m
<- monitor message queue
sudo cp /home/sua/tp-canvas/tp-canvas.service /lib/systemd/system/
edit /lib/systemd/system/tp-canvas.service
, set env values
sudo systemctl enable tp-canvas.service
sudo systemctl start tp-canvas.service
Service status: sudo systemctl status tp-canvas.service
Add values to ENV variables
# begin Canvas course change check
RBENV_VERSION=2.5.1
CANVAS_TOKEN=
DB_USER=
DB_PASS=
MQ_USER=
MQ_PASS=
SENTRY_DSN=
http_proxy=
https_proxy=
0 2 * * * /bin/bash -l -c 'cd /home/sua/tp-canvas && /home/sua/.rbenv/shims/ruby tp-canvas-sync.rb --canvas-diff 18h'
#end Canvas course change check