Skip to content

Deploy a Rails Application

Larry Reid edited this page Apr 13, 2017 · 4 revisions

Issues

  • Putting the "secret" values into the environment. This can be done from the systemd service file, but the question is how best to do it?
  • There are interdependencies between the Nginx service block definition, the Puma service file definition, and the systemd socket definition file (if used or needed)
    • They have to use either a socket or an IP:port
    • The socket name is easy to configure per application
    • The IP:port requires management of the port allocation for each application
    • The way of specifying the two approaches may not be consistent between Nginx and Puma

Other Stuff

On the initial deploy, we need to make the database, and seed it. On all deploys we have to run migrations, and re-seed the database (seed data might change). We also have to bundle install, for added gems, or updates to gems in Gemfile.lock. See: http://sfviapgh.com/blog/2016/2/18/how-to-deploy-rails-with-aws-codedeploy.

Puma Configuration

There was documentation (see below) on what you needed to set up to have hot restarts with no loss of requests. However, I couldn't get that approach to work. I would always get that the socket was already in use.

Puma Start-Up Scripts

See https://github.com/puma/puma/blob/master/docs/systemd.md.

Clone this wiki locally