diff --git a/docker/compose/ng.sls b/docker/compose/ng.sls index f82f381e..b4763136 100644 --- a/docker/compose/ng.sls +++ b/docker/compose/ng.sls @@ -48,6 +48,9 @@ docker-compose-ng-{{ id }}-running: {%- endif %} {%- if 'user' in container %} - user: {{ container.user }} + {%- endif %} + {%- if 'healthcheck' in container and container.healthcheck is iterable %} + - healthcheck: {{ container.healthcheck|unique|json }} {%- endif %} {%- if 'environment' in container and container.environment is iterable %} - environment: diff --git a/docs/README.rst b/docs/README.rst index d81fe5a0..9eb94588 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -212,6 +212,31 @@ To use this formula, you might target a host with the following pillar: working_dir: '/var/www/html' volume_driver: 'local' userns_mode: 'host' + dashy: + image: 'lissy93/dashy:latest' + container_name: 'dashy' + networks: + - frontend + restart: unless-stopped + environment: + NODE_ENV: "production" + ports: + - "4000:80" + volumes: + - /srv/docker-registry/dashy:/app/public + cap_drop: + - ALL + cap_add: + - CHOWN + - SETGID + - SETUID + - DAC_OVERRIDE + - NET_BIND_SERVICE + healthcheck: + test: ['CMD', 'node', '/app/services/healthcheck'] + interval: {{ 90e9 | int }} # 1m30s + timeout: {{ 10e9 | int }} # 5s + retries: 3 Then you would target a host with the following states: diff --git a/pillar.example b/pillar.example index d2e6ef71..e5dfda98 100644 --- a/pillar.example +++ b/pillar.example @@ -171,6 +171,31 @@ docker: restart: "always" tty: true stdin_open: true + dashy: + image: 'lissy93/dashy:latest' + container_name: 'dashy' + networks: + - frontend + restart: unless-stopped + environment: + NODE_ENV: "production" + ports: + - "4000:80" + volumes: + - /srv/docker-registry/dashy:/app/public + cap_drop: + - ALL + cap_add: + - CHOWN + - SETGID + - SETUID + - DAC_OVERRIDE + - NET_BIND_SERVICE + healthcheck: + test: ['CMD', 'node', '/app/services/healthcheck'] + interval: {{ 90e9 | int }} # 1m30s + timeout: {{ 10e9 | int }} # 5s + retries: 3 swarm: # Per https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.swarm.html