Build a Swarm cluster
opsnotice.xyz
opsnotice.xyz
I don't want a swarm or high availability, I just have some rails containers in dev that I want to run on a medium sized droplet. But there's nothing really out there on how to do this in a straightforward way.
I'm at the point where it seems like I can use ssh kit and docker compose to sort of do this, but it won't be zero downtime deploy and I have to script it up. It looks like there's a docker machine option, but I'm currently using docker for Mac so I'm not even sure where to begin for that path.
Docker is super powerful, but we don't all have 500 host deployments. I just need something quick that I can toss on a $20 vps easily.
I just wish there were more resources for small-medium docker deployments online. It seems like Rancher could help in this situation, but even that is pretty heavy for small deployments.
I do agree that the "medium size" (useful to the vast majority of people) documentation resources that are available are quite inadequate today.
In short, all you have to do is POST a url to a github repo and the system will pull your code, build a docker image from your Dockerfile, spin up a container, and then reverse proxy to the container's IP.
All you have to do is provide a repo with a Dockerfile and the deployment system does the rest.
Here's the code for it; https://gitlab.rlyshw.com/rlyshw/tiny-deploy
and here is an outdated blog post that outlines how it works; https://blog.rlyshw.com/2016/07/13/home-brew-deployment-syst...
https://github.com/kubernetes/minikube
Super easy way to get Kubernetes running on a single host.
I've got ~5 low-traffic websites running on a 1GB Droplet.
Here's a super-simple Docker host stack I put together that you can install on a cloud machine fairly easily. It runs Docker containers, does automatic backups, and has monitoring and alerting built-in. I've run around 5 webapps, split between 10 containers, on this infrastructure for about 6 months with significantly fewer headaches. Monitoring alerts go straight into a personal Slack channel.
The implementation is deliberately low-level -- you'll be running bare docker commands -- because the goal is to have a trivial infrastructure and to learn Docker in the process. There's no reliance on the "magic" in big wrappers like Kubernetes. Because there's nothing fancy in here, it's simple to understand and use.
My write-up is rough around the edges right now, but eventually this will turn into a simple blog post with an Ansible playbook attached. Here's a rough draft of how to set it up manually: https://github.com/maximz/docker-host/blob/master/public_doc...
There's an nginx reverse proxy fronting the Docker containers. You can do a zero-downtime deploy pretty easily. Happy to answer any questions if they arise.
brew install docker-machine
docker-machine create --name myserver ...digital-ocean-options
eval $(docker-machine env myserver)
docker ps
that is:* install docker-machine
* provision a droplet with docker on it (you can also use test.docker.com to use an RC instead of the latest release)
* set your local shell env to point docker to said machine
* use the docker client to interact with said machine
I also use docker-for-mac and a similar process to spin up swarm-mode clusters. You can also ssh into the machine if you need to by `docker-machine ssh myserver`
It's probably worth investing in learning docker-compose.
For example in RC5 they move towards join tokens and away from secret...