Skip to content

Allow to use supervisorctl to be able to reload PHP configuration wit… #268

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

Merged
merged 1 commit into from
Jan 10, 2023
Merged
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
1 change: 0 additions & 1 deletion .ansible/DOCKERFILES/Dockerfile-prod.j2
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
## Unreleased


## Release 0.151

### Added
- Allow to use supervisorctl to be able to reload PHP configuration without restarting


## Release 0.150

### Added
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-5.2
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-5.3
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-5.4
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-5.5
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-5.6
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-7.0
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-7.1
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-7.2
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-7.3
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-7.4
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-8.0
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-8.1
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
1 change: 0 additions & 1 deletion Dockerfiles/prod/Dockerfile-8.2
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ RUN set -eux \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
COPY ./data/supervisord.conf /etc/supervisor/supervisord.conf


###
Expand Down
68 changes: 68 additions & 0 deletions Dockerfiles/prod/data/docker-entrypoint.d/304-supervisor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,51 @@ set -o pipefail
# Functions
############################################################

###
### Create main supvervisord configuration file
###
supervisor_create_config() {
local path="${1}"

# Enable supervisorctl (default: disabled)
SVCTL_ENABLE="${SVCTL_ENABLE:-0}"
if [ -z "${SVCTL_USER:-}" ]; then
SVCTL_USER="$( get_random_alphanum "10" )"
fi
if [ -z "${SVCTL_PASS:-}" ]; then
SVCTL_PASS="$( get_random_alphanum "10" )"
fi

{
# Use 'echo_supervisord_conf' to generate an example config
if [ "${SVCTL_ENABLE}" = "1" ]; then
echo "[rpcinterface:supervisor]"
echo "supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface"
echo
echo "[unix_http_server]"
echo "file = /tmp/supervisor.sock"
echo "chmod = 0700"
echo
echo "[supervisorctl]"
echo "serverurl = unix:///tmp/supervisor.sock"
echo "username = ${SVCTL_USER} ; should be same as in [*_http_server] if set"
echo "password = ${SVCTL_PASS} ; should be same as in [*_http_server] if set"
fi
echo "[supervisord]"
echo "user = root"
echo "nodaemon = true"
echo "loglevel = info"
echo "logfile = /var/log/supervisor/supervisord.log"
echo "pidfile = /var/run/supervisord.pid"
echo "childlogdir = /var/log/supervisor"
echo "strip_ansi = true" # Required to fix tail logs
echo
echo "[include]"
echo "files = /etc/supervisor/conf.d/*.conf /etc/supervisor/custom.d/*.conf"
} > "${path}"
}


###
### Add service to supervisord
###
Expand Down Expand Up @@ -49,3 +94,26 @@ supervisor_add_service() {
echo "stderr_events_enabled = true";
} > "${confd}/${name}.conf"
}


###
### Get Random alphanumeric string
###
get_random_alphanum() {
local len="${1:-15}" # length defaults to 15
tr -dc A-Za-z0-9 < /dev/urandom | head -c "${len}" | xargs || true
}


############################################################
# Sanity Checks
############################################################

if ! command -v tr >/dev/null 2>&1; then
echo "tr not found, but required."
exit 1
fi
if ! command -v xargs >/dev/null 2>&1; then
echo "xargs not found, but required."
exit 1
fi
7 changes: 6 additions & 1 deletion Dockerfiles/prod/data/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ if ! port_forward_validate "FORWARD_PORTS_TO_LOCALHOST" "${DEBUG_LEVEL}"; then
fi


###
### Supvervisor: supervisord.conf
###
supervisor_create_config "/etc/supervisor/supervisord.conf"


###
### Supervisor: socat
###
Expand Down Expand Up @@ -185,7 +191,6 @@ execute_custom_scripts "/startup.1.d" "${DEBUG_LEVEL}"
execute_custom_scripts "/startup.2.d" "${DEBUG_LEVEL}"


###
###
### Startup
###
Expand Down
9 changes: 0 additions & 9 deletions Dockerfiles/prod/data/supervisord.conf

This file was deleted.

8 changes: 7 additions & 1 deletion Dockerfiles/slim/data/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ if ! port_forward_validate "FORWARD_PORTS_TO_LOCALHOST" "${DEBUG_LEVEL}"; then
fi


###
### Supvervisor: supervisord.conf
###
supervisor_create_config "/etc/supervisor/supervisord.conf"


###
### Supervisor: socat
###
Expand Down Expand Up @@ -162,7 +168,7 @@ copy_ini_files "${DVL_PHP_CUST_INI_DIR}" "${DVL_PHP_INI_DIR}" "${DEBUG_LEVEL}"
if [ "${PHP_VERSION}" = "5.2" ]; then
copy_fpm_5_2_conf_file "${DVL_PHP_CUST_FPM_DIR}/php-fpm.xml" "${DEBUG_LEVEL}"
else
copy_fpm_files "${DVL_PHP_CUST_FPM_DIR}" "${DVL_PHP_FPM_DIR}" "${DEBUG_LEVEL}"
copy_fpm_files "${DVL_PHP_CUST_FPM_DIR}" "${DVL_PHP_FPM_DIR}" "${DEBUG_LEVEL}"
fi


Expand Down