-
Notifications
You must be signed in to change notification settings - Fork 227
Deploying Autolab on Ubuntu
These are the instructions for setting up Autolab for production usage. It's the closest to the way we run Autolab for our CMU Autolab instance, but it's certainly not the fastest way to get up and running with a version of Autolab that you can play around with. Be sure to check out "Getting Started" in the sidebar if this is your first experience with Autolab.
Rather than explicit instructions, this documentation should be treated as "tips" for deploying Rails. For example, we use Apache at CMU, but there's really nothing stopping you from running Nginx or your favorite web server.
Without further ado, let's get started!
Make sure you have Apache installed. If you set up Ubuntu Server as a LAMP server, you already have it installed.
2. Follow the Installing Autolab on Ubuntu instructions
You're going to want to follow the Installing Autolab on Ubuntu instructions. This article covers how to install Autolab for development, so you should make the following notes when running through them and adjust your actions accordingly:
- Login as
apache
orwww-data
user before installingrbenv
andruby-build
. - When installing
rbenv
, if you get aPermission denied
error when you restart the shell, addbeforeexport RBENV_ROOT="$HOME/rbenv"
rbenv init -
in your~/.bashrc
. Otherwise, skip the next remark. - When installing
ruby-build
, if you setRBENV_ROOT
in the step above, make sure to clone the ruby-build plugin to$HOME/rbenv/plugins
. - Make the Apache user & group you set in Step 1 the user & group of the Autolab project directory. There's no need to modify permissions.
Make sure the development version runs before going on to the next step.
You're going to want to set up the Autolab VirtualHost at port 443 (HTTPS). Here's what our VirtualHost config file look like:
<VirtualHost _default_:443>
DocumentRoot /path/to/Autolab/public
<Directory /path/to/Autolab/public>
Allow from all
AllowOverride all
Options -MultiViews
</Directory>
# Uncomment these two lines if you want to
# customize log path
#ErrorLog /path/to/error_log
#CustomLog /path/to/access_log combined
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
# A self-signed (snakeoil) certificate can be created by installing
# the ssl-cert package. See
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
SSLCertificateFile /path/to/certificate.pem
SSLCertificateKeyFile /path/to/certificate.key
</VirtualHost>
Then, run sudo a2enmod ssl
to enable the ssl module.
First, install the passenger gem:
$ gem install passenger
Then, execute
$ passenger-install-apache2-module
to install the passenger Apache module. Follow the on-screen instructions to load passenger in Apache.
At this time you should be able to see Autolab running on the HTTPS port. Run
RAILS_ENV=production rake assets:precompile
if you can't see images on the
website.
-
Sign up on the Autolab website just set up.
-
Run
RAILS_ENV=production rails console
under Autolab directory. -
In the console, run the following command:
u = User.where(email: "[your email here]").first u.administrator = true u.save!
-
Next time you sign in to Autolab, you should be able to create courses.
See something wrong or out of date? Did our wording trip you up? Bad documentation sucks for everyone--be sure to let us know if there's something out of place!
-- The Autolab Team