From 7a0408aa381316b2904cbfb4393a557107d648fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20=C3=81lvaro?= Date: Tue, 2 Jun 2020 18:29:33 +0200 Subject: [PATCH] fix: Move healthcheck from /usr/local/bin to /usr/local/sbin --- .circleci/config.yml | 2 +- Dockerfile | 2 +- README.md | 6 +++--- assets/{bin => sbin}/healthcheck | 0 docker-compose.yml | 7 +++++-- 5 files changed, 10 insertions(+), 7 deletions(-) rename assets/{bin => sbin}/healthcheck (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 76e592b..144e3cf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -197,7 +197,7 @@ jobs: command: sleep 60 - run: name: Test image bootup - command: docker exec -it salt_master /usr/local/bin/healthcheck + command: docker exec -it salt_master /usr/local/sbin/healthcheck workflows: build-and-test: diff --git a/Dockerfile b/Dockerfile index cc52f81..7b7fc19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,7 +51,7 @@ RUN bash ${SALT_BUILD_DIR}/install.sh COPY assets/runtime ${SALT_RUNTIME_DIR} RUN chmod -R +x ${SALT_RUNTIME_DIR} -COPY assets/bin/* /usr/local/bin +COPY assets/sbin/* /usr/local/sbin # Cleaning tasks RUN rm -rf "${SALT_BUILD_DIR:?}"/* diff --git a/README.md b/README.md index 9b5afac..3ed882e 100644 --- a/README.md +++ b/README.md @@ -354,7 +354,7 @@ Check [Available Configuration Parameters](#available-configuration-parameters) ### Healthcheck -This image includes a [health check](https://docs.docker.com/engine/reference/builder/#healthcheck) script: `/usr/local/bin/healthcheck` (although it is disable by default). It is useful to check if the `salt-master` service is alive and responding. +This image includes a [health check](https://docs.docker.com/engine/reference/builder/#healthcheck) script: `/usr/local/sbin/healthcheck` (although it is disable by default). It is useful to check if the `salt-master` service is alive and responding. If you are running this image under k8s, you can define a _liveness command_ as explained [here](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-liveness-command). @@ -368,7 +368,7 @@ services: container_name: salt_master image: cdalvaro/saltstack-master:3000.3_2 healthcheck: - test: ["CMD", "/usr/local/bin/healthcheck"] + test: ["CMD", "/usr/local/sbin/healthcheck"] start_period: 30s ``` @@ -379,7 +379,7 @@ Or, if you launch your container [with docker](https://docs.docker.com/engine/re ```sh docker run --name salt_master --detach \ --publish 4505:4505 --publish 4506:4506 \ - --health-cmd='/usr/local/bin/healthcheck' \ + --health-cmd='/usr/local/sbin/healthcheck' \ --health-start-period=30s \ --env 'SALT_LOG_LEVEL=info' \ --volume $(pwd)/roots/:/home/salt/data/srv/ \ diff --git a/assets/bin/healthcheck b/assets/sbin/healthcheck similarity index 100% rename from assets/bin/healthcheck rename to assets/sbin/healthcheck diff --git a/docker-compose.yml b/docker-compose.yml index 0e2293d..7944b18 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,8 +10,11 @@ services: - "keys/:/home/salt/data/keys" - "logs/:/home/salt/data/logs" ports: - - "4505:4505/tcp" - - "4506:4506/tcp" + - "4505:4505" + - "4506:4506" + healthcheck: + test: ["CMD", "/usr/local/sbin/healthcheck"] + start_period: 30s environment: - DEBUG=false - TIMEZONE=Europe/Madrid