staging to production changeover checklist - restarone/violet_rails GitHub Wiki

If you're reading this, your Violet Rails site is ready for showtime -- Congrats. This guide is aimed to make sure that your site transitions from staging to production smoothly.

put Violet Rails in maintenance mode

Maintenance mode is provided by Turnout, see usage here: https://github.com/biola/turnout#activation

Remove existing Nginx configuration

Most likely, your production site will be hosted on a different domain. So you will need to remove the original nginx configuration and break the symlink between that configuration and the sites-available index. Here's an example of promoting a site from staging.restarone.com to production.restarone.com:

# remove the original nginx configuration
sudo rm /etc/nginx/sites-available/staging.restarone.com.conf
#break the symlink
sudo rm /etc/nginx/sites-enabled/staging.restarone.com.conf

Create new nginx configuration

Follow the guide here for creating your new nginx config: https://github.com/restarone/violet_rails/wiki/Deploying-to-EC2-(with-Capistrano)#nginx-setup-etcnginxsites-availablerestaronesolutionsconf

Configure TLS/SSL with certbot

Follow the guide here for configuring certbot with a manual challenge. Make sure you have access to your DNS provider so you can add the acme-challenge as a TXT record: https://github.com/restarone/violet_rails/wiki/Deploying-to-EC2-(with-Capistrano)#setup-ssl-and-certbot

Change your hostname in .rbenv-vars

Every Violet Rails installation holds its environment variables under /var/www/violet/.rbenv-vars. Make sure you have updated the entry related to APP_HOST to point to your web address (ex: restarone.com)

Ensure you can send emails from your new domain

If you are using Mailgun, make sure to verify your new domain with mailgun. Otherwise Violet Rails would not be able to send emails (it will raise an exception and crash when you trigger something that requires sending an email email like a password reset).

Configure logrotate

A production system with lots of traffic and users will generate lots of logs. To prevent the server from running out of storage, configure log rotate to compress and purge log files using this guide: https://github.com/restarone/violet_rails/wiki/purging-log-files-in-a-production-environment

make sure mailgun authorizations are in place

or double check whatever email provider you are using can send emails with the new app host

Restart the system!

Once all these changes are made, you will have to manually restart nginx and puma:

sudo systemctl restart puma.service
sudo service nginx reload