Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ng): manage docker heathcheck in ng state #309

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docker/compose/ng.sls
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 25 additions & 0 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
25 changes: 25 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down