david
3 years ago
10 changed files with 65 additions and 0 deletions
@ -0,0 +1,9 @@
|
||||
# swarm stuff |
||||
|
||||
the env file is like |
||||
|
||||
``` |
||||
netmonTraefikGrp=thenameoftheswarmservice |
||||
netmonTraefikUrl=the.domain.name.yourapp.will.be.available.on |
||||
netmonNode=theswarmnodeyouwannadeployto |
||||
``` |
@ -0,0 +1,34 @@
|
||||
--- |
||||
version: '3.8' |
||||
|
||||
networks: |
||||
swarmnet-public: |
||||
external: true |
||||
|
||||
volumes: |
||||
netmon-data: |
||||
|
||||
services: |
||||
app: |
||||
image: daveplsno/netmon:latest |
||||
hostname: netmon |
||||
env_file: .env.netmon |
||||
volumes: |
||||
- netmon-data:/app |
||||
networks: |
||||
- swarmnet-public |
||||
deploy: |
||||
restart_policy: |
||||
condition: on-failure |
||||
placement: |
||||
constraints: |
||||
- node.labels.${netmonNode? Variable not set} == true |
||||
labels: |
||||
- traefik.enable=true |
||||
- traefik.docker.network=swarmnet-public |
||||
- traefik.constraint-label=swarmnet-public |
||||
- traefik.http.routers.${netmonTraefikGrp? Variable not set}.rule=Host(`${netmonTraefikUrl? Variable not set}`) |
||||
- traefik.http.routers.${netmonTraefikGrp? Variable not set}.entrypoints=websecure |
||||
- traefik.http.routers.${netmonTraefikGrp? Variable not set}.tls=true |
||||
- traefik.http.routers.${netmonTraefikGrp? Variable not set}.tls.certresolver=le |
||||
- traefik.http.services.${netmonTraefikGrp? Variable not set}.loadbalancer.server.port=3000 |
@ -0,0 +1,8 @@
|
||||
# export vars |
||||
export $(cat .env.deploy) |
||||
|
||||
# deploy to swarm |
||||
docker stack deploy -c docker-compose.netmon.yml netmon |
||||
|
||||
# unset the env vars |
||||
unset $(cat .env.deploy | cut -f 1 -d '=' $1) |
@ -0,0 +1,2 @@
|
||||
#!/bin/bash |
||||
docker service logs netmon_app -f |
@ -0,0 +1,2 @@
|
||||
#!/bin/bash |
||||
docker service rm netmon_app |
@ -0,0 +1,3 @@
|
||||
#!/bin/bash |
||||
docker service scale netmon_app=0 |
||||
docker service scale netmon_app=1 |
Loading…
Reference in new issue