Skip to content

Instantly share code, notes, and snippets.

@lorello
Last active September 1, 2020 11:10
Show Gist options
  • Select an option

  • Save lorello/085593c62d4ccf1788c2269e9b578c09 to your computer and use it in GitHub Desktop.

Select an option

Save lorello/085593c62d4ccf1788c2269e9b578c09 to your computer and use it in GitHub Desktop.
Initialitaion inside yaml file with a long bash command .... example from min.io
createbuckets:
image: minio/mc
networks:
- backplane
depends_on:
- minio
entrypoint: >
/bin/sh -c "
while ! nc -z minio 9000; do echo 'Wait minio to startup...' && sleep 0.1; done;
sleep 5;
/usr/bin/mc config host add minio http://minio:9000 xxxxx
/usr/bin/mc mb minio/opencity-demo-bucket;
/usr/bin/mc policy set public minio/opencity-demo-bucket;
exit 0;
"
version: "3.7"
x-loki: &logging-loki
logging:
driver: loki
options:
loki-url: "http://172.31.1.125:3100/loki/api/v1/push"
loki-retries: "5"
loki-batch-size: "400"
x-logging:
&default-logging
options:
max-size: '12m'
max-file: '5'
driver: json-file
# usabile cosi':
#services:
# web:
# logging: *default-logging
x-volumes:
&default-volume
driver: foobar-storage
volumes:
vol1: *default-volume
vol2:
<< : *default-volume
name: volume02
vol3:
<< : *default-volume
driver: default
name: volume-local
networks:
internal:
traefik:
external: true
name: traefik
configs:
configfile:
file: ./config/whoami/file.yml
name: configfile-v1
configs:
cert.pem:
file: ./config/whoami/cert.pem
services:
whoami:
image: containous/whoami
#command: sleep 3600
#entrypoint:
#init: true # Run an init inside the container
# that forwards signals and reaps processes
stop_grace_period: 1m30s # default: 10s
stop_signal: SIGUSR1 # default: SIGTERM
sysctls:
net.core.somaxconn: 1024
net.ipv4.tcp_syncookies: 0
<<: *logging-loki
volumes:
- /srv:/data
networks:
- traefik
# alternative way for networks
# internal:
# aliases:
# - alias1
# - alias2
extra_hosts:
- "somehost:162.242.195.82"
environment:
SHOW: 'true'
configs:
secrets:
- source: cert.pem
target: /etc/certs/cert.pem # default: /run/secrets/$source
uid: '33'
gid: '33'
mode: 0440
deploy:
replicas: 2
resources:
reservations:
cpus: '0.1'
memory: 32M
update_config:
order: start-first # default: stop-first
parallelism: 1
delay: 10s
failure_action: rollback # default: pause
monitor: 2s
rollback_config:
order: start-first # default: stop-first
parallelism: 1
delay: 10s
monitor: 2s
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 10
window: 120s
placement:
constraints: [node.labels.type == stateless]
labels:
traefik.docker.network: "traefik"
traefik.enable: 'true'
traefik.http.routers.whoami.entrypoints: websecure
traefik.http.routers.whoami-https.rule: 'Host(`whoami.boat.opencontent.io`)'
traefik.http.routers.whoami-https.tls: 'true'
traefik.http.routers.whoami-https.tls.certresolver: 'mydnschallenge'
traefik.http.routers.whoami-https.middlewares: 'goodheaders'
traefik.http.routers.whoami-http.entrypoints: web
traefik.http.routers.whoami-http.rule: 'Host(`whoami.boat.opencontent.io`)'
traefik.http.routers.whoami-http.middlewares: gotossl
traefik.http.services.whoami.loadbalancer.server.port: 80
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
# test: curl -f https://localhost || exit 1 # equivalent
# test: ["CMD-SHELL", "curl -f http://localhost || exit 1"] # equivalent
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
memcached:
image: bitnami/memcached:1.6.6
environments:
MEMCACHED_THREADS: 4
MEMCACHED_MAX_CONNECTIONS: 1000
MEMCACHED_CACHE_SIZE: 128
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment