# 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: [Ruby on Rails](<https://devfeed.tech/topics/ruby-on-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>), [Ruby on Rails](<https://devfeed.tech/topics/ruby-on-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' %

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

Language: en

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

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

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

### AI overview

A Hatchbox deployment failed because the Ruby version in the environment was 2.5.1 while the Gemfile specified 2.6.2. The excerpt says the Gemfile declares the version the application should use, while `.ruby-version` tells RVM which version to switch to when entering the directory. Since the project had both files set differently, synchronizing them to 2.6.2 resolved the conflict. The log also mentioned a duplicate Capybara entry and a deprecated constant warning, but the reported fix was aligning the Ruby versions.

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

## Git Error: failed to push some refs to

DevFeed: [Git Error: failed to push some refs to](<https://devfeed.tech/articles/git-error-failed-to-push-some-refs-to-28174.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/git/2022/05/31/git-error-failed-to-push-some-refs-to.html>)

Author: Fuzzygroup

Published: 2022-05-31T04:34:00Z

Content type: article

Language: en

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

Topics: [Git](<https://devfeed.tech/topics/git.md>), [Deployment-Driven Development](<https://devfeed.tech/topics/deployment-driven-development.md>), [software-development](<https://devfeed.tech/topics/software-development.md>)

Tags: [deploy](<https://devfeed.tech/tags/deploy.md>), [development](<https://devfeed.tech/tags/development.md>), [error](<https://devfeed.tech/tags/error.md>), [git](<https://devfeed.tech/tags/git.md>), [hatchbox](<https://devfeed.tech/tags/hatchbox.md>)

### AI overview

The author encountered `src refspec main does not match any` while pushing a new project to GitHub. They realized they had not yet added the project, and say that adding and committing files before pushing resolved the error. They also recommend getting deployment working early, while a project is simple, and note that HatchBox makes this easier.

### Source excerpt

So I was just stumbling through setting up a new project and getting it deployed when I hit this little gem: ❯ git push -u origin main error: src refspec main does not match any error: failed to push some refs to 'github.com:fuzzygroup/cartazzi.git' I did the obligatory "scratch my chin and play with my beard" that you do when you are confused (and it is late and you are tired). And then I realized - "Oh crap, it is NEW; I bet I never added yet." And lo and behold - a simple add / commit and push worked! Crappy ass error message though. Sigh. Note: Deployment first development is my new best practice - make things deploy initially when they are still simple. This is particularly easy when you use a deployment engine like HatchBox

## 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: [Ruby on Rails](<https://devfeed.tech/topics/ruby-on-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

## Rails Asset Pipeline Failures and Capistrano

DevFeed: [Rails Asset Pipeline Failures and Capistrano](<https://devfeed.tech/articles/rails-asset-pipeline-failures-and-capistrano-28270.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/rails/2020/04/14/rails-asset-pipeline-failures-and-capistrano.html>)

Author: Fuzzygroup

Published: 2020-04-14T00:00:00Z

Content type: article

Language: en

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

Topics: [Ruby on Rails](<https://devfeed.tech/topics/ruby-on-rails.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>), [implementation](<https://devfeed.tech/topics/implementation.md>)

Tags: [ansible](<https://devfeed.tech/tags/ansible.md>), [asset-pipeline](<https://devfeed.tech/tags/asset-pipeline.md>), [aws](<https://devfeed.tech/tags/aws.md>), [capistrano](<https://devfeed.tech/tags/capistrano.md>), [deploy](<https://devfeed.tech/tags/deploy.md>), [hatchbox](<https://devfeed.tech/tags/hatchbox.md>), [jenkins](<https://devfeed.tech/tags/jenkins.md>), [rails](<https://devfeed.tech/tags/rails.md>)

### AI overview

A Rails asset pipeline can build successfully while its CSS remains unusable if Passenger is not restarted after deployment. The author's Capistrano deploy appeared to succeed, but CSS requests returned 500 errors and neither Rails nor NGINX logs showed a cause. The author resolved this by adding a post-deploy Capistrano task that uploads Passenger's expected `tmp/restart.txt` file to the app's `current/tmp` directory. The article notes that Capistrano extensions run outside Rails, so `Rails.root` is unavailable there; the example therefore uses an explicit local file path. The author suspects Rails 6 or a configuration mistake, but does not establish which caused the restart hook to fail. HatchBox had been unsuitable for the project's complex multi-repository, multi-language CI/CD needs; the planned setup combined Jenkins, Ansible, and Capistrano.

### Source excerpt

One of the single worst parts of being a one man show on an engineering effort is that when you hit a serious snag, well, you're fscked. I'm at the death march phase of a project, that wonderful stage, where you're so far into it that you can see the end but it seemingly never arrives - like the speed of light, it feels like you can never quite get there. Pro Tip: At this stage being asked by your manager, on a continuous basis, "anything that you can show me" is not helpful. It is actually an antipattern which simply slows the project by making the engineer feel even worse (yes I'm late and I can argue for scope creep, etc but I'll own it and I'm still late). Anyway I recently went through this with respect to getting a complex Rails code base deployed onto AWS. I started with my usual deploy tool of HatchBox but nothing worked and it was in the wee hours, and over a weekend, when I had no right to expect timely technical support so I figured "Ok I'll do a raw deploy with Capistrano" - and then the cluster fsck began in earnest. One of the general rules of technology is that everything is a two edged sword and where you get something, you give something. For example C gives outstanding performance and flexibility but it also can be a source of security issues, pointer bugs, buffer overflows, etc. Similarly Rails, even today, gives you: an unprecedentedly easy way to build web apps (provided you do it the Rails way) but deployment of modern Rails apps can be one of the most cursing laden experiences I've ever had The only easy way I've ever found to deploy Rails apps is HatchBox and HatchBox wasn't actually a good fit for this application due to particularly complex, multi language CI / CD requirements (4 different git repos spanning, today, two languages). The real deployment approach is going to be a combination of Jenkins + Ansible that drive Capistrano plus some other deployment tools. But I digress and have now devolved into a large number of words, more words

## 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>), [HTTP](<https://devfeed.tech/topics/http.md>), [Server](<https://devfeed.tech/topics/server.md>)

Tags: [cluster](<https://devfeed.tech/tags/cluster.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>), [load-balancer](<https://devfeed.tech/tags/load-balancer.md>), [nginx](<https://devfeed.tech/tags/nginx.md>), [redirect](<https://devfeed.tech/tags/redirect.md>)

### AI overview

In Hatchbox SSL cluster mode, place the HTTP-to-HTTPS redirect on the nginx load balancer, rather than on each web node. In the app's Advanced settings, open Nginx Configuration, select the Load Balancer tab, add `server_name _; return 301 https://$host$request_uri;` below the `listen [::]:80;` directive, and deploy.

### 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: [Ruby on Rails](<https://devfeed.tech/topics/ruby-on-rails.md>), [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>), [cloud-sql](<https://devfeed.tech/topics/cloud-sql.md>)

Tags: [cloud-sql](<https://devfeed.tech/tags/cloud-sql.md>), [digital-ocean](<https://devfeed.tech/tags/digital-ocean.md>), [gcp](<https://devfeed.tech/tags/gcp.md>), [git](<https://devfeed.tech/tags/git.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>)

### AI overview

The post describes deploying the Rails app CovidNearMe to GCP with HatchBox: create a cluster using "Somewhere Else" and "Everything on a Single Server," enter the server IPs, and provision it by running HatchBox's SSH command as root. The author reports a provisioning issue that required adding local Redis back to the Roles list, even when using GCP Redis. Then create an app linked to the cluster and Git repository; for Cloud SQL, configure an external PostgreSQL URL. The initial deployment is HTTP only; HTTPS requires assigning a domain, while the SSL setup is deferred to a future post. The author also says GCP SSH access must allow the HatchBox deployment engine's IP, which the post gives as 94.53.199.250 as of March 24, 2020.

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