Hacker News new | ask | show | jobs
by lacampbell 3386 days ago
Shameless request for advice - what's the simplest way of deploying stuff to a VPS?

I want to somehow set up an identical environment on my dev machine, and on a VPS in another continent (too much latency to edit files on directly). Ideally I'd then be able to deploy from a dev environment identical to my production environment. I tried docker but debugging the containers did my head in. I was thinking of trying VM images with vagrant, but I'd love to know if there is a simpler solution to this.

I'm just one person doing it in their spare time.

5 comments

One solution is to set up a droplet which serves a website from /home/deploy/web/site/ on the server. Then to deploy:

rsync -Pa ./site/ deploy@your-domain.com:/home/deploy/web/site/

Note: The trailing slashes are important.

I use nodemon to watch /home/deploy/web/site/ for changes, which restarts the server. There are tools like nodemon for whatever stack you're using (rails, etc).

Maybe I am biased, but I agree with the other user on here that Ansible is a good solution for keeping the environments the same.

However, if you're feeling brave, you should definitely check out OpenShift (community version at http://openshift.org). OpenShift is basically Kubernetes with a bunch of cool stuff added, one especially useful feature is source-to-image.

It pulls your code from a scm repo and finds a builder image (or you can choose one) and it will build the docker image for you. You can have it pull whenever there is new code and rebuild the image and deploy if you want.

On top of that you get lots of cool docker orchestration features.

simple solution is just using shell scripts.

if you are looking for a product who's primary goal is to create identical machine images check out Packer https://www.packer.io/intro

I really like Ansible. It provides a declarative framework for defining "roles" a server might have, and requires a minimal toolkit to get started- no images to deploy; just define the state the server should be in at the end of the playbook.
If docker didn't work for you, because it didn't feel enough like having a virtual machine you can tinker with, then vagrant might be a good choice.