-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix permissions using entrypoint scripts
- Loading branch information
Showing
8 changed files
with
106 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
ME=$(basename $0) | ||
|
||
if ! [ -d /var/www/baikal/Specific/db ] | ||
then | ||
echo >&3 "$ME: info: Creating new Baikal database folder" | ||
mkdir -p /var/www/baikal/Specific/db | ||
fi | ||
|
||
# Detect if we're running in the Apache httpd image | ||
if [ ! -z ${APACHE_CONFDIR+x} ] | ||
then | ||
echo >&3 "$ME: info: Adjusting Baikal file permissions for Apache httpd" | ||
chown -R www-data:www-data /var/www/baikal | ||
|
||
# Inject ServerName and ServerAlias if specified | ||
APACHE_CONFIG="/etc/apache2/sites-available/000-default.conf" | ||
if [ ! -z ${BAIKAL_SERVERNAME+x} ] | ||
then | ||
sed -i "s/# InjectedServerName .*/ServerName $BAIKAL_SERVERNAME/g" $APACHE_CONFIG | ||
fi | ||
|
||
if [ ! -z ${BAIKAL_SERVERALIAS+x} ] | ||
then | ||
sed -i "s/# InjectedServerAlias .*/ServerAlias $BAIKAL_SERVERALIAS/g" $APACHE_CONFIG | ||
fi | ||
fi | ||
|
||
# Detect if we're running in the nginx image | ||
if [ ! -z ${NGINX_VERSION+x} ] | ||
then | ||
echo >&3 "$ME: info: Adjusting Baikal file permissions for nginx" | ||
chown -R nginx:nginx /var/www/baikal | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
ME=$(basename $0) | ||
|
||
# Start PHP FPM if it exists | ||
if [ -f "/etc/init.d/php8.0-fpm" ]; then | ||
echo >&3 "$ME: info: Starting PHP 8.0" | ||
/etc/init.d/php8.0-fpm start | ||
elif [ -f "/etc/init.d/php8.1-fpm" ]; then | ||
echo >&3 "$ME: info: Starting PHP 8.1" | ||
/etc/init.d/php8.1-fpm start | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/sh | ||
|
||
# Based on /etc/docker-entrypoint.sh in nginx image | ||
|
||
set -e | ||
|
||
if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then | ||
exec 3>&1 | ||
else | ||
exec 3>/dev/null | ||
fi | ||
|
||
# Run the scripts in /docker-entrypoint.d if we're starting either Apache httpd or nginx | ||
if [ "$1" = "nginx" -o "$1" = "nginx-debug" -o "$1" = "apache2-foreground" ] | ||
then | ||
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v | ||
then | ||
echo >&3 "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration" | ||
echo >&3 "$0: Looking for shell scripts in /docker-entrypoint.d/" | ||
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f | ||
do | ||
case "$f" in | ||
*.sh) | ||
if [ -x "$f" ] | ||
then | ||
echo >&3 "$0: Launching $f"; | ||
"$f" | ||
else | ||
# warn on shell scripts without exec bit | ||
echo >&3 "$0: Ignoring $f, not executable"; | ||
fi | ||
;; | ||
*) echo >&3 "$0: Ignoring $f";; | ||
esac | ||
done | ||
|
||
echo >&3 "$0: Configuration complete; ready for start up" | ||
else | ||
echo >&3 "$0: No files found in /docker-entrypoint.d/, skipping configuration" | ||
fi | ||
fi | ||
|
||
exec "$@" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters