Trellis: Is there a way to run on Docker?

Created on 16 Oct 2015  路  7Comments  路  Source: roots/trellis

Instead of using Vagrant

Thanks

Most helpful comment

@mAAdhaTTah I'll be honest - based on how Docker is supposed to be used, I think it's Ansible's attempt at staying relevant in the age of containerization. You don't need Ansible to provision nodes - you can even script the provisioning directly with Docker Machine. Your nodes should be stateless, and if they aren't then you need to look into rearchitecting your stack and properly following 12 Factor principles.

Even on the "environment" side, Ansible isn't the proper tool for orchestration.

Ultimately, you'd be using Ansible for no other reason than to use Ansible. It would not afford you any particular capability or value beyond the satisfaction of using it.

All 7 comments

Haven't used Docker so I have no idea. If you end up trying it then please let us know.

@DinisCruz Yes, but you'll have to do it the "Docker" way. Docker, to some extent, obviates the need for provisioning - so ansible is not really required. Instead, you build your stack with specific images - E.g. hhvm, mariadb, nginx, etc. The easiest way is to then deploy your code to your Docker nodes using Capistrano.

If you're trying to replicate the entire environment in a single image, it will work, but that's not the "Docker way," you won't receive the benefits of Docker and you'll likely run into a number of challenges.

FWIW, Ansible suggests Docker pairs well with it: http://www.ansible.com/docker I'm actually interested in looking into this more, so if anyone here makes this a project, please email me :).

@mAAdhaTTah I'll be honest - based on how Docker is supposed to be used, I think it's Ansible's attempt at staying relevant in the age of containerization. You don't need Ansible to provision nodes - you can even script the provisioning directly with Docker Machine. Your nodes should be stateless, and if they aren't then you need to look into rearchitecting your stack and properly following 12 Factor principles.

Even on the "environment" side, Ansible isn't the proper tool for orchestration.

Ultimately, you'd be using Ansible for no other reason than to use Ansible. It would not afford you any particular capability or value beyond the satisfaction of using it.

you can even script the provisioning directly with Docker Machine.

But some provisioning needs to occur, correct? Whether if it occurs w/ Docker Machine or Ansible, nginx needs to configured (for example). So even if it's "better" to use Docker Machine (which I don't know anything about), we should be able to use these Ansible provisioning scripts to provision a set of Docker containers and reap the benefits of the work on Trellis for a Docker-based implementation.

@mAAdhaTTah The provisioning I was referring to is merely bringing up a Docker node, nothing more. If you're actually configuring the node itself, it's not stateless and you're not architecting it properly. If you're actually using Docker as it is intended, you shouldn't be able to find an area within your workflow where Ansible adds value. All docker-machine does is use your api key to bring up a vps and install docker on it, period. It's a stateless node.

As well, you should be configuring nginx with environment variables (there are plenty of nginx images that'll even live configure based on live service discovery) or have a pre-built configuration that you've built into an image. Adding Ansible to the mix unnecessarily complicates the configuration.

I think the impasse is that we're trying to force the old pre-containerization workflow into containerization and essentially treating a container as another VPS instance. If you approach it from this perspective, you're not actually utilizing containerization and Docker (E.g. single concern, statelessness, etc) as it was intended and might as well just stick with the old workflow. If not, you're just creating a hybrid of two approaches and not reaping the true benefits of either.

@etcook Thank you. This was enlightening. I'll probably pass on dealing with Docker + Trellis then, since it sounds like you'd have to do this from scratch, essentially.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hintings picture hintings  路  9Comments

dreamon11 picture dreamon11  路  7Comments

MasonFI picture MasonFI  路  5Comments

joejordanbrown picture joejordanbrown  路  8Comments

vercotux picture vercotux  路  8Comments