# Deploying to HatchBox with Rails 5.x

DevFeed: [Deploying to HatchBox with Rails 5.x](<https://devfeed.tech/articles/deploying-to-hatchbox-with-rails-5-x-28271.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/rails/2020/09/14/deploying-to-hatchbox-with-rails-5-x.html>)

Author: Fuzzygroup

Published: 2020-09-14T13:22:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Environment Variables](<https://devfeed.tech/topics/environment-variables.md>), [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>)

Tags: [deploy](<https://devfeed.tech/tags/deploy.md>), [environment-variables](<https://devfeed.tech/tags/environment-variables.md>), [hatchbox](<https://devfeed.tech/tags/hatchbox.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [rails](<https://devfeed.tech/tags/rails.md>)

## AI overview

A tutorial on deploying a Rails 5.x application to HatchBox. It covers upgrading to Rails 5.2 when needed, configuring an existing PostgreSQL database and environment variables, creating Rails credentials, setting up a domain and Let's Encrypt SSL, and verifying the deployment.

## Source excerpt

I just got a database less home page for a future SAAS app deployed via HatchBox under Rails 5.x and I thought the differences were significant enough that I should document it. HatchBox is the best tool I've ever found for Rails deploys but knowing all the steps to follow is key. elixi: Other than the Rails 5.2 upgrade step, there aren't many differences between this and Rails 6 but it has been long enough since I've done this that writing it down felt right. 1. Upgrade Rails to "5.2.x" if You Don't Have rails credentials:edit If your Rails 5 version is old enough that you get this crap: ❯ rails credentials:edit rails aborted! Don't know how to build task 'credentials:edit' (see --tasks) Here's the line you want to put into your Gemfile: gem 'rails', '~> 5.2' Once you change your Rails version, you want to use: bundle update to upgrade your Rails installation. 2. There is No True Database Less Deploy in HatchBox HatchBox is designed to work with a database (which is also the Rails default) because it calls database create and database migrate as part of the deploy. The trick here is to use an existing database and set your env variables and database.yml to allow for this Here's how to set up your database.yml file: production: adapter: postgresql url: <%= ENV['DATABASE_URL'] %> encoding: utf8 pool: 50 Your env variables are described in the section below. As long as you don't have migrations or database tables as part of your app, you can use any DATABASE_URL value (you set this below under environment variables; I just copied one from a different application). 4. Run rails credentials:edit The command: rails credentials:edit creates the Rails master key and secret key base that you need. You want to save your master key and secret key base because you need both in the env variables section. 5. HatchBox Setup You want to: Add your app to github or another supported version control system and note the username/repo_name pairing Create a new app Choose the cluster Ad