Skip to content

Commit

Permalink
Merge pull request #9 from aservo/feature/watch-config
Browse files Browse the repository at this point in the history
Provide custom scripts for watching configs, install inotify-tools
  • Loading branch information
pathob authored Mar 24, 2023
2 parents 3637c97 + 51fed58 commit e2b6bfa
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,12 @@ RUN wget "https://github.com/latchset/mod_auth_mellon/releases/download/v${MOD_A
make install && \
rm -rf /tmp/mod_auth_mellon*

# install generic packages (keep separated in case we want to use builder image)
RUN apt-get update && apt-get install -y \
inotify-tools \
&& rm -rf /var/lib/apt/lists/*

# add (and override) scripts to scripts in upstream image
COPY ./scripts /opt/bitnami/scripts/apache/

USER www-data
23 changes: 23 additions & 0 deletions scripts/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# shellcheck disable=SC1091

set -o errexit
set -o nounset
set -o pipefail
# set -o xtrace # Uncomment this line for debugging purposes

# Load libraries
. /opt/bitnami/scripts/libapache.sh
. /opt/bitnami/scripts/liblog.sh

# Load Apache environment
. /opt/bitnami/scripts/apache-env.sh

# Watch for changes in the conf directory
info "** Starting Apache config watcher **"
/opt/bitnami/scripts/apache/watch-config.sh &
info "** Apache config watcher started in background! **"

info "** Starting Apache **"
exec "${APACHE_BIN_DIR}/httpd" -f "$APACHE_CONF_FILE" -D "FOREGROUND"
19 changes: 19 additions & 0 deletions scripts/watch-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

# Load libraries
. /opt/bitnami/scripts/libapache.sh
. /opt/bitnami/scripts/libbitnami.sh
. /opt/bitnami/scripts/liblog.sh

# Load Apache environment
. /opt/bitnami/scripts/apache-env.sh

mkdir -p conf

while inotifywait -e create,delete,modify,move -r conf; do
/opt/bitnami/scripts/apache/reload.sh;
done

0 comments on commit e2b6bfa

Please sign in to comment.