
Ask HN: How to handle staging environments? - fabianlindfors
I&#x27;m a full-time Wordpress developer and I&#x27;m constantly working with staging environments in order to present progress to clients and conduct testing. Creating a new staging environment is of course simple whilst working with PHP: create a new subfolder on web host, connect to host-provided database and you&#x27;re done. (yes, the simple process does come with some drawbacks, no git etc.)<p>In my off-time I&#x27;ve been trying other kinds of web development, Ruby on Rails and the like. Development environments are easy to set up but staging has proven more difficult. Using my own VPS is affordable but takes quite a bit of work even for something simple, and using a PaaS such as Heroku quickly becomes way to expensive for a side project.<p>Any suggestions on how to handle staging? What does your staging workflow look like?
======
penguinlinux
you can use an instance that has docker on it, then setup docker compose files
with wordpress, git , apache and setup a port. then on the machine setup
virtualhost to point to the entry tcp port of the docker instance. then all
you have to do is build the docker instances . You can mantaint all that with
git and handle all of your deployments that way.

~~~
fabianlindfors
I've looked into Docker and I definitely like the isolation and simplicity it
provides. The one thing keeping me away has been networking and file
persistence, but I haven't really put in the effort necessary to wrap my head
around it.

Is there a simpler, more automated way to handle the networking when
publishing a new containerized app?

------
mgberlin
I would highly recommend using Elastic Beanstalk on AWS. I use the python
platform most of the time, but PHP is available as well. If you're a new user,
you can get a year on a t2.micro for free, and even if you have to pay that
usually works out to about thirty-ish dollars a month which is probably
tenable.

~~~
fabianlindfors
Elastic Beanstalk seems to be a really convenient service. I tried it with the
free tiers for a random side project a while back. Unfortunately I
accidentally ran two applications which placed me outside of the free tier.
Didn't notice until about a month later when the cost had added up. Quite
disappointed by the confusing interface and complex billing, which I hope
they'll improve.

------
seanwilson
Why not use Heroku for this? If it's a staging environment only for demos I
can't see how you'd burn through much of your monthly free hours. Heroku makes
setting up staging environment very easy.

------
saluki
forge.laravel.com

Even if you're not using Laravel(PHP) it works for quickly spinning up a vps
on digital ocean or AWS.

You can setup multiple dev/test sites on one droplet.

Deploy repo via github bitbucket.

It's super fast and easy.

We setup live site on it's own droplet then have another staging droplet.
Develop locally with valet/homestead (laravel.com), deploy to staging using
forge, deploy to production using forge.

Forge has quick deploy which deploys when you push to your repo.

There is also [https://envoyer.io/](https://envoyer.io/) for zero downtime
deployment.

------
emilburzo
When resources are tight, I'm a big fan of having a bare metal server + lxc +
ansible.

I've also recently began looking into docker, but the update image dance seems
like more work to me than the above.

