SwitchTower Gotchas

Matt Jankowski

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!

About thoughtbot

We've been helping engineering teams deliver exceptional products for over 20 years. Our designers, developers, and product managers work closely with teams to solve your toughest software challenges through collaborative design and development. Learn more about us.