mirror of
https://github.com/TheBinaryNinja/tvapp2.git
synced 2026-06-04 05:15:42 -04:00
Initial upload
This commit is contained in:
14
root/etc/logrotate.d/nginx
Normal file
14
root/etc/logrotate.d/nginx
Normal file
@@ -0,0 +1,14 @@
|
||||
/config/log/nginx/*.log {
|
||||
weekly
|
||||
rotate 14
|
||||
compress
|
||||
delaycompress
|
||||
nodateext
|
||||
notifempty
|
||||
missingok
|
||||
sharedscripts
|
||||
postrotate
|
||||
s6-svc -1 /run/service/svc-nginx
|
||||
endscript
|
||||
su abc abc
|
||||
}
|
||||
14
root/etc/logrotate.d/php-fpm
Normal file
14
root/etc/logrotate.d/php-fpm
Normal file
@@ -0,0 +1,14 @@
|
||||
/config/log/php/*.log {
|
||||
rotate 7
|
||||
weekly
|
||||
missingok
|
||||
notifempty
|
||||
delaycompress
|
||||
compress
|
||||
nodateext
|
||||
sharedscripts
|
||||
postrotate
|
||||
s6-svc -t /run/service/svc-php-fpm
|
||||
endscript
|
||||
su abc abc
|
||||
}
|
||||
1
root/etc/nginx/nginx.conf
Normal file
1
root/etc/nginx/nginx.conf
Normal file
@@ -0,0 +1 @@
|
||||
include /config/nginx/nginx.conf;
|
||||
1
root/etc/s6-overlay/s6-rc.d/ci-service-check/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/ci-service-check/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/ci-service-check/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/ci-service-check/up
Normal file
@@ -0,0 +1 @@
|
||||
echo -e " Core : Completed loading container"
|
||||
9
root/etc/s6-overlay/s6-rc.d/init-adduser/branding
Normal file
9
root/etc/s6-overlay/s6-rc.d/init-adduser/branding
Normal file
@@ -0,0 +1,9 @@
|
||||
───────────────────────────────────────────────────────────────
|
||||
TheTvApp Docker Container
|
||||
───────────────────────────────────────────────────────────────
|
||||
This container automatically downloads the m3u8 and xml
|
||||
guide data from
|
||||
- https://github.com/dtankdempse/thetvapp-m3u
|
||||
|
||||
Once the data is downloaded, you can access the files from
|
||||
the container's webserver.
|
||||
37
root/etc/s6-overlay/s6-rc.d/init-adduser/run
Normal file
37
root/etc/s6-overlay/s6-rc.d/init-adduser/run
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
PUID=${PUID:-911}
|
||||
PGID=${PGID:-911}
|
||||
|
||||
if [[ -z ${AETHERX_READ_ONLY_FS} ]] && [[ -z ${AETHERX_NON_ROOT_USER} ]]; then
|
||||
groupmod -o -g "$PGID" abc
|
||||
usermod -o -u "$PUID" abc
|
||||
fi
|
||||
|
||||
if { [[ -z ${AETHERX_READ_ONLY_FS} ]] && [[ -z ${AETHERX_NON_ROOT_USER} ]]; } || [[ ! ${LSIO_FIRST_PARTY} = "true" ]]; then
|
||||
cat /etc/s6-overlay/s6-rc.d/init-adduser/branding
|
||||
else
|
||||
cat /run/branding
|
||||
fi
|
||||
|
||||
if [[ -z ${AETHERX_NON_ROOT_USER} ]]; then
|
||||
echo "
|
||||
User ID ........... $(id -u abc)
|
||||
Group ID .......... $(id -g abc)"
|
||||
else
|
||||
echo "
|
||||
User ID ........... $(stat /run -c %u)
|
||||
Group ID .......... $(stat /run -c %g)"
|
||||
fi
|
||||
echo "
|
||||
Port HTTP ......... $(echo $PORT_HTTP)
|
||||
Port HTTPS ........ $(echo $PORT_HTTPS)"
|
||||
|
||||
echo '───────────────────────────────────────────────────────────────'
|
||||
|
||||
if [[ -z ${AETHERX_READ_ONLY_FS} ]] && [[ -z ${AETHERX_NON_ROOT_USER} ]]; then
|
||||
lsiown abc:abc /app
|
||||
lsiown abc:abc /config
|
||||
lsiown abc:abc /defaults
|
||||
fi
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-adduser/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-adduser/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-adduser/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-adduser/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-adduser/run
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-config-end/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-config-end/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-config-end/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-config-end/up
Normal file
@@ -0,0 +1 @@
|
||||
# This file doesn't do anything, it's just the end of the downstream image init process
|
||||
44
root/etc/s6-overlay/s6-rc.d/init-crontab-config/run
Normal file
44
root/etc/s6-overlay/s6-rc.d/init-crontab-config/run
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
for cron_user in abc root; do
|
||||
if [[ -z ${AETHERX_READ_ONLY_FS} ]] && [[ -z ${AETHERX_NON_ROOT_USER} ]]; then
|
||||
if [[ -f "/etc/crontabs/${cron_user}" ]]; then
|
||||
lsiown "${cron_user}":"${cron_user}" "/etc/crontabs/${cron_user}"
|
||||
crontab -u "${cron_user}" "/etc/crontabs/${cron_user}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -f "/defaults/crontabs/${cron_user}" ]]; then
|
||||
mkdir -p /config/crontabs
|
||||
|
||||
# #
|
||||
# if crontabs do not exist in config
|
||||
# #
|
||||
|
||||
if [[ ! -f "/config/crontabs/${cron_user}" ]]; then
|
||||
|
||||
# #
|
||||
# copy crontab from system
|
||||
# #
|
||||
|
||||
if crontab -l -u "${cron_user}" >/dev/null 2>&1; then
|
||||
crontab -l -u "${cron_user}" >"/config/crontabs/${cron_user}"
|
||||
fi
|
||||
|
||||
# #
|
||||
# if crontabs still do not exist in config (were not copied from system)
|
||||
# copy crontab from image defaults (using -n, do not overwrite an existing file)
|
||||
# #
|
||||
|
||||
cp -n "/defaults/crontabs/${cron_user}" /config/crontabs/
|
||||
fi
|
||||
|
||||
# #
|
||||
# set perms and import user crontabs
|
||||
# #
|
||||
|
||||
lsiown "${cron_user}":"${cron_user}" "/config/crontabs/${cron_user}"
|
||||
crontab -u "${cron_user}" "/config/crontabs/${cron_user}"
|
||||
fi
|
||||
done
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-crontab-config/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-crontab-config/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-crontab-config/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-crontab-config/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-crontab-config/run
|
||||
22
root/etc/s6-overlay/s6-rc.d/init-custom-files/run
Normal file
22
root/etc/s6-overlay/s6-rc.d/init-custom-files/run
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Directories
|
||||
SCRIPTS_DIR="/custom-cont-init.d"
|
||||
|
||||
# Make sure custom init directory exists and has files in it
|
||||
if [[ -e "${SCRIPTS_DIR}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]]; then
|
||||
echo -e " Loader : Custom files found, loading them ..."
|
||||
for SCRIPT in "${SCRIPTS_DIR}"/*; do
|
||||
NAME="$(basename "${SCRIPT}")"
|
||||
if [[ -f "${SCRIPT}" ]]; then
|
||||
echo -e " Loader : Executing ..."
|
||||
/bin/bash "${SCRIPT}"
|
||||
echo -e " Loader : ${NAME}: Exited $?"
|
||||
elif [[ ! -f "${SCRIPT}" ]]; then
|
||||
echo -e " Loader : ${NAME}: Not a valid file"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo -e " Loader : No custom files found, skipping..."
|
||||
fi
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-custom-files/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-custom-files/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-custom-files/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-custom-files/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-custom-files/run
|
||||
19
root/etc/s6-overlay/s6-rc.d/init-envfile/run
Normal file
19
root/etc/s6-overlay/s6-rc.d/init-envfile/run
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
if find /run/s6/container_environment/FILE__* -maxdepth 1 > /dev/null 2>&1; then
|
||||
for FILENAME in /run/s6/container_environment/FILE__*; do
|
||||
SECRETFILE=$(cat "${FILENAME}")
|
||||
if [[ -f ${SECRETFILE} ]]; then
|
||||
FILESTRIP=${FILENAME//FILE__/}
|
||||
if [[ $(tail -n1 "${SECRETFILE}" | wc -l) != 0 ]]; then
|
||||
echo "[env-init] Your secret: ${FILENAME##*/}"
|
||||
echo " contains a trailing newline and may not work as expected"
|
||||
fi
|
||||
cat "${SECRETFILE}" >"${FILESTRIP}"
|
||||
echo "[env-init] ${FILESTRIP##*/} set from ${FILENAME##*/}"
|
||||
else
|
||||
echo "[env-init] cannot find secret in ${FILENAME##*/}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-envfile/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-envfile/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-envfile/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-envfile/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-envfile/run
|
||||
11
root/etc/s6-overlay/s6-rc.d/init-folders/run
Normal file
11
root/etc/s6-overlay/s6-rc.d/init-folders/run
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
# make folders
|
||||
mkdir -p \
|
||||
/config/{keys,php,www} \
|
||||
/config/log/{nginx,php} \
|
||||
/config/nginx/site-confs \
|
||||
/run \
|
||||
/var/lib/nginx/tmp/client_body \
|
||||
/var/tmp/nginx
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-folders/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-folders/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-folders/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-folders/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-folders/run
|
||||
20
root/etc/s6-overlay/s6-rc.d/init-keygen/run
Normal file
20
root/etc/s6-overlay/s6-rc.d/init-keygen/run
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
# #
|
||||
# @project thetvapp-docker
|
||||
# @about Manages self-signed ssl certificates
|
||||
# @file /root/etc/s6-overlay/s6-rc.d/init-keygen/run
|
||||
# @repo https://github.com/Aetherinox/thetvapp-docker
|
||||
# #
|
||||
|
||||
SUBJECT="/C=US/ST=CA/L=NA/O=thetvapp-docker/OU=Aetherinox TheTvApp/CN=*"
|
||||
if [[ -f /config/keys/cert.key && -f /config/keys/cert.crt ]]; then
|
||||
echo -e " SSL : Using existing keys found in /config/keys"
|
||||
else
|
||||
echo -e " SSL : Generating self-signed keys in folder/config/keys. Replace if needed."
|
||||
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"
|
||||
fi
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-keygen/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-keygen/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-keygen/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-keygen/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-keygen/run
|
||||
39
root/etc/s6-overlay/s6-rc.d/init-migrations/run
Normal file
39
root/etc/s6-overlay/s6-rc.d/init-migrations/run
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
MIGRATIONS_DIR="/migrations"
|
||||
MIGRATIONS_HISTORY="/config/.migrations"
|
||||
|
||||
echo -e " Migrations : Started"
|
||||
|
||||
if [[ ! -d ${MIGRATIONS_DIR} ]]; then
|
||||
echo -e " Migrations : No migrations found"
|
||||
exit
|
||||
fi
|
||||
|
||||
for MIGRATION in $(find ${MIGRATIONS_DIR}/* | sort -n); do
|
||||
NAME="$(basename "${MIGRATION}")"
|
||||
if [[ -f ${MIGRATIONS_HISTORY} ]] && grep -Fxq "${NAME}" ${MIGRATIONS_HISTORY}; then
|
||||
echo -e " Migrations : ${NAME} › Skipped"
|
||||
continue
|
||||
fi
|
||||
|
||||
echo -e " Migrations : ${NAME} › Executing"
|
||||
chmod +x "${MIGRATION}"
|
||||
|
||||
# #
|
||||
# Execute migration script in a subshell to prevent it from modifying the current environment
|
||||
# #
|
||||
|
||||
("${MIGRATION}")
|
||||
EXIT_CODE=$?
|
||||
if [[ ${EXIT_CODE} -ne 0 ]]; then
|
||||
echo -e " Migrations : ${NAME} › Failed with exit code ${EXIT_CODE}"
|
||||
exit "${EXIT_CODE}"
|
||||
fi
|
||||
|
||||
echo "${NAME}" >>${MIGRATIONS_HISTORY}
|
||||
echo -e " Migrations : ${NAME} › Success"
|
||||
done
|
||||
|
||||
echo -e " Migrations : Complete"
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-migrations/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-migrations/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-migrations/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-migrations/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-migrations/run
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-mods-end/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-mods-end/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-mods-end/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-mods-end/up
Normal file
@@ -0,0 +1 @@
|
||||
# This file doesn't do anything, it's just the end of the mod init process
|
||||
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-mods-package-install/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-mods-package-install/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-mods-package-install/run
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-nginx-end/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-nginx-end/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-nginx-end/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-nginx-end/up
Normal file
@@ -0,0 +1 @@
|
||||
# This file doesn't do anything, it's just the end of the nginx base init process
|
||||
108
root/etc/s6-overlay/s6-rc.d/init-nginx/run
Normal file
108
root/etc/s6-overlay/s6-rc.d/init-nginx/run
Normal file
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
# #
|
||||
# precreate log files
|
||||
# #
|
||||
|
||||
for file in /config/log/nginx/access.log /config/log/nginx/error.log; do
|
||||
if [[ ! -f "${file}" ]]; then
|
||||
touch "${file}"
|
||||
fi
|
||||
done
|
||||
|
||||
# #
|
||||
# copy default config files if they don't exist
|
||||
# #
|
||||
|
||||
if [[ ! -f /config/nginx/nginx.conf ]]; then
|
||||
cp /defaults/nginx/nginx.conf.sample /config/nginx/nginx.conf
|
||||
fi
|
||||
|
||||
if [[ ! -f /config/nginx/ssl.conf ]]; then
|
||||
cp /defaults/nginx/ssl.conf.sample /config/nginx/ssl.conf
|
||||
fi
|
||||
|
||||
if [[ ! -f /config/nginx/site-confs/default.conf ]]; then
|
||||
cp /defaults/nginx/site-confs/default.conf.sample /config/nginx/site-confs/default.conf
|
||||
fi
|
||||
|
||||
# #
|
||||
# force nginx.conf to include site-confs/*.conf instead of site-confs/*
|
||||
# #
|
||||
|
||||
sed -i -E "s#^(\s*)include /config/nginx/site-confs/\*;#\1include /config/nginx/site-confs/\*.conf;#" /config/nginx/nginx.conf
|
||||
|
||||
# #
|
||||
# copy index.html if no index file exists
|
||||
# #
|
||||
|
||||
INDEX_EXISTS=false
|
||||
for file in /config/www/index.*; do
|
||||
if [[ -e "${file}" ]]; then
|
||||
INDEX_EXISTS=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
THEME_EXISTS=false
|
||||
for file in /config/www/theme/*; do
|
||||
if [[ -e "${file}" ]]; then
|
||||
THEME_EXISTS=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# dont add an index, we want fancy indexing
|
||||
# if [[ ${INDEX_EXISTS} == false ]] && grep -Eq '^\s*index[^#]*index\.html' /config/nginx/**/*.conf; then
|
||||
# cp /defaults/www/index.html /config/www/index.html
|
||||
# fi
|
||||
|
||||
if [[ ${THEME_EXISTS} == false ]]; then
|
||||
cp -r /defaults/www/theme /config/www/
|
||||
fi
|
||||
|
||||
# #
|
||||
# copy pre-generated dhparams or generate if needed
|
||||
# #
|
||||
|
||||
if [[ ! -f /config/nginx/dhparams.pem ]]; then
|
||||
cp /defaults/nginx/dhparams.pem /config/nginx/dhparams.pem
|
||||
fi
|
||||
|
||||
if ! grep -q 'PARAMETERS' "/config/nginx/dhparams.pem"; then
|
||||
curl -o /config/nginx/dhparams.pem -L "https://ssl-config.mozilla.org/ffdhe4096.txt"
|
||||
fi
|
||||
|
||||
# #
|
||||
# Set resolver, ignore ipv6 addresses
|
||||
# #
|
||||
|
||||
touch /config/nginx/resolver.conf
|
||||
if ! grep -q 'resolver' /config/nginx/resolver.conf; then
|
||||
RESOLVERRAW=$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf)
|
||||
for i in ${RESOLVERRAW}; do
|
||||
if [[ "$(awk -F ':' '{print NF-1}' <<<"${i}")" -le 2 ]]; then
|
||||
RESOLVER="${RESOLVER} ${i}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "${RESOLVER}" ]]; then
|
||||
RESOLVER="127.0.0.11"
|
||||
fi
|
||||
|
||||
echo "[ Resolver ]: Setting to ${RESOLVER}"
|
||||
RESOLVEROUTPUT="# This file is auto-generated only on first start, based on the container's /etc/resolv.conf file. Feel free to modify it as you wish.\n\nresolver ${RESOLVER} valid=30s;"
|
||||
echo -e "${RESOLVEROUTPUT}" >/config/nginx/resolver.conf
|
||||
fi
|
||||
|
||||
# #
|
||||
# Set worker_processes
|
||||
# #
|
||||
|
||||
touch /config/nginx/worker_processes.conf
|
||||
if ! grep -q 'worker_processes' /config/nginx/worker_processes.conf; then
|
||||
WORKER_PROCESSES=$(nproc)
|
||||
echo "[ Worker ]: Setting worker_processes to ${WORKER_PROCESSES}"
|
||||
echo -e "# This file is auto-generated only on first start, based on the cpu cores detected. Feel free to change it to any other number or to auto to let nginx handle it automatically.\n\nworker_processes ${WORKER_PROCESSES};" >/config/nginx/worker_processes.conf
|
||||
fi
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-nginx/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-nginx/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-nginx/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-nginx/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-nginx/run
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-os-end/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-os-end/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-os-end/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-os-end/up
Normal file
@@ -0,0 +1 @@
|
||||
# This file doesn't do anything, it's just the end of the mod init process
|
||||
25
root/etc/s6-overlay/s6-rc.d/init-permissions/run
Normal file
25
root/etc/s6-overlay/s6-rc.d/init-permissions/run
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
# permissions
|
||||
lsiown -R abc:abc \
|
||||
/var/lib/nginx \
|
||||
/var/tmp/nginx
|
||||
|
||||
lsiown -R abc:abc \
|
||||
/config/keys \
|
||||
/config/log \
|
||||
/config/nginx \
|
||||
/config/php
|
||||
|
||||
lsiown abc:abc \
|
||||
/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
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-permissions/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-permissions/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-permissions/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-permissions/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-permissions/run
|
||||
28
root/etc/s6-overlay/s6-rc.d/init-php/run
Normal file
28
root/etc/s6-overlay/s6-rc.d/init-php/run
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/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
|
||||
printf "date.timezone = %s\\n" "${TZ:-UTC}" >/etc/php83/conf.d/30_timezone.ini
|
||||
|
||||
# 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
|
||||
ln -s /config/php/php-local.ini /etc/php83/conf.d/zzz_php-local.ini
|
||||
|
||||
# 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
|
||||
cp /config/php/www2.conf /etc/php83/php-fpm.d/www2.conf
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-php/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-php/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-php/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-php/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-php/run
|
||||
28
root/etc/s6-overlay/s6-rc.d/init-samples/run
Normal file
28
root/etc/s6-overlay/s6-rc.d/init-samples/run
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
# #
|
||||
# @project thetvapp-docker
|
||||
# @about Manages sample files such as nginx
|
||||
# @file /root/etc/s6-overlay/s6-rc.d/init-samples/run
|
||||
# @repo https://github.com/Aetherinox/thetvapp-docker
|
||||
# #
|
||||
|
||||
# remove old samples
|
||||
find /config/nginx/ \
|
||||
-name "*.conf.sample" \
|
||||
-type f \
|
||||
-delete
|
||||
|
||||
# copy new samples
|
||||
find /defaults/nginx/ \
|
||||
-maxdepth 3 \
|
||||
-name "*.conf.sample" \
|
||||
-type f \
|
||||
-exec cp "{}" /config/nginx/ \;
|
||||
|
||||
find /defaults/nginx/site-confs/ \
|
||||
-maxdepth 1 \
|
||||
-name "*.conf.sample" \
|
||||
-type f \
|
||||
-exec cp "{}" /config/nginx/site-confs/ \;
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-samples/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-samples/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-samples/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-samples/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-samples/run
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-services/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-services/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-services/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-services/up
Normal file
@@ -0,0 +1 @@
|
||||
# This file doesn't do anything, it just signals that services can start
|
||||
36
root/etc/s6-overlay/s6-rc.d/init-version-checks/run
Normal file
36
root/etc/s6-overlay/s6-rc.d/init-version-checks/run
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# 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)
|
||||
|
||||
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
|
||||
|
||||
if [ -n "${active_confs_changed}" ]; then
|
||||
echo "**** The following active confs have different version dates than the samples that are shipped. ****"
|
||||
echo "**** This may be due to user customization or an update to the samples. ****"
|
||||
echo "**** You should compare the following files to the samples in the same folder and update them. ****"
|
||||
echo "**** Use the link at the top of the file to view the changelog. ****"
|
||||
echo "┌────────────┬────────────┬────────────────────────────────────────────────────────────────────────┐"
|
||||
echo "│ old date │ new date │ path │"
|
||||
echo "├────────────┼────────────┼────────────────────────────────────────────────────────────────────────┤"
|
||||
echo -e "${active_confs_changed%%\\n}"
|
||||
echo "└────────────┴────────────┴────────────────────────────────────────────────────────────────────────┘"
|
||||
fi
|
||||
|
||||
# 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)
|
||||
|
||||
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
root/etc/s6-overlay/s6-rc.d/init-version-checks/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-version-checks/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
||||
1
root/etc/s6-overlay/s6-rc.d/init-version-checks/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/init-version-checks/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-version-checks/run
|
||||
15
root/etc/s6-overlay/s6-rc.d/svc-cron/run
Normal file
15
root/etc/s6-overlay/s6-rc.d/svc-cron/run
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
if builtin command -v crontab >/dev/null 2>&1 && [[ -n "$(crontab -l -u abc 2>/dev/null || true)" || -n "$(crontab -l -u root 2>/dev/null || true)" ]]; then
|
||||
if builtin command -v busybox >/dev/null 2>&1 && [[ $(busybox || true) =~ [[:space:]](crond)([,]|$) ]]; then
|
||||
exec busybox crond -f -S -l 5
|
||||
elif [[ -f /usr/bin/apt ]] && [[ -f /usr/sbin/cron ]]; then
|
||||
exec /usr/sbin/cron -f -L 5
|
||||
else
|
||||
echo "**** cron not found ****"
|
||||
sleep infinity
|
||||
fi
|
||||
else
|
||||
sleep infinity
|
||||
fi
|
||||
1
root/etc/s6-overlay/s6-rc.d/svc-cron/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/svc-cron/type
Normal file
@@ -0,0 +1 @@
|
||||
longrun
|
||||
16
root/etc/s6-overlay/s6-rc.d/svc-nginx/run
Normal file
16
root/etc/s6-overlay/s6-rc.d/svc-nginx/run
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/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
root/etc/s6-overlay/s6-rc.d/svc-nginx/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/svc-nginx/type
Normal file
@@ -0,0 +1 @@
|
||||
longrun
|
||||
4
root/etc/s6-overlay/s6-rc.d/svc-php-fpm/run
Normal file
4
root/etc/s6-overlay/s6-rc.d/svc-php-fpm/run
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
exec /usr/sbin/php-fpm83 -F
|
||||
1
root/etc/s6-overlay/s6-rc.d/svc-php-fpm/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/svc-php-fpm/type
Normal file
@@ -0,0 +1 @@
|
||||
longrun
|
||||
Reference in New Issue
Block a user