Skip to content

Deploying mclab web

Deepanjan Roy edited this page Jan 13, 2016 · 2 revisions

Where is the live site deployed?

The live version of the site is currently deployed on a VM on the SOCS servers. It runs on a diskless VM running Ubuntu trusty, and all the files are (I think) stored in a Sable NAS.

On the internal SOCS DNS, the address of the VM is mclab-web-ui.cs.mcgill.ca. You can ssh into teaching.cs.mcgill.ca, and then ssh into mclab-web-ui.cs.mcgill.ca from there. You should also be able to directly access it (as long as you're on the McGill network / connected to the McGill VPN) at the IP address 132.206.3.105, but it is not guaranteed that this IP address will always stay the same.

Live server

The VM runs an apache server, and Django is connected to it using WSGI. This is the current apache-config file at /home/sable/mclab-web-ui/apache2/sites-enabled/mclab-web-ui.conf:

<VirtualHost *:80>
    Alias /static /home/sable/mclab-web-ui/mclab-web/static
    <Directory /home/sable/mclab-web-ui/mclab-web/static>
        Require all granted
    </Directory>

    <Directory  /home/sable/mclab-web-ui/mclab-web/mlweb>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    WSGIDaemonProcess myproject python-path=/home/sable/mclab-web-ui/mclab-web:/home/sable/mclab-web-ui/mclab-web/prodenv/lib/python2.7/site-packages
    WSGIProcessGroup myproject
    WSGIScriptAlias / /home/sable/mclab-web-ui/mclab-web/mlweb/wsgi.py

</VirtualHost>

The config file is a result of quite a bit of trial and error, and it is possible that it can be made simpler, but right now it gets the job done.

As you can probably tell, the website is served to the world at the default port 80, so when everything is working right McLab-Web should be usable at http://132.206.3.105/ within the McGill network.

The server can be started/stopped/restarted using sudo /etc/init.d/apache2 start|stop|restart. The logs are visible at var/log/apache2/. If you don't have permission to the apache command or access the logs, either find someone else working on the project who has the proper permissions, or email the SOCS admin at [email protected] and CC Prof Hendren.

The McLab software (Mc2For.jar and McLabCore.jar as of writing this page) is put directly in /home/sable/mclab-web-ui. Once you create a settings.py file from settings.py.example, you have to edit the relevant path variables.

Redeploying the site

This git repository resides at /home/sable/mclab-web-ui/mclab-web and Django app runs there. Navigate into this directory and do a git pull. If there are new python dependencies, you can install them using pip install -r requirements.txt (as long as you have updated the requirements.txt file already; you can do this using pip freeze > requirements.txt from your dev environment). Then restart the apache server.

For some difficulty related to the version of node.js on the server, we cannot compile the javascript there. You should produce static/bundle.js in your local dev environment (this is created when you run npm start), and then copy this bundle.js file to /home/sable/mclab-web-ui/mclab-web/static.

Although currently the site is served from the master branch, we should probably consider making a production brunch for the live site which periodically pulls in changes from master.

Other notes

  • I don't know if there's a way to set the HOME variable or have a .profile/.bashrc file in a diskless VM setup. If you try to install something and the installation fails, you may need to the manually set the HOME variable from the shell:
export HOME=/home/sable/mclab-web-ui/