You are on page 1of 2

TODAY TASK REPORT ( Implementation of Health Check using autoheal Container )

Steps:

1. Kawish bhai first create an health_check api


2. Then we edit docker-compose file on server

Before Implementation of health check in docker-compose


version: '3.3'services:
livefreenow:
restart: always
build: .
volumes:
- ./:/usr/src/app
# - /home/codexnow/Desktop/certs:/usr/src/app/certs
# - /home/codexnow/Desktop/iponymData:/usr/src/app/iponymData
# - /home/codexnow/Desktop/templates:/usr/src/app/templates
- /home/anwar/imrservice_certs:/usr/src/app/certs
- /home/anwar/iponymData:/usr/src/app/iponymData
- /home/anwar/templates:/usr/src/app/templates
ports:
- 5003:5003
network_mode: bridge
command: bash -c "SHARD=livefreenowapis python3 manage.py runserver 0:5003"

After Implementation of health check in docker-compose


version: '3.3'
services:
livefreenow:
restart: always
build: .
labels:
- autoheal=true
healthcheck:
test: ["CMD", "curl", "http://otacon.us:5003/otacon/health_check"]
interval: 5m
timeout: 10s
retries: 3
volumes:
- ./:/usr/src/app
# - /home/codexnow/Desktop/certs:/usr/src/app/certs
# - /home/codexnow/Desktop/iponymData:/usr/src/app/iponymData
# - /home/codexnow/Desktop/templates:/usr/src/app/templates
- /home/anwar/imrservice_certs:/usr/src/app/certs
- /home/anwar/iponymData:/usr/src/app/iponymData
- /home/anwar/templates:/usr/src/app/templates
ports:
- 5003:5003
network_mode: bridge
command: bash -c "SHARD=livefreenowapis python3 manage.py runserver 0:5003"
autoheal:
image: willfarrell/autoheal
container_name: autoheal
restart: always
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'

• Adding interval of 5mins because project take 3-4 mins to start completely.
• Build and autoheal container run together and after very 5mins auto will curl the health-
check api and it is working perfectly on Anwar bhai machine.

You might also like