Skip to content

Server Basics

Siqi Tian edited this page Feb 5, 2017 · 2 revisions

The server runs on linux(Ubuntu) instance at AWS. Information about AWS is in config/oauth.conf under AWS.

Apache is the reverse proxy that sits between Django (the app) and outside world. It handles HTTP requests and spawns python processes. Django is used for web framework. MySQL is the database engine.

The server uses Stanford WebAuth module for access control. Thus members can login with their sunet_id instead of a separate login system. Access groups are defined in config/group.conf.

When making changes to static assets, including *.html, *.css, *.js, images/pdf files, as well as MySQL database, you don't need to restart Apache. Changes will be reflected upon browser refresh (sometimes browser cache may delay it).

In contrary, when making changes to script files, including *.py, *.conf, *.sh, as well as Apache settings, you have to restart Apache to reflect changes. A quick way to do so is running a2rs, which is an alias for sudo apache2ctl restart.

Server Downtime

To mark the server as temporarily unavailable, change IS_MAINTENANCE to true in config/t47_dev.py. The server will still be running, but only returns status 503 for any requests.

Shortcut Commands

The following aliases are provided for you convenience:

  • sync: Updates server code from repository, makes it ready, and deploys.
  • upd: Updates installed packages.
  • Other commands for checking logs, cron jobs, and swap memory. See /admin/ref/ for more details.

Django Commands

The following Django commands are available. Run them with dj_man, or in full-length, e.g. python manage.py dist.

Command Description
backup Backs up static files, MySQL, Apache, and local config/ files into backup/ folder.
bday Checks if anyone's birthday is today and sends out wishes in Slack.
cache Caches analytics data into cache/. Accepts an interval argument for category, choose from: 3, 15, or 30.
duty Checks if any duty reminders should be sent out today. Accepts an interval argument for category, choose from: week, month, or quarter.
gdrive Uploads most recent backup onto daslab Google Drive and cleans up obsolete backup files.
meeting Sets up Flash Slides and sends out Group Meeting Reminder.
report Sends cron error report to admin if not IS_SLACK. Also compresses cron log and cleans up old Slack Messages.
restore Restores static files, MySQL, Apache, and local config/ files from local backup/ files.
versions Collects system installed package versions into cache/stat_sys.json and cache/stat_ver.json. Accepts a flag argument for overriding IS_VERSIONS in config/bot.conf, chooses from: 0 or 1.

Environment Path

Item Path
Repository /home/ubuntu/Server_DasLab/
MySQL settings /etc/mysql/my.cnf
Apache settings /etc/apache2/
Kerberos settings /etc/krb5.*
Apache log /var/log/apache2/
Django and cron log cache/
static files data/
Secret / configurations config/

Clone this wiki locally