Skip to main content

Bye bye Heroku πŸ‘‹ welcome Hatch 🐣 Deploying my first app, few trivial question :)

Servers β€’ Asked by Karim Tarek


Hello,

Although I've been working with Rails for about 3 years now I was never resposible for deploying apps and dealing with servers – embarrassing, right? – apart from a side project I used Heroku for, so I'm sorry if my questions seems to be trivial :)

  1. I signed up with Hatch to deploy an app. I was wondering do Hatch provide a way to backup the database? Or is this something I need to takecare of? If so, any suggestions?

  2. I'm using delayed_job for background jobs, I'm not sure how to start the worker when I deploy the app, locally I just do rake jobs:work so do I need to add that somewhere in the Rails config files? or is is something done on the server-side? May be a Bash script?

  3. I'm planing to go with DigitalOcean for hosting, the app is pretty simple and for the forseable future I don't expect crazy amount of traffic, should I go with 1 core or 2 cores? What about memory? Put in mind I'm going to be using background jobs whenever possible.

  4. Any suggestions for managing logs? I want a simple way to be able to go through the logs, if I have to

  5. Now if I want to rails console do I need to ssh into the server or does Hatch provide a shortcut for that?

Thanks :)

Gravatar Jack commented on :

Also played with, and have some answers:

1 There's a beta feature who supports backups of your PG DB (see menu left-hand, Backups)

3 For memory; 1GB is the minimum. Otherwise loads of errors.

5 No shortcut I am aware off. Possible can create a bash/zsh shortcut in your project folder: ssh <name>@<ip> \\ cd <app-name>/current && bundle exec rails console?

Gravatar Chris Oliver commented on : Mod Staff

Hey Karim! Excited you're moving to Hatch!

Jack's answers are all spot on.

  1. There's a gem called Backup that Hatch helps you setup for each app. You'll need to login to your server to edit the config if you want the backups to upload to S3 or something, but it's really easy to use.
  2. I haven't used Delayed_job on Hatch yet myself, but I believe someone has already. The important thing will be to basically add these commands to the deploy script (and make sure you've got that daemon gem installed). https://github.com/collectiveidea/delayed_job#running-jobs If you run into any troubles with this, let me know and I'll help you get that situated. I generally recommend you always use Sidekiq these days over delayed_job, resque, etc so this feature is a little less tested.
  3. Like Jack mentioned, RAM is going to be the most important thing here. You'll generally want a 1GB or 2GB server. If you don't know, you can start with a 1GB server and DigitalOcean makes it super easy to migrate up to a larger size if you start getting memory errors.
  4. Hatch has two cool features around logs. First, you can actually view the logs in the web UI by clicking on the "Rails Logs" tab of your app. It will retrieve the logs for you and you can read the last like 300 lines or so. Second, because logs can get unweildy, your logs on the server are rotated daily so that you don't run out of disk space. Every day they get compressed and labeled with the date so if you ever need to go back into the logs for a couple days, you can SSH in and find those.
  5. A little bash script or alias will do the trick for you like Jack mentioned. This would be nice to add to Hatch's UI so you could copy and paste that into your Bash or ZSH config. πŸ‘

Login or create an account to join the conversation.