Skip to content

Instantly share code, notes, and snippets.

@prokopsimek
Last active December 20, 2022 16:18
Show Gist options
  • Save prokopsimek/1c82557cd59cf3f4f161f7bdb422720c to your computer and use it in GitHub Desktop.
Save prokopsimek/1c82557cd59cf3f4f161f7bdb422720c to your computer and use it in GitHub Desktop.
docker stack setup swarmpit & portainer
version: '3'
services:
agent:
image: portainer/agent
environment:
# REQUIRED: Should be equal to the service name prefixed by "tasks." when
# deployed inside an overlay network
AGENT_CLUSTER_ADDR: tasks.agent
# AGENT_PORT: 9001
# LOG_LEVEL: debug
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- agent_network
deploy:
mode: global
portainer:
image: portainer/portainer
command: -H tcp://tasks.agent:9001 --tlsskipverify
ports:
- "9000:9000"
volumes:
- portainer_data:/data
networks:
- agent_network
- proxy_net
deploy:
mode: replicated
replicas: 1
# placement:
# constraints: [node.role == manager]
labels:
com.df.distribute: 'true'
com.df.notify: 'true'
com.df.port: '9000'
com.df.serviceDomain: portainer.dev.ersteapi.net
networks:
agent_network:
driver: overlay
proxy_net:
external: true
volumes:
portainer_data:
version: '3.3'
services:
proxy:
image: dockerflow/docker-flow-proxy:latest
environment:
LISTENER_ADDRESS: swarm-listener
MODE: swarm
TIMEOUT_SERVER: '90'
ports:
- 80:80
- 443:443
networks:
- proxy
- proxy_net
logging:
driver: json-file
deploy:
replicas: 2
swarm-listener:
image: dockerflow/docker-flow-swarm-listener:latest
environment:
DF_NOTIFY_CREATE_SERVICE_URL: http://proxy:8080/v1/docker-flow-proxy/reconfigure
DF_NOTIFY_REMOVE_SERVICE_URL: http://proxy:8080/v1/docker-flow-proxy/remove
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- proxy
- proxy_net
logging:
driver: json-file
deploy:
placement:
constraints:
- node.role == manager
networks:
proxy:
external: true
proxy_net:
external: true
version: '3'
services:
app:
image: swarmpit/swarmpit:latest
environment:
- SWARMPIT_DB=http://db:5984
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- 888:8080
networks:
- net
- proxy_net
deploy:
resources:
limits:
cpus: '0.50'
memory: 1024M
reservations:
cpus: '0.25'
memory: 512M
# placement:
# constraints:
# - node.role == manager
labels:
com.df.distribute: 'true'
com.df.notify: 'true'
com.df.port: '8080'
com.df.serviceDomain: swarmpit.dev.ersteapi.net
db:
image: klaemo/couchdb:2.0.0
volumes:
- db-data:/opt/couchdb/data
networks:
- net
deploy:
resources:
limits:
cpus: '0.30'
memory: 512M
reservations:
cpus: '0.15'
memory: 256M
agent:
image: swarmpit/agent:latest
environment:
- DOCKER_API_VERSION=1.35
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- net
deploy:
mode: global
resources:
limits:
cpus: '0.10'
memory: 64M
reservations:
cpus: '0.05'
memory: 32M
networks:
net:
driver: overlay
proxy_net:
external: true
volumes:
db-data:
driver: local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment