Permalink
Browse files

make logging config a template

  • Loading branch information...
BretFisher committed Feb 4, 2019
1 parent e0178bb commit 7d1e3c3860639c0dc826d20706a5f894b2dc7613
Showing with 129 additions and 85 deletions.
  1. +13 −1 stack-ee-ghost.yml
  2. +13 −13 stack-elk.yml
  3. +13 −13 stack-ghost.yml
  4. +11 −5 stack-menu.yml
  5. +12 −6 stack-portainer.yml
  6. +10 −3 stack-proxy.yml
  7. +12 −6 stack-prune.yml
  8. +11 −4 stack-rexray.yml
  9. +11 −5 stack-sqlite-ghost.yml
  10. +17 −22 stack-swarmprom.yml
  11. +6 −7 stack-visualizer.yml
@@ -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
@@ -20,6 +30,7 @@ services:


db:
<<: *default-opts
image: mysql:5.7
volumes:
- db:/var/lib/mysql
@@ -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:
@@ -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
@@ -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"
@@ -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
@@ -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:

@@ -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
@@ -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
@@ -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:
@@ -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

@@ -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
@@ -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

@@ -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:
@@ -18,6 +28,7 @@ services:
volumes:
- web:/data
agent:
<<: *default-opts
image: portainer/agent
networks:
- portainer
@@ -27,11 +38,6 @@ services:
mode: global
environment:
AGENT_CLUSTER_ADDR: tasks.agent
logging:
options:
max-size: "500k"



networks:
proxy:
@@ -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
@@ -42,9 +52,6 @@ services:
deploy:
placement:
constraints: [node.role == manager]
logging:
options:
max-size: "500k"

volumes:
acme:
@@ -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:
@@ -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
@@ -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
@@ -18,9 +28,6 @@ services:
mode: global
restart_policy:
condition: none
logging:
options:
max-size: "500k"

networks:
bridge:
@@ -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
@@ -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

Oops, something went wrong.

0 comments on commit 7d1e3c3

Please sign in to comment.