3 ms·
I deploy to a virtual machine. I use Ansible to set up the machine and install a container runtime, then i set up traefik + containers using Ansible and docker
by sureglymop 4y ago
I deploy to a virtual machine. I use Ansible to set up the machine and install a container runtime, then i set up traefik + containers using Ansible and docker compose files.
If I ever do need to scale it's easy to switch to docker swarm which is quite capable. It's also easy to deploy the full stack somewhere else quickly.
I wish it was easier to do firewall configuration when using docker, since it basically occupies iptables even though I'd rather use nftables. I also keep secrets out of source code and add them during deployment using envsubst and ansible vault.
One thing also, i think the Ansible documentation is quite terrible. The only saving grace is `ansible-docs -s` which can print snippets.
I don't particularly like ansible but i guess it's currently the best there is and has a big ecosystem.
- dchuk 4y agoWould you happen to have that ansible setup on github for others to learn from? Now that docker is actually fast enough to be usable on mac, I'm leaning in the direction of a fast VPS plus docker compose for simple app deploys like you (with the option to move to swarm if growth occurs). Would be great to learn how others are automating the VPS setup itself.
- sureglymop 4y agoSadly I do not have it publicly available as I built this for work and the code is on an internal platform. But there are tons of similar examples on github. If you want to do the same, I mainly used the geerlingguy/docker role, the docker module for ansible and an internal module for provisioning vms.
- ancieque 4y agoHave you thought about using a single node Docker Swarm? That gives you benefits such as healthchecks for containers so unhealthy containers are replaced, support for rolling upgrades and some other goodies like secrets and configs managed by swarm.
- sureglymop 4y agoYup, I do that as well, my ansible scripts can provision either a single node swarm or regular docker on a host, both using traefik. Mostly even swarm is overkill for us though.