Skip to content
Patrick Bolger edited this page Jun 21, 2018 · 7 revisions

The production server: configuration, backups, etc.

Configuration

Is a DigitalOcean droplet

Configured with this process this GoRails guide on setting up a Ruby on Rails production environment: 'Deploy Ruby On Rails on Ubuntu 14.04 Trusty Tahr'

With these differences:

  • no documentation is installed for any gems. This is accomplished by setting the --no-documentation option for the deploy user as follows:
    • when you're logged in to the production server as the deploy user, execute this command: echo "gem: --no-document" > ~/.gemrc

To log in as the deployment user, you must use SSH.

This means you cannot use the DigitalOcean console to log in as that user. Please contact one of the project leads if you need the userid and SSH access.

Environment Variables

Environment variables are used to set passwords, users, etc. These are set in a .env file, and the dotenv is used to access them. The Capistrano component capistrano/env-config uses (required) dotenv; that is how the dotenv gem is included in the project (how it gets into Gemfile.lock).

Logs

cron log

By default, Ubuntu does not log cron activity to a separate log. This was changed by editing \etc\rsyslog.d\50-default.conf and removing the # to uncomment out the line before cron.*. Then rsyslog the and cron services were restarted.

Log rotation

The logs (the logs in the Rails /logs directory) are 'rotated' using the unix logrotate program. This means that the logs are copied and compressed on a certain schedule so that we don't end up with 1 giant log file.

The log rotation schedule was set up as is described in this guide: GoRails guide 'Rotating Rails Production Logs with LogRotate'

Except that we currently keep all logs. Until we know how much data to keep and/or have another place to store the older logs, we will keep them all.

Before changing /etc/logrotation.conf, a copy of the file was saved as /etc/logrotation.conf.orig

Backups

Backups are performed by the backup rake task (on the deployment server, see /home/deploy/shf/current/lib/tasks/backup.rake).

The contents of the current directory are backed up (recursively), as is the database. A separate file is created for each of these.

Due to limited space, a small set of backup files is maintained on the production server (in ~/SHF_BACKUPS). Another, larger set of backup files is maintained in AWS S3 (see Susanna for access credentials).

Clone this wiki locally