mirror of
https://github.com/TheBinaryNinja/tvapp2.git
synced 2026-06-04 06:45:41 -04:00
chore: clean up app
This commit is contained in:
@@ -24,14 +24,14 @@ echo " User:Group $(id -u dockerx):$(id -g dockerx)"
|
||||
else
|
||||
echo " User:Group $(stat /run -c %u):$(stat /run -c %g)"
|
||||
fi
|
||||
echo " Port(s) $(echo $PORT_HTTP)"
|
||||
echo " Port(s) $(echo $WEB_PORT)"
|
||||
echo " Gateway $(echo $IP_GATEWAY)"
|
||||
echo " Web Server $(echo $IP_CONTAINER:$PORT_HTTP)"
|
||||
echo " Web Server $(echo $IP_CONTAINER:$WEB_PORT)"
|
||||
echo ""
|
||||
echo '──────────────────────────────────────────────────────────────────────────────────────────'
|
||||
|
||||
if [[ -z ${TVAPP_READ_ONLY_FS} ]] && [[ -z ${TVAPP_NON_ROOT_USER} ]]; then
|
||||
aetherxown dockerx:dockerx /app
|
||||
aetherxown dockerx:dockerx /config
|
||||
aetherxown dockerx:dockerx /defaults
|
||||
aetherxown dockerx:dockerx /usr/src/app
|
||||
fi
|
||||
|
||||
@@ -3,9 +3,5 @@
|
||||
|
||||
# make folders
|
||||
mkdir -p \
|
||||
/config/{keys,php,www} \
|
||||
/config/log/{nginx,php} \
|
||||
/config/nginx/site-confs \
|
||||
/config/keys \
|
||||
/run \
|
||||
/var/lib/nginx/tmp/client_body \
|
||||
/var/tmp/nginx
|
||||
|
||||
@@ -18,5 +18,8 @@ else
|
||||
rm -f \
|
||||
/config/keys/cert.key \
|
||||
/config/keys/cert.crt || true
|
||||
openssl req -new -x509 -days 3650 -nodes -out /config/keys/cert.crt -keyout /config/keys/cert.key -subj "$SUBJECT"
|
||||
|
||||
mkdir -p /config/keys
|
||||
|
||||
OUT=$(openssl req -new -x509 -days 3650 -nodes -out /config/keys/cert.crt -keyout /config/keys/cert.key -subj "$SUBJECT" 2>/dev/null)
|
||||
fi
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
oneshot
|
||||
@@ -1 +0,0 @@
|
||||
# This file doesn't do anything, it's just the end of the nginx base init process
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
@@ -1 +0,0 @@
|
||||
oneshot
|
||||
@@ -1 +0,0 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-nginx/run
|
||||
@@ -3,23 +3,4 @@
|
||||
|
||||
# permissions
|
||||
aetherxown -R dockerx:dockerx \
|
||||
/var/lib/nginx \
|
||||
/var/tmp/nginx
|
||||
|
||||
aetherxown -R dockerx:dockerx \
|
||||
/config/keys \
|
||||
/config/log \
|
||||
/config/nginx \
|
||||
/config/php
|
||||
|
||||
aetherxown dockerx:dockerx \
|
||||
/config/www
|
||||
|
||||
chmod -R g+w \
|
||||
/config/nginx
|
||||
|
||||
chmod -R 644 /etc/logrotate.d
|
||||
|
||||
if [[ -f "/config/log/logrotate.status" ]]; then
|
||||
chmod 600 /config/log/logrotate.status
|
||||
fi
|
||||
/config/keys
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
# precreate log files
|
||||
if [[ ! -f /config/log/php/error.log ]]; then
|
||||
touch /config/log/php/error.log
|
||||
fi
|
||||
|
||||
# set default timezone
|
||||
if [[ -f /etc/php83/conf.d/30_timezone.ini ]]; then
|
||||
printf "date.timezone = %s\\n" "${TZ:-UTC}" >/etc/php83/conf.d/30_timezone.ini
|
||||
fi
|
||||
|
||||
# create local php.ini if it doesn't exist, set local timezone
|
||||
if [[ ! -f /config/php/php-local.ini ]]; then
|
||||
printf "; Edit this file to override php.ini directives\\n\\n" >/config/php/php-local.ini
|
||||
fi
|
||||
|
||||
# symlink user php-local.ini to image
|
||||
rm -rf /etc/php83/conf.d/php-local.ini
|
||||
rm -rf /etc/php83/conf.d/zzz_php-local.ini
|
||||
|
||||
if [[ -f /config/php/php-local.ini ]] && [ -d /etc/php83/conf.d ]; then
|
||||
ln -s /config/php/php-local.ini /etc/php83/conf.d/zzz_php-local.ini
|
||||
fi
|
||||
|
||||
# create override for www.conf if it doesn't exist
|
||||
if [[ ! -f /config/php/www2.conf ]]; then
|
||||
printf "; Edit this file to override www.conf and php-fpm.conf directives and restart the container\\n\\n; Pool name\\n[www]\\n\\n" >/config/php/www2.conf
|
||||
fi
|
||||
|
||||
# copy user www2.conf to image
|
||||
if [[ -f /config/php/www2.conf ]] && [ -d /etc/php83/conf.d ]; then
|
||||
cp /config/php/www2.conf /etc/php83/php-fpm.d/www2.conf
|
||||
fi
|
||||
@@ -1 +0,0 @@
|
||||
oneshot
|
||||
@@ -1 +0,0 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-php/run
|
||||
@@ -2,23 +2,23 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
# detect nginx configs with dates not matching the provided sample files
|
||||
active_confs=$(find /config/nginx/ -name "*.conf" -type f 2>/dev/null)
|
||||
# active_confs=$(find /config/nginx/ -name "*.conf" -type f 2>/dev/null)
|
||||
|
||||
for i in ${active_confs}; do
|
||||
if [ -f "${i}.sample" ]; then
|
||||
if [ "$(sed -nE 's|^## Version ([0-9]{4}\/[0-9]{2}\/[0-9]{2}).*|\1|p' "${i}")" != "$(sed -nE 's|^## Version ([0-9]{4}\/[0-9]{2}\/[0-9]{2}).*|\1|p' "${i}.sample")" ]; then
|
||||
active_confs_changed="│ $(printf '%10s' "$(sed -nE 's|^## Version ([0-9]{4}\/[0-9]{2}\/[0-9]{2}).*|\1|p' "${i}" | tr / -)") │ $(printf '%10s' "$(sed -nE 's|^## Version ([0-9]{4}\/[0-9]{2}\/[0-9]{2}).*|\1|p' "${i}.sample" | tr / -)") │ $(printf '%-70s' "${i}") │\n${active_confs_changed}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# for i in ${active_confs}; do
|
||||
# if [ -f "${i}.sample" ]; then
|
||||
# if [ "$(sed -nE 's|^## Version ([0-9]{4}\/[0-9]{2}\/[0-9]{2}).*|\1|p' "${i}")" != "$(sed -nE 's|^## Version ([0-9]{4}\/[0-9]{2}\/[0-9]{2}).*|\1|p' "${i}.sample")" ]; then
|
||||
# active_confs_changed="│ $(printf '%10s' "$(sed -nE 's|^## Version ([0-9]{4}\/[0-9]{2}\/[0-9]{2}).*|\1|p' "${i}" | tr / -)") │ $(printf '%10s' "$(sed -nE 's|^## Version ([0-9]{4}\/[0-9]{2}\/[0-9]{2}).*|\1|p' "${i}.sample" | tr / -)") │ $(printf '%-70s' "${i}") │\n${active_confs_changed}"
|
||||
# fi
|
||||
# fi
|
||||
# done
|
||||
|
||||
# detect site-confs with wrong extension
|
||||
site_confs_wrong_ext=$(find /config/nginx/site-confs/ -type f -not -name "*.conf" -not -name "*.conf.sample" 2>/dev/null)
|
||||
# site_confs_wrong_ext=$(find /config/nginx/site-confs/ -type f -not -name "*.conf" -not -name "*.conf.sample" 2>/dev/null)
|
||||
|
||||
if [ -n "${site_confs_wrong_ext}" ]; then
|
||||
echo "**** The following site-confs have extensions other than .conf ****"
|
||||
echo "**** This may be due to user customization. ****"
|
||||
echo "**** You should review the files and rename them to use the .conf extension or remove them. ****"
|
||||
echo "**** nginx.conf will only include site-confs with the .conf extension. ****"
|
||||
echo -e "${site_confs_wrong_ext}"
|
||||
fi
|
||||
# if [ -n "${site_confs_wrong_ext}" ]; then
|
||||
# echo "**** The following site-confs have extensions other than .conf ****"
|
||||
# echo "**** This may be due to user customization. ****"
|
||||
# echo "**** You should review the files and rename them to use the .conf extension or remove them. ****"
|
||||
# echo "**** nginx.conf will only include site-confs with the .conf extension. ****"
|
||||
# echo -e "${site_confs_wrong_ext}"
|
||||
# fi
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
if pgrep -f "[n]ginx:" >/dev/null; then
|
||||
echo "Zombie nginx processes detected, sending SIGTERM"
|
||||
pkill -ef [n]ginx:
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
if pgrep -f "[n]ginx:" >/dev/null; then
|
||||
echo "Zombie nginx processes still active, sending SIGKILL"
|
||||
pkill -9 -ef [n]ginx:
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
# exec /usr/sbin/nginx
|
||||
@@ -1 +0,0 @@
|
||||
longrun
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
if [[ -f /usr/sbin/php-fpm83 ]]; then
|
||||
exec /usr/sbin/php-fpm83 -F
|
||||
fi
|
||||
@@ -1 +0,0 @@
|
||||
longrun
|
||||
Reference in New Issue
Block a user