Bye bye Heroku π welcome Hatch π£ Deploying my first app, few trivial question :)
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 :)
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?
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?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.
Any suggestions for managing logs? I want a simple way to be able to go through the logs, if I have to
Now if I want to
rails console
do I need tossh
into the server or does Hatch provide a shortcut for that?
Thanks :)
Hey Karim! Excited you're moving to Hatch!
Jack's answers are all spot on.
- 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.
- 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.
- 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.
- 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.
- 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. π