Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pedrogabriel/docker-swarm-template
A ready to use docker swarm template
https://github.com/pedrogabriel/docker-swarm-template
docker docker-compose docker-machine docker-swarm nginx php traefik
Last synced: about 1 month ago
JSON representation
A ready to use docker swarm template
- Host: GitHub
- URL: https://github.com/pedrogabriel/docker-swarm-template
- Owner: PedroGabriel
- Created: 2021-05-24T05:42:28.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-27T17:54:11.000Z (over 2 years ago)
- Last Synced: 2024-12-01T05:36:56.567Z (about 1 month ago)
- Topics: docker, docker-compose, docker-machine, docker-swarm, nginx, php, traefik
- Language: Dockerfile
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker Swarm Test
**Traefik, Private Registry, Swarmpit, Let's Encrypt SSL**
**Multi site with auto discovery**### Building images
```
docker-compose -f docker-compose.yml -f docker-compose.override.yml build
docker-compose -f docker-compose.yml -f docker-compose.override.yml push
```### Merge cli vars with env to use inside .sh file
```
if [ -f .env ]
then
export $(cat .env | sed 's/.*//g' | xargs)
fi
```### Common commands in common order
```
export CLUSTER=cluster-nameexport LEADER=$CLUSTER-leader
docker-machine create --driver digitalocean --digitalocean-image ubuntu-18-04-x64 --digitalocean-access-token $DOTOKEN $LEADER
export LEADER_IP=$(docker-machine ip $LEADER)
eval $(docker-machine env $LEADER)
docker swarm init --advertise-addr=$LEADER_IP
export JOIN_TOKEN=$(docker swarm join-token --quiet worker)
for i in 1 2; do
WORKER=$CLUSTER-$i
docker-machine create --driver digitalocean --digitalocean-image ubuntu-18-04-x64 --digitalocean-access-token $DOTOKEN $WORKER
docker-machine ssh $WORKER "docker swarm join --token ${JOIN_TOKEN} ${LEADER_IP}:2377"
donedocker stack deploy -c docker/registry.yml --with-registry-auth registry
docker stack deploy -c docker/traefik.yml --with-registry-auth traefik
docker stack deploy -c docker/swarmpit.yml --with-registry-auth swarmpit
docker stack deploy -c docker-compose.yml --with-registry-auth ${PROJECT:-app}
```
Test in localhost with auto ip
`docker swarm init --advertise-addr=$(hostname -I | grep -o '^\S*')`