Skip to content

Latest commit

 

History

History
88 lines (64 loc) · 1.64 KB

DEPLOY.md

File metadata and controls

88 lines (64 loc) · 1.64 KB

Deploy

The repository contains all the configuration files needed to deploy the application on a standard Linux server.

Requirements

  • Ruby
  • Redis
  • Nginx
  • Systemd

Installation

Clone

First off, clone the repository

mkdir -p /var/www/rubies
cd /var/www/rubies
git clone https://github.com/epistrephein/rubies.git .

Bundler

Use bin/setup to configure bundler automatically for production

bin/setup -p

or manually set the needed bundler flags and install

bundle config set --local deployment true
bundle config set --local without development test
bundle config set --local clean true
bundle install

Redis

Populate Redis manually once and setup cron for automatic updates

bundle exec rake redis
bundle exec whenever --update-crontab

Systemd

Copy the systemd service and enable it

sudo cp config/rubies.service /etc/systemd/system/rubies.service
sudo systemctl enable --now /etc/systemd/system/rubies.service
sudo systemctl status rubies

Nginx

Copy the nginx configuration and enable it.
SSL certificates are expected in /etc/nginx/certs/rubies.io/.

sudo cp config/rubies.nginx /etc/nginx/sites-available/rubies.io
sudo ln -s /etc/nginx/sites-available/rubies.io /etc/nginx/sites-enabled/rubies.io
sudo systemctl restart nginx

Logrotate

Both the Redis cron and unicorn produce logs in /var/www/rubies/log/ so it's recommended to setup logrotate.
Create a /etc/logrotate.d/rubies file with the following content:

/var/www/rubies/log/*.log {
  monthly
  missingok
  rotate 7
  compress
  delaycompress
  notifempty
  copytruncate
}