Easiest way to deploy to VM?

I have a rails site that I have developed on my MAC. I have a Xen server that I want to spin up a VM and run the site on. What’s the easiest way to get the site from my MAC to the Xen server and run it with a real web server - not webrick.



Wow, how old is this app? I think puma has been the default Rails server since maybe 4.2? Or at least 5.0...

Regardless, most people deploy via Capistrano. It can be a little bit fiddly to set up but once configured it's as simple as `cap deploy`.


Hah! I’ve been noodling with this for a couple years. It’s Rails 4.2.1… Thanks for the advice.


You can certainly use Puma with that version (in development as well), but in the meantime I'd recommend upgrading to the last 4.2.x version for the security fixes if nothing else.

(Rubyonrails Ruby On Rails : List of security vulnerabilities)


Ok, so what’s the easiest way to upgrade my rails 4.2.1 project to 4.2.10?


Edit your Gemfile entry for Rails and run `bundle install`. If all your tests still pass you may want to fix any deprecation warnings just in case you decide to upgrade beyond that (recommended).

You can also run `bundle outdated` to see what gems you might be able to bring current.

Can I run puma in production or do I ned to setup nginx?



Having a separate proxy like nginx or Apache httpd in front of your app server (puma, unicorn, etc.) is definitely recommended.

A proxy can more efficiently serve static assets, handle your SSL termination, redirect http -> https, return a static "sorry" page for maintenance, drop obviously bogus requests (e.g. "admin.php"), split requests to different applications based on the URL, etc., etc.

I've never run an app in production without one so ¯\_(ツ)_/¯


If I do that, will it blindly overwrite files that I’ve modified like the routes file?


1. No 2. It wouldn't matter because _of course_ you're using Git*, right?     * or comparable source code control system

    And if you're not -- start now before you do *anything* else :slight_smile:

I’m a recent huge convert to HatchBox. I used to manage my own server with a Chef script to set up and rebuild in case of problems, and use capistrano for deployment.

Now I just let Hatchbox handle it.

They’ll set up nginx, ssl, set up your database, action cable, redis, etc, etc

Then they take your code from git, do the whole install and everything just works. It’s a lot like heroku - but with your own servers.

You can point them to your own VM (they need ssh access) - or frankly I’d just spin up a digital ocean server to handle the job.

Hatchbox is $15/month, and you can get a pretty good server from Digital Ocean for the same.

$30/month saves a lot of hassle

when you release an update - you just push it to your master branch in git (or whatever branch you choose) and it updates automatically.

read more here


(remove the via=rob if you don’t want me to get a commission on signups!)