Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcelo-ochoa/ee735a36ec6d8b609dbb75a1e8dfe5cb to your computer and use it in GitHub Desktop.
Save marcelo-ochoa/ee735a36ec6d8b609dbb75a1e8dfe5cb to your computer and use it in GitHub Desktop.
docker-compose.yml sample
# quantumobject/docker-zoneminder:1.31.1 build from https://github.com/marcelo-ochoa/docker-zoneminder
# dockercloud/haproxy:1.6.7.1 build from https://github.com/marcelo-ochoa/dockercloud-haproxy
version: '3.2'
services:
db:
image: mysql/mysql-server:5.7
networks:
- net
volumes:
- /home/data/zm/mysql:/var/lib/mysql
- $PWD/conf/mysql:/etc/mysql:ro
environment:
- TZ=America/Argentina/Buenos_Aires
- MYSQL_USER=zmuser
- MYSQL_PASSWORD=zmpass
- MYSQL_DATABASE=zm
- MYSQL_ROOT_PASSWORD=mysqlpsswd
- MYSQL_ROOT_HOST=%
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
web:
image: quantumobject/docker-zoneminder:1.31.1
networks:
- net
volumes:
- /var/empty
- /home/data/zm/backups:/var/backups
- /home/data/zm/zoneminder:/var/cache/zoneminder
- type: tmpfs
target: /dev/shm
environment:
- TZ=America/Argentina/Buenos_Aires
- VIRTUAL_HOST=zm.localhost, stream0.localhost
- SERVICE_PORTS="80"
- ZM_SERVER_HOST=node.0
- ZM_DB_HOST=db
deploy:
mode: replicated
replicas: 0
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
depends_on:
- db
stream:
image: quantumobject/docker-zoneminder:1.31.1
networks:
- net
volumes:
- /var/empty
- /home/data/zm/backups:/var/backups
- /home/data/zm/zoneminder:/var/cache/zoneminder
- type: tmpfs
target: /dev/shm
environment:
- TZ=America/Argentina/Buenos_Aires
- VIRTUAL_HOST=stream{{.Task.Slot}}.localhost
- SERVICE_PORTS="80"
- ZM_SERVER_HOST=node.{{.Task.Slot}}
- ZM_DB_HOST=db
deploy:
mode: replicated
replicas: 0
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
depends_on:
- web
lb:
image: dockercloud/haproxy:1.6.7.1
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- target: 80
published: 80
protocol: tcp
networks:
- net
environment:
- TZ=America/Argentina/Buenos_Aires
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
depends_on:
- web
networks:
net:
driver: overlay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment