# hatchbox

Published articles for hatchbox.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Getting Past strscan Gem Issues in Rails

DevFeed: [Getting Past strscan Gem Issues in Rails](<https://devfeed.tech/articles/getting-past-strscan-gem-issues-in-rails-28285.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/rails/2022/06/23/getting-past-strscan-gem-issues-in-rails.html>)

Author: Fuzzygroup

Published: 2022-06-23T07:51:00Z

Content type: tutorial

Language: en

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

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [nginx](<https://devfeed.tech/topics/nginx.md>), [configuration](<https://devfeed.tech/topics/configuration.md>)

Tags: [cartazzi](<https://devfeed.tech/tags/cartazzi.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [deploy](<https://devfeed.tech/tags/deploy.md>), [hatchbox](<https://devfeed.tech/tags/hatchbox.md>), [nginx](<https://devfeed.tech/tags/nginx.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [ssh](<https://devfeed.tech/tags/ssh.md>)

### AI overview

This troubleshooting article explains how a Rails 7.0.3 deployment on HatchBox failed because the application had activated strscan 3.0.1 while the Gemfile required 3.0.3. After other suggested fixes failed, adding a Passenger-level Bundler configuration through HatchBox's custom NGINX configuration resolved the problem.

### Source excerpt

Yesterday I deployed a new thing via HatchBox and I was using the very, very latest - Rails 7.0.3. My deploy was textbook perfect and then I viewed it in Chrome and got that awful, awful message: Web application could not be started Insert loud cursing here I know the drill - it is a lower level error than HatchBox can handle (although I can think of at least a few ways HatchBox could handle it) - so do the dance: SSH into the box sudo su tail -f /var/log/nginx/error.log Read the error, google and assess. Here was the error: root@cartazzi3-web1:/home/deploy/Cartazzi/releases/20220608082805# tail -f /var/log/nginx/error.log App 14330 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>' App 14330 output: /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:397:in `run_block_and_record_step_progress' App 14330 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>' App 14330 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>' App 14330 output: /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>' [ E 2022-06-22 15:04:13.2231 21017/T9t age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/deploy/cartazzi_marketing/current: The application encountered the following error: You have already activated strscan 3.0.1, but your Gemfile requires strscan 3.0.3. Since strscan is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports strscan as a default gem. (Gem::LoadError) Error ID: 9a03b9ce Error details saved to: /tmp/passenger-error-pO6ZTu.html The normal googling suggested things like: Update strscan on the host system Mess with Gemfile Mess with Gemfile.lock Add a Passenger level configuration var for bundler I'd give citations for these but Chrome just crashed and it is closing in on 4 am and the weariness in my bones doesn't allow me to r

## Using SSL in HatchBox with AWS Route 53

DevFeed: [Using SSL in HatchBox with AWS Route 53](<https://devfeed.tech/articles/using-ssl-in-hatchbox-with-aws-route-53-28286.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/rails/2022/06/23/using-ssl-in-hatchbox-with-aws-route-53.html>)

Author: Fuzzygroup

Published: 2022-06-23T07:01:00Z

Content type: tutorial

Language: en

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

Topics: [Amazon Route 53](<https://devfeed.tech/topics/amazon-route-53.md>), [Rails](<https://devfeed.tech/topics/rails.md>), [SSL](<https://devfeed.tech/topics/ssl.md>), [Amazon Web Services](<https://devfeed.tech/topics/aws.md>), [AWS IAM](<https://devfeed.tech/topics/aws-iam.md>), [Deployment](<https://devfeed.tech/topics/deployment.md>), [JSON](<https://devfeed.tech/topics/json.md>)

Tags: [aws](<https://devfeed.tech/tags/aws.md>), [cartazzi](<https://devfeed.tech/tags/cartazzi.md>), [credentials](<https://devfeed.tech/tags/credentials.md>), [deployment](<https://devfeed.tech/tags/deployment.md>), [hatchbox](<https://devfeed.tech/tags/hatchbox.md>), [iam](<https://devfeed.tech/tags/iam.md>), [json](<https://devfeed.tech/tags/json.md>), [rails](<https://devfeed.tech/tags/rails.md>), [route53](<https://devfeed.tech/tags/route53.md>), [ssl](<https://devfeed.tech/tags/ssl.md>)

### AI overview

A practical guide to configuring wildcard SSL in HatchBox with AWS Route 53. It explains the required Route 53 setup, IAM user and JSON policy configuration, credential handling, and the addition of route53:ListResourceRecordSets after an incomplete policy caused validation problems.

### Source excerpt

HatchBox continues to be my favorite tool for Rails deployment hands down. And this includes Dockarno - my own Bash based Docker deployment tool. When something you pay for replaces something you wrote yourself, that's a sign of its very, very strong goodness. I just used HatchBox to support SSL wildcard deployment for something I'm building and the process was a tad bit tricky so I thought I'd write it up. HatchBox has excellent built in SSL support using Let's Encrypt but when you use wildcard SSL, you get asked for the Route 53 Key and the Route 53 secret. Here's how you get those: On AWS, in Route 53 In Route 53, make sure you have *.domain.extension defined to allow it to be wildcard. On AWS, in IAM In the IAM console, you need to: Add a user Add that user to a group Add a JSON policy document Here is the JSON policy that you need to add: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "route53:GetChange", "Resource": "arn:aws:route53:::change/*" }, { "Effect": "Allow", "Action": "route53:ChangeResourceRecordSets", "Resource": "arn:aws:route53:::hostedzone/*" }, { "Effect": "Allow", "Action": "route53:ListHostedZonesByName", "Resource": "*" }, { "Effect": "Allow", "Action": "route53:ListHostedZones", "Resource": "*" }, { "Effect": "Allow", "Action": "route53:ListResourceRecordSets", "Resource": "*" } ] } After you've added that user then you will be prompted with the normal AWS access key / secret key. Save the credentials and then add them to HatchBox. HatchBox will then got thru an API session with AWS and validate the key. My Experience and Chris's Brilliant Work I started from documentation I found online (see below) that turned out to be incomplete. When I examined the HatchBox log for the transaction, I saw this: -----> Connecting to SOMETHING3-lb (138.68.227.244 port 22) as root Uploaded /etc/logrotate.d/acme.sh Executing 'curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | sh -s -- --install-online' %

## Rails 7 Madness: No such middleware to insert before: ActionDispatch::Static

DevFeed: [Rails 7 Madness: No such middleware to insert before: ActionDispatch::Static](<https://devfeed.tech/articles/rails-7-madness-no-such-middleware-to-insert-before-actiondispatch-static-28277.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/rails/2022/06/02/rails-7-madness-no-such-middleware-to-insert-before-actiondispatch-static.html>)

Author: Fuzzygroup

Published: 2022-06-02T04: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>), [Vite](<https://devfeed.tech/topics/vite.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [npm packages](<https://devfeed.tech/topics/npm-packages.md>)

Tags: [deploy](<https://devfeed.tech/tags/deploy.md>), [errors](<https://devfeed.tech/tags/errors.md>), [hatchbox](<https://devfeed.tech/tags/hatchbox.md>), [logging](<https://devfeed.tech/tags/logging.md>), [npm-packages](<https://devfeed.tech/tags/npm-packages.md>), [rails](<https://devfeed.tech/tags/rails.md>), [rake](<https://devfeed.tech/tags/rake.md>), [troubleshooting](<https://devfeed.tech/tags/troubleshooting.md>), [vite](<https://devfeed.tech/tags/vite.md>)

### AI overview

A troubleshooting account of a Rails 7 deployment error reporting that no middleware could be inserted before ActionDispatch::Static. The author reproduced the issue with Rails commands, added the smart_assets gem, and then encountered a different deployment failure indicating that the Vite binary was unavailable.

### Source excerpt

In tonight's category of "Crazy Rails Errors that Even I haven't hit", I was deploying a new app via HatchBox and I hit this one: No such middleware to insert before: ActionDispatch::Static /home/deploy/Cartazzi/shared/bundle/ruby/3.1.0/gems/actionpack-7.0.2.2/lib/action_dispatch/middleware/stack.rb:174:in `assert_index' When I dug into the underlying failure there was this bit of code: def assert_index(index, where) i = index.is_a?(Integer) ? index : index_of(index) raise "No such middleware to insert #{where}: #{index.inspect}" unless i i end I did the obligatory googling only to find nothing in the past year and absolutely nothing related to Rails 7. I was able to replicate this by logging in with either: bundle exec rake middleware or RAILS_ENV=production bundle exec rake assets:precompile After stumbling around a bit - this was post midnight late night code fu - I thoguht to myself: What if the issue is that it is looking for middleware and it can't find any? One of the previous googles from 2015 or so said that if you have this issue then remove the font_assets gem (I didn't have it but omitted that part of the research above). What I did was look for asset pipeline middleware and I found the smart_assets gem which I dropped into Gemfile: gem 'smart_assets' A quick bundle install and I ended up with a failing deploy ... but a different failure: Building with Vite rake aborted! ViteRuby::MissingExecutableError: The vite binary is not available. Have you installed the npm packages? Visit the Troubleshooting guide for more information: https://vite-ruby.netlify.app/guide/troubleshooting.html#troubleshooting And that, in modern computing, alas, is progress.

## Specifying Ruby Version for HatchBox Deployment

DevFeed: [Specifying Ruby Version for HatchBox Deployment](<https://devfeed.tech/articles/specifying-ruby-version-for-hatchbox-deployment-28116.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/2022/05/31/specifying-ruby-version-for-hatchbox-deployment.html>)

Author: Fuzzygroup

Published: 2022-05-31T11:13:00Z

Content type: tutorial

Language: en

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

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [Deployment](<https://devfeed.tech/topics/deployment.md>)

Tags: [deployment](<https://devfeed.tech/tags/deployment.md>), [errors](<https://devfeed.tech/tags/errors.md>), [hatchbox](<https://devfeed.tech/tags/hatchbox.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [rvm](<https://devfeed.tech/tags/rvm.md>)

### AI overview

This article explains how to resolve a Ruby version conflict during Hatchbox deployment by keeping the Ruby version in the Gemfile synchronized with the version in .ruby-version. The author reports that synchronizing both files to Ruby 2.6.2 fixed the issue.

### Source excerpt

I recently had the situation where an application that I deployed to Hatchbox failed with a Ruby version conflict: -----> Installing gems... /home/deploy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/rubygems_integration.rb:200: warning: constant Gem::ConfigMap is deprecated Your Gemfile lists the gem capybara (>= 0) more than once. You should probably keep only one of them. Remove any duplicate entries and specify the gem only once (per group). While it's not a problem now, it could cause errors if you change the version of one of them later. Your Ruby version is 2.5.1, but your Gemfile specified 2.6.2 I dug into the (excellent) online help for Hatchbox and found that you can specify your Ruby version with either the Gemfile or the .ruby-version file. These files, however, serve different functions: Gemfile - tells your application what to use .ruby-version - tells RVM to switch the ruby version on change into the directory In my case I had both and they were different. Synchronizing them both to 2.6.2 fixed the issue entirely.

## 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

## Having Hatchbox Redirect All http Sites it Manages to https

DevFeed: [Having Hatchbox Redirect All http Sites it Manages to https](<https://devfeed.tech/articles/having-hatchbox-redirect-all-http-sites-it-manages-to-https-28176.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/hatchbox/2020/03/28/having-hatchbox-redirect-all-http-sites-it-manages-to-https.html>)

Author: Fuzzygroup

Published: 2020-03-28T00:00:00Z

Content type: tutorial

Language: en

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

Topics: [nginx](<https://devfeed.tech/topics/nginx.md>), [SSL](<https://devfeed.tech/topics/ssl.md>), [HTTP](<https://devfeed.tech/topics/http.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [servers](<https://devfeed.tech/topics/servers.md>)

Tags: [can](<https://devfeed.tech/tags/can.md>), [code](<https://devfeed.tech/tags/code.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [deploy](<https://devfeed.tech/tags/deploy.md>), [hatchbox](<https://devfeed.tech/tags/hatchbox.md>), [http](<https://devfeed.tech/tags/http.md>), [https](<https://devfeed.tech/tags/https.md>), [nginx](<https://devfeed.tech/tags/nginx.md>), [request](<https://devfeed.tech/tags/request.md>), [server](<https://devfeed.tech/tags/server.md>), [ssl](<https://devfeed.tech/tags/ssl.md>)

### AI overview

A guide for configuring Hatchbox and nginx in cluster mode so HTTP requests are redirected to HTTPS at the load balancer. It provides the nginx directive and the Hatchbox interface steps needed before deploying the change.

### Source excerpt

When you are using hatchbox and SSL in cluster mode you end up with: a load balanced cluster that uses nginx as the load balancer and nginx on each web node This makes it hard to understand where the http to https redirect goes. The answer is that you need to but this on the load balancer and here's a code snippet: server_name _; return 301 https://$host$request_uri; This gets set as follows: Go into Hatchbox.io Go into your app. Go to Advanced. Select Nginx Configuration from the drop down menu Select the Load Balancer tab. Add these changes below the listen [::]:80; directive and then do a deploy. For reference, you can see linuxize.

## Deploying a Rails App Using HatchBox onto Google Cloud Platform

DevFeed: [Deploying a Rails App Using HatchBox onto Google Cloud Platform](<https://devfeed.tech/articles/deploying-a-rails-app-using-hatchbox-onto-google-cloud-platform-28268.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/rails/2020/03/22/deploying-a-rails-app-using-hatchbox-onto-google-cloud-platform.html>)

Author: Fuzzygroup

Published: 2020-03-22T00:00:00Z

Content type: tutorial

Language: en

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

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>), [Deployment](<https://devfeed.tech/topics/deployment.md>), [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Redis](<https://devfeed.tech/topics/redis.md>)

Tags: [config](<https://devfeed.tech/tags/config.md>), [deployment](<https://devfeed.tech/tags/deployment.md>), [git](<https://devfeed.tech/tags/git.md>), [google-cloud](<https://devfeed.tech/tags/google-cloud.md>), [google-cloud-platform](<https://devfeed.tech/tags/google-cloud-platform.md>), [hatchbox](<https://devfeed.tech/tags/hatchbox.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [rails](<https://devfeed.tech/tags/rails.md>), [redis](<https://devfeed.tech/tags/redis.md>), [ssh](<https://devfeed.tech/tags/ssh.md>)

### AI overview

A practical guide to deploying a Rails application with HatchBox onto Google Cloud Platform. It covers creating a single-server cluster, configuring external Cloud SQL PostgreSQL and Redis services, connecting a Git repository, performing an initial HTTP deployment, and enabling SSL after assigning a domain.

### Source excerpt

This blog post is a quickie where I document how I deployed CovidNearMe onto Google Cloud Platform or GCP using HatchBox.io. I need to start by giving a huge shout out to Tony Carnevale from Google who went above and beyond in providing outstanding support. Here are the stages. Stage 1: Create a Cluster Note: Even a single machine is considered a cluster. Go to HatchBox.io Login with your account. Click on Clusters and define a New Cluster. Name the cluster GCP Covid Near Me (or that's what I did). Select Somewhere Else as the hosting provider. Select the Everything on a Single Server option. If you are using the GCP Cloud SQL (postgresql) and GCP Redis then remove these options from the Roles list. Enter the IP address under public ip. Set the private IP to 127.0.0. There appears to be a bug where you can't provision the server unless a local redis installation is selected so add it back. Click provision the server and you will be given an SSH command to run as root on the box. You SSH in, do a sudo su, execute the command and exit out You click Test / Provision (I forget which) and your server will be flawlessly setup. Stage 2: Create an App on the Cluster Click on Apps. Click on Create a New App. Choose the cluster from the drop down list. Click on your git repo host. Set the name of your application (I like to include the name of the cluster with the app name since this app is already deployed to digital ocean). Enter the name of the repo (easily find this from .git/config in your Rails root directory). Set external host for the database if you are using Google's Cloud SQL. This means that you need to define a postgres configuration url. The format for this url is this: postgresql://user:password@databasehost.com/database. You simply need to replace user with your username, password with your password, databasehost.com with your database server and database with the name of the database. Define your Rails Master Key right away so you don't screw this up and have