-
Notifications
You must be signed in to change notification settings - Fork 37
Production server
The production server: configuration, backups, etc.
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 thedeploy
user as follows:- when you're logged in to the production server as the
deploy
user, execute this command:echo "gem: --no-document" > ~/.gemrc
- when you're logged in to the production server as the
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 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
).
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.
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 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).