This repo use Nginx + Let's encrypt + Digitalocean + Cloudflare to deploy multiple sites in a docker swarm manager.
It was inspired by the need to have small experiments without have a server for each of them.
- Creagte a cloudflare account
- Add as many sites as needed
- Get api token to get ssl certificates (https://dash.cloudflare.com/profile/api-tokens)
-
Create an account in Digital ocean
-
Create a docker droplet from digital ocean marketplace (https://marketplace.digitalocean.com/apps/docker)
Note: I recommend you to keep the main ssd disk in 25 SSD and add a block storage so you can resize the server to any size later.
- Swarm manager & private docker registry
- SSH to docker instance
- Run setup_manager
bash <(curl -s https://raw.githubusercontent.com/woohoou/simple-nginx-docker-swarm/main/setup_manager)
- Run setup with production and staging environment
./setup -p prd.my_domain.com -s stg.my_domain.com
- Login into the private registry
docker login my_domain.com:5000
- Deploy to server
cd nginx && docker_swarm_deploy
- Copy the reverse proxy sample
cp reverse_proxy.conf.sample my_domain.conf
- Rename server name and redirect (my_domain.com) in my_domain.conf