diff --git a/README.md b/README.md index ad15fe1..de4c868 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ The directory structure follows the following conventions. The full path is alw ## Initialization Scripts -If you would like to do additional initialization, add a directory called `/docker-custom-entrypoint.d/` and fill it with `.sh` scripts. +If you would like to do additional initialization, add a directory called `/container-custom-entrypoint.d/` and fill it with `.sh` scripts. These scripts will be executed at the end of the entrypoint script, before the service is ran. ## How to Release the container diff --git a/openvoxdb/Containerfile b/openvoxdb/Containerfile index 975e583..f9bf4bb 100644 --- a/openvoxdb/Containerfile +++ b/openvoxdb/Containerfile @@ -50,11 +50,12 @@ ENV \ ADD ssl.sh \ wtfc.sh \ + container-entrypoint.sh \ docker-entrypoint.sh \ healthcheck.sh \ / -COPY docker-entrypoint.d /docker-entrypoint.d +COPY container-entrypoint.d /container-entrypoint.d ADD https://apt.overlookinfratech.com/openvox${OPENVOX_RELEASE}-release-ubuntu${UBUNTU_VERSION}.deb / RUN apt-get update && \ @@ -64,7 +65,7 @@ RUN apt-get update && \ RUN apt update && \ apt upgrade -y && \ apt install --no-install-recommends -y ${PACKAGES} && \ - chmod +x /ssl.sh /wtfc.sh /docker-entrypoint.sh /healthcheck.sh /docker-entrypoint.d/*.sh && \ + chmod +x /ssl.sh /wtfc.sh /container-entrypoint.sh /docker-entrypoint.sh /healthcheck.sh /container-entrypoint.d/*.sh && \ apt install -y openvoxdb=${OPENVOXDB_VERSION} && \ apt autoremove -y && \ apt clean && \ @@ -92,5 +93,5 @@ HEALTHCHECK --start-period=5m --interval=10s --timeout=10s --retries=6 CMD ["/he # NOTE: this is just documentation on defaults EXPOSE 8080 8081 -ENTRYPOINT ["dumb-init", "/docker-entrypoint.sh"] +ENTRYPOINT ["dumb-init", "/container-entrypoint.sh"] CMD ["foreground"] diff --git a/openvoxdb/docker-entrypoint.d/10-wait-for-hosts.sh b/openvoxdb/container-entrypoint.d/10-wait-for-hosts.sh similarity index 100% rename from openvoxdb/docker-entrypoint.d/10-wait-for-hosts.sh rename to openvoxdb/container-entrypoint.d/10-wait-for-hosts.sh diff --git a/openvoxdb/docker-entrypoint.d/20-configure-ssl.sh b/openvoxdb/container-entrypoint.d/20-configure-ssl.sh similarity index 100% rename from openvoxdb/docker-entrypoint.d/20-configure-ssl.sh rename to openvoxdb/container-entrypoint.d/20-configure-ssl.sh diff --git a/openvoxdb/docker-entrypoint.d/30-certificate-allowlist.sh b/openvoxdb/container-entrypoint.d/30-certificate-allowlist.sh similarity index 100% rename from openvoxdb/docker-entrypoint.d/30-certificate-allowlist.sh rename to openvoxdb/container-entrypoint.d/30-certificate-allowlist.sh diff --git a/openvoxdb/container-entrypoint.sh b/openvoxdb/container-entrypoint.sh new file mode 100755 index 0000000..61911da --- /dev/null +++ b/openvoxdb/container-entrypoint.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# bash is required to pass ENV vars with dots as sh cannot + +set -e + +echoerr() { echo "$@" 1>&2; } + +if [ -d /docker-entrypoint.d ]; then + echoerr "DEPRECATED: Use /container-entrypoint.d/ instead of /docker-entrypoint.d/" + for f in /docker-entrypoint.d/*.sh; do + echo "Running $f" + "$f" + done +fi + +for f in /container-entrypoint.d/*.sh; do + echo "Running $f" + "$f" +done + +if [ -d /docker-custom-entrypoint.d/ ]; then + echoerr "DEPRECATED: Use /container-custom-entrypoint.d/ instead of /docker-custom-entrypoint.d/" + find /docker-custom-entrypoint.d/ -type f -name "*.sh" \ + -exec echo Running {} \; -exec bash {} \; +fi + +if [ -d /container-custom-entrypoint.d ]; then + find /container-custom-entrypoint.d/ -type f -name "*.sh" \ + -exec echo Running {} \; -exec bash {} \; +fi + +exec /opt/puppetlabs/bin/puppetdb "$@" diff --git a/openvoxdb/docker-entrypoint.sh b/openvoxdb/docker-entrypoint.sh index efe67cb..f951ea1 100755 --- a/openvoxdb/docker-entrypoint.sh +++ b/openvoxdb/docker-entrypoint.sh @@ -3,14 +3,7 @@ set -e -for f in /docker-entrypoint.d/*.sh; do - echo "Running $f" - "$f" -done +echoerr() { echo "$@" 1>&2; } -if [ -d /docker-custom-entrypoint.d/ ]; then - find /docker-custom-entrypoint.d/ -type f -name "*.sh" \ - -exec echo Running {} \; -exec bash {} \; -fi - -exec /opt/puppetlabs/bin/puppetdb "$@" +echoerr "DEPRECATED: Use /container-entrypoint.sh instead of /docker-entrypoint.sh" +exec ./container-entrypoint.sh "$@"