SLOBY
SLOBY

Reputation: 1107

Production hosting for small scale website with docker-swarm

We had an old PHP website that we have rewritten in elixir. The previous page was hosted in the "old fashioned" way, code deployed to an FTP, sql managed via phpmyadmin.

I'm using docker-compose locally to run the database.

My plan is to host the new project on DigitalOcean by using only containers. I recently tried out docker-machine and could use a DO VM just as it was a local machine. I also read about docker-swarm but it is for multiple VMs with multiple containers for the same service.

My initial thought was to create just 1 docker-swarm manager and connect to that via docker-machine and execute a docker-compose command.

The goal is to have a solution that can be automated and maybe have 1 or 2 backup containers. But I'd avoid having multiple VMs because the site has only a couple hundred visitors a day.

Is this a viable solution or is there a simpler approach?

Upvotes: 3

Views: 1673

Answers (2)

Tetiana
Tetiana

Reputation: 323

If you want to avoid manual configurations but still get the required high availability and cost efficiency, try to run Docker Swarm template pre-packaged by Jelastic:

  • it has built-in automatic clustering and scaling
  • the installation is performed automatically and you'll get full access to the cluster via intuitive UI
  • containers are running directly on bare metal, so no need to reserve full VMs for each service (and you can choose the datacenter you want to run your project on)
  • the payment is done based on actual consumption of RAM and CPU
  • containers are automatically distributed across different hardware servers that increases high availability

The details about the package and installation steps are in the article "Docker Swarm Auto-Clustering and Scaling with PaaS Power Armor."

Upvotes: 2

Bret Fisher
Bret Fisher

Reputation: 8596

Some quick guidelines:

  1. Even if just a single server, I recommend enabling Swarm as you get new features and it's designed by default to keep a container running, and makes the process of updating/replacing that container easier (possible for zero downtime).
  2. If you use Swarm on the DO server, you could use docker stack deploy commands and you'd keep using docker-compose locally, and they could share same/similar compose files. The docker-compose command is just for local test/dev, and doesn't understand Swarm, but the file format is the same between the two.
  3. There's no reason to not use two or even three servers. Three managers would make it HA. You could use $5 servers if you needed to keep costs down (assuming the site runs in 1GB memory).
  4. Remember having multiple servers isn't just about capacity, it's about availability and fault tolerance. The great thing about Swarm is that it's designed to run 3 servers as easy as one. The commands are the same as a single VM.
  5. I wouldn't use docker-machine, but rather just try installing via instructions from store.docker.com for your Linux distribution, as you're better able to control the Docker version that way. For production, you'd want to stick with Stable quarterly releases (latest is 17.12).

Upvotes: 3

Related Questions