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

health check #40

Closed
bryan-gilbert opened this issue Oct 31, 2020 · 2 comments
Closed

health check #40

bryan-gilbert opened this issue Oct 31, 2020 · 2 comments

Comments

@bryan-gilbert
Copy link

I'm seeking a health check to verify if postfix is running. The following is something I developed that seems to work.

Might you consider adding the following to your project's sample docker compose file or to your documentation?

d-c.yml

version: '3'
services:
  postfix:
    image: boky/postfix
    expose:
      - "587"
    environment:
      - DKIM_AUTOGENERATE=1
      - ALLOWED_SENDER_DOMAINS
    restart: always
    volumes:
      - "./dkimkeys:/etc/opendkim/keys"
    healthcheck:
      test: netstat -l | grep smtp
      interval: 1m
      timeout: 10s
      retries: 3

The healthcheck uses netstat, which is installed in the linux image used by this project. Ask netstat to list all listening ports. Use grep to see if something (e.g. postfix) is listening on the smtp port. Grep returns 0 exit code if it finds a match and 1 when there is no match.

@bokysan
Copy link
Owner

bokysan commented Nov 3, 2020

This is a good idea. I already have healtchecks in the helm chart but would make sense to add them to Dockerfile via HEALTHCHECK directive as well.

That way you wouldn't need to specify them individually in docker-compose.yml.

If fixing, I should probably add a bit more elaborate check.

bokysan added a commit that referenced this issue Nov 3, 2020
`HEALTHCHECK` instruction has been added to `Dockerfile`. This should
allow `docker-compose` installations to monitor and restart the
container if neccessary.

Kubernetes deployment healthcheck has been tweaked a bit to better
validate that the server is actually running.
@bokysan
Copy link
Owner

bokysan commented Nov 4, 2020

The new Dockerfile includes the directive. This is now resolved in master and will be released with the new version soon.

@bokysan bokysan closed this as completed Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants