SwitchTower Gotchas

If you’re using SwitchTower to deploy your Rails apps (it’s fun!), you might run into these errors:

  • A Net::SSH authorization issue
  • Problems running the reaper, spinner or spawner scripts

The problems causing these errors are:

  • A host you are trying to deploy to is prompting you to confirm it’s ssh identify because you haven’t yet (and switchtower is choking on this)
  • The PATH of the user you are deploying as on a remote server doesn’t have ruby in it’s path

You can correct these problems by:

  • Connect via SSH once manually to each server you are deploying to—which will add the remote host to your local list of allowed hosts, removing the prompting that breaks ST.
  • Change the first line in each of the script/process scripts to be the direct path to ruby on the deployment servers. Alternately, you could add the path to ruby to the user’s environment PATH on the remote server—but I think putting it directly in the script/process files is better since cron jobs don’t have PATH info and you could conceivably run those (especially the spinner) from a cron task.

Enjoy your deploying!

Pair with one of our expert developers to level up your skills with Coaching by thoughtbot. Save time learning best practices and techniques for reducing technical debt in Ember, Ruby, Haskell, and Go in 1-on-1 sessions tailored to your goals.