Skip to content

Commit

Permalink
make logging config a template
Browse files Browse the repository at this point in the history
  • Loading branch information
BretFisher committed Feb 4, 2019
1 parent e0178bb commit 7d1e3c3
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 85 deletions.
14 changes: 13 additions & 1 deletion stack-ee-ghost.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
version: '3.2'
version: '3.7'

x-default-opts:
&default-opts
logging:
options:
max-size: "1m"
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

services:

ghost:
<<: *default-opts
image: ghost:1-alpine
environment:
# see https://docs.ghost.org/docs/config#section-running-ghost-with-config-env-variables
Expand All @@ -20,6 +30,7 @@ services:


db:
<<: *default-opts
image: mysql:5.7
volumes:
- db:/var/lib/mysql
Expand All @@ -31,6 +42,7 @@ services:
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/ghost-db-password

db-backup:
<<: *default-opts
image: mysql:5.7
command: sh -c "while true; do /usr/bin/mysqldump -u root --password=$$(< $$MYSQL_ROOT_PASSWORD_FILE) --all-databases --host=db > /backup/backup$$(date +'%H').sql ; sleep 3600; done"
volumes:
Expand Down
26 changes: 13 additions & 13 deletions stack-elk.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
version: '3.5'
version: '3.7'

x-default-opts:
&default-opts
logging:
options:
max-size: "1m"
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

services:

elasticsearch:
<<: *default-opts
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.0
configs:
- source: elastic_config
Expand All @@ -16,11 +26,9 @@ services:
deploy:
mode: replicated
replicas: 1
logging:
options:
max-size: "500k"

logstash:
<<: *default-opts
image: docker.elastic.co/logstash/logstash-oss:6.4.0
ports:
- "5000:5000"
Expand All @@ -38,12 +46,9 @@ services:
deploy:
mode: replicated
replicas: 1
logging:
options:
max-size: "500k"


kibana:
<<: *default-opts
image: docker.elastic.co/kibana/kibana-oss:6.4.0
configs:
- source: kibana_config
Expand All @@ -59,11 +64,6 @@ services:
- traefik.frontend.rule=Host:kibana.dogvs.cat
- traefik.frontend.auth.basic=${KIBANA_USER:-admin}:${KIBANA_PASSWORD:-$2y$05$oZcj4FgdSFEYNCH0EH/3Vu7Hp72gkvEadHzMsDhGFkbvS/ZrKMKfK}
# TODO: make secrets secret
logging:
options:
max-size: "500k"



configs:

Expand Down
26 changes: 13 additions & 13 deletions stack-ghost.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
version: '3.5'
version: '3.7'

x-default-opts:
&default-opts
logging:
options:
max-size: "1m"
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

services:

ghost:
<<: *default-opts
image: ghost:alpine
networks:
- proxy
Expand All @@ -20,12 +30,9 @@ services:
labels:
- traefik.port=2368
- traefik.frontend.rule=Host:ghost.dogvs.cat
# logging:
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

db:
<<: *default-opts
image: mysql:5.7
volumes:
- db:/var/lib/mysql
Expand All @@ -37,13 +44,10 @@ services:
endpoint_mode: dnsrr
environment:
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db-password
# logging:
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

# NOTE: table locking is a concern. Maybe use --single-transaction=TRUE for innoDB
db-backup:
<<: *default-opts
image: mysql:5.7
command: sh -c "while true; do /usr/bin/mysqldump -u root --password=$$(< $$MYSQL_ROOT_PASSWORD_FILE) --all-databases --host=db > /backup/backup$$(date +'%H').sql ; sleep 3600; done"
volumes:
Expand All @@ -57,10 +61,6 @@ services:
deploy:
restart_policy:
delay: 600s
# logging:
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

#TODO: backup for static content

Expand Down
16 changes: 11 additions & 5 deletions stack-menu.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
version: '3.4'
version: '3.7'

x-default-opts:
&default-opts
logging:
options:
max-size: "1m"
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

services:

menu:
<<: *default-opts
image: dogvscat/menu
build:
context: menu
Expand All @@ -11,10 +21,6 @@ services:
labels:
- traefik.port=80
- traefik.frontend.rule=Host:www.dogvs.cat,dogvs.cat
# logging:
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"
networks:
- proxy

Expand Down
18 changes: 12 additions & 6 deletions stack-portainer.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
version: "3.4"
version: "3.7"

x-default-opts:
&default-opts
logging:
options:
max-size: "1m"
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

services:
web:
<<: *default-opts
image: portainer/portainer
# command: -H "tcp://tasks.agent:9001"
deploy:
Expand All @@ -18,6 +28,7 @@ services:
volumes:
- web:/data
agent:
<<: *default-opts
image: portainer/agent
networks:
- portainer
Expand All @@ -27,11 +38,6 @@ services:
mode: global
environment:
AGENT_CLUSTER_ADDR: tasks.agent
logging:
options:
max-size: "500k"



networks:
proxy:
Expand Down
13 changes: 10 additions & 3 deletions stack-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@

version: '3.7'

x-default-opts:
&default-opts
logging:
options:
max-size: "1m"
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

services:

traefik:
<<: *default-opts
image: traefik:1.7-alpine
networks:
- proxy
Expand Down Expand Up @@ -42,9 +52,6 @@ services:
deploy:
placement:
constraints: [node.role == manager]
logging:
options:
max-size: "500k"

volumes:
acme:
Expand Down
18 changes: 12 additions & 6 deletions stack-prune.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
version: '3.1'
version: '3.7'

x-default-opts:
&default-opts
logging:
options:
max-size: "1m"
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

services:
image-prune:
<<: *default-opts
image: docker
command: sh -c "while true; do docker image prune -af; sleep 86400; done"
networks:
Expand All @@ -10,12 +20,8 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
mode: global
# logging:
# driver: "gelf"
# options:
# gelf-address: "tcp://127.0.0.1:5000"

networks:
bridge:
external: true
name: bridge
name: bridge
15 changes: 11 additions & 4 deletions stack-rexray.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
version: "3.5"
version: "3.7"

# 1. WORKAROUND: would prefer this use null network driver, will use bride for now to avoid overlay
# 2. TODO: would prefer on-failure restart_policy, but need to run this in script to look
# for if plugin exists first before reinstalling
# 3. TODO: would prefer this picks a driver version, and support driver updates

x-default-opts:
&default-opts
logging:
options:
max-size: "1m"
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

services:
plugin-rexray:
<<: *default-opts
image: mavenugo/swarm-exec:17.03.0-ce
networks:
- bridge
Expand All @@ -18,9 +28,6 @@ services:
mode: global
restart_policy:
condition: none
logging:
options:
max-size: "500k"

networks:
bridge:
Expand Down
16 changes: 11 additions & 5 deletions stack-sqlite-ghost.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
version: '3.5'
version: '3.7'

x-default-opts:
&default-opts
logging:
options:
max-size: "1m"
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

services:

ghost:
<<: *default-opts
image: ghost:2-alpine
networks:
- proxy
Expand All @@ -23,10 +33,6 @@ services:
labels:
- traefik.port=2368
- traefik.frontend.rule=Host:ghost.dogvs.cat
# logging:
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"

# TODO: backup for static content

Expand Down
Loading

0 comments on commit 7d1e3c3

Please sign in to comment.