Posts

Showing posts from May, 2022

How to deploy a Ruby on Rails application to AWS Elastic Beanstalk

Image
  Overview This tutorial will show you how to deploy a Rails application to AWS Elastic Beanstalk. Using Elastic Beanstalk is just one of many (perhaps an infinite number of!) AWS deployment options. Each approach has different pros and cons. I’ll briefly go over some of them because it’s good to understand the pros and cons of various approaches (at least to an extent) before choosing one. Manual EC2 deployment One option is to do things “the old fashioned way” and manually set up a Rails application on a single EC2 instance. This is the approach I go over in  this AWS/Rails deployment post  and it’s perfectly fine for hobby projects where the stakes are low. The downside to manual EC2 deployment is you end up with a  snowflake server , a server with a one-of-a-kind configuration that’s hard to understand, modify, or replicate. Elastic Beanstalk Elastic Beanstalk is  kind of  analogous to Heroku. The basic idea is the same in that both Elastic Beanstalk an...

HOW DO I DEPLOY A RAILS 7 APP TO AMAZON EC2?

Image
Why I wrote this blog post I've been building Rails apps for some time now. I've been mostly relying on  Heroku  to for my deploys. I love Heroku. They make an excellent product, and it's great for quick prototypes and small hobby servers. But for more involved projects, the cost and lack of control don't work for me. I figured it was time to start managing my own infrastructure. Additionally, the  Ruby on Rails 7  just came out, and I wanted to spin up a demo project and check it out. Reading the blog post helped me to learn and solidify my understanding of what all goes into taking a Rails 7 beta project from 0 to AWS, and I hope you find it helpful as well. Who should read this blog post This blog posts assumes some prior knowledge of Ruby on Rails. I learned what I know from: The Michael Hartl Tutorial 12 Rails Apps in 12 Weeks by Mackenzie Childs It also assumes knowledge of command line interfaces, SSH, VIM, and git. Here are some good places to start for that:...

PUMA: puma.service

systemd systemd   is a commonly available init system (PID 1) on many Linux distributions. It offers process monitoring (including automatic restarts) and other useful features for running Puma in production. Service Configuration Below is a sample puma.service configuration file for systemd, which can be copied or symlinked to   /etc/systemd/system/puma.service , or if desired, using an application or instance-specific name. Note that this uses the systemd preferred "simple" type where the start command remains running in the foreground (does not fork and exit). [Unit] Description =Puma HTTP Server After =network.target # Uncomment for socket activation (see below) # Requires=puma.socket [Service] # Puma supports systemd's `Type=notify` and watchdog service # monitoring, if the [sd_notify](https://github.com/agis/ruby-sdnotify) gem is installed, # as of Puma 5.1 or later. # On earlier versions of Puma or JRuby, change this to `Type=simple` and remove # t...