Restructure to user s6-overlay properly
This commit is contained in:
1
root/etc/s6-overlay/s6-rc.d/crond/dependencies
Normal file
1
root/etc/s6-overlay/s6-rc.d/crond/dependencies
Normal file
@@ -0,0 +1 @@
|
||||
initialize
|
3
root/etc/s6-overlay/s6-rc.d/crond/run
Normal file
3
root/etc/s6-overlay/s6-rc.d/crond/run
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
/usr/sbin/crond -fL /dev/null
|
1
root/etc/s6-overlay/s6-rc.d/crond/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/crond/type
Normal file
@@ -0,0 +1 @@
|
||||
longrun
|
1
root/etc/s6-overlay/s6-rc.d/initialize/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/initialize/type
Normal file
@@ -0,0 +1 @@
|
||||
oneshot
|
1
root/etc/s6-overlay/s6-rc.d/initialize/up
Normal file
1
root/etc/s6-overlay/s6-rc.d/initialize/up
Normal file
@@ -0,0 +1 @@
|
||||
/etc/s6-overlay/scripts/initializer
|
1
root/etc/s6-overlay/s6-rc.d/nginx/dependencies
Normal file
1
root/etc/s6-overlay/s6-rc.d/nginx/dependencies
Normal file
@@ -0,0 +1 @@
|
||||
initialize
|
3
root/etc/s6-overlay/s6-rc.d/nginx/run
Normal file
3
root/etc/s6-overlay/s6-rc.d/nginx/run
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
/usr/sbin/nginx -g "daemon off;"
|
1
root/etc/s6-overlay/s6-rc.d/nginx/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/nginx/type
Normal file
@@ -0,0 +1 @@
|
||||
longrun
|
1
root/etc/s6-overlay/s6-rc.d/php-fpm/dependencies
Normal file
1
root/etc/s6-overlay/s6-rc.d/php-fpm/dependencies
Normal file
@@ -0,0 +1 @@
|
||||
initialize
|
3
root/etc/s6-overlay/s6-rc.d/php-fpm/run
Normal file
3
root/etc/s6-overlay/s6-rc.d/php-fpm/run
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
/usr/sbin/php-fpm -Fc /etc/php
|
1
root/etc/s6-overlay/s6-rc.d/php-fpm/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/php-fpm/type
Normal file
@@ -0,0 +1 @@
|
||||
longrun
|
1
root/etc/s6-overlay/s6-rc.d/pteroq/dependencies
Normal file
1
root/etc/s6-overlay/s6-rc.d/pteroq/dependencies
Normal file
@@ -0,0 +1 @@
|
||||
initialize
|
4
root/etc/s6-overlay/s6-rc.d/pteroq/run
Normal file
4
root/etc/s6-overlay/s6-rc.d/pteroq/run
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/command/with-contenv bash
|
||||
|
||||
s6-setuidgid nginx
|
||||
/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
|
1
root/etc/s6-overlay/s6-rc.d/pteroq/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/pteroq/type
Normal file
@@ -0,0 +1 @@
|
||||
longrun
|
0
root/etc/s6-overlay/s6-rc.d/user/contents.d/crond
Normal file
0
root/etc/s6-overlay/s6-rc.d/user/contents.d/crond
Normal file
0
root/etc/s6-overlay/s6-rc.d/user/contents.d/nginx
Normal file
0
root/etc/s6-overlay/s6-rc.d/user/contents.d/nginx
Normal file
0
root/etc/s6-overlay/s6-rc.d/user/contents.d/php-fpm
Normal file
0
root/etc/s6-overlay/s6-rc.d/user/contents.d/php-fpm
Normal file
0
root/etc/s6-overlay/s6-rc.d/user/contents.d/pteroq
Normal file
0
root/etc/s6-overlay/s6-rc.d/user/contents.d/pteroq
Normal file
72
root/etc/s6-overlay/scripts/initializer
Normal file
72
root/etc/s6-overlay/scripts/initializer
Normal file
@@ -0,0 +1,72 @@
|
||||
#!/command/with-contenv bash
|
||||
source ContainerTools
|
||||
SNAME=${BASH_SOURCE##*/}
|
||||
WORKDIR="/var/www/pterodactyl"
|
||||
|
||||
#
|
||||
# If DBHOST value is present, pause boot until target container is up.
|
||||
if [ -n "$DBHOST" ]; then
|
||||
log "Waiting for SQL at $DBHOST:${DBPORT:=3306}"
|
||||
if wait-for-it $DBHOST:$DBPORT -q -t ${TESTTIME:=30}; then
|
||||
log "SQL found, continuing"
|
||||
else
|
||||
log "SQL could not be reached! Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# If REDISHOST value is present, pause boot until target container is up.
|
||||
if [ -n "$REDISHOST" ]; then
|
||||
log "Waiting for Redis at $REDISHOST:${REDISPORT:=6379}"
|
||||
if wait-for-it $REDISHOST:$REDISPORT -q -t ${TESTTIME:=30}; then
|
||||
log "Redis found, continuing"
|
||||
else
|
||||
log "Redis could not be reached! Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for persistent storage directory, create file structure if not present.
|
||||
if [ ! -d "/config/storage" ]; then
|
||||
log "Creating storage directory"
|
||||
cat $WORKDIR/.storage.tmpl | while read line; do
|
||||
mkdir -p "/config/${line}"
|
||||
done
|
||||
fi
|
||||
|
||||
# Check for persistent logging directory, create file path if not present.
|
||||
if [ ! -d "/config/log/nginx" ]; then
|
||||
log "Creating log directory."
|
||||
mkdir -p "/config/log/nginx"
|
||||
fi
|
||||
|
||||
# Check for config file, create template if not present.
|
||||
if [ ! -e /config/pterodactyl.conf ]; then
|
||||
log "Config file does not exist, creating template"
|
||||
log "[WARN] Connect to container and finish setup process"
|
||||
cp $WORKDIR/.env.example /config/pterodactyl.conf
|
||||
log "Generating unique Pterodactyl key"
|
||||
log "$(php $WORKDIR/artisan key:generate --force --no-interaction)"
|
||||
fi
|
||||
|
||||
# Clear views and autogenerated configs on launch. This is necessary for updates, and doesn't affect non-update launches.
|
||||
log "$(php $WORKDIR/artisan view:clear)"
|
||||
log "$(php $WORKDIR/artisan config:clear)"
|
||||
log "Checking for database updates, preparing cache"
|
||||
log "[NOTE] This will fail if the database connection has not yet been configured"
|
||||
log "$(php $WORKDIR/artisan migrate --seed --force)"
|
||||
chown -R nginx:nginx /config/
|
||||
|
||||
# Load selected Nginx conf.
|
||||
if [ "$HTTPS" == "true" ]; then
|
||||
if [ ! -e "/etc/nginx/http.d/pterodactyl.conf" ]; then
|
||||
log "Symlinking Nginx config file for HTTPS"
|
||||
ln -s /defaults/nginx/https.conf /etc/nginx/http.d/pterodactyl.conf
|
||||
fi
|
||||
else
|
||||
if [ ! -e "/etc/nginx/http.d/pterodactyl.conf" ]; then
|
||||
log "Symlinking Nginx config file for HTTP"
|
||||
ln -s /defaults/nginx/http.conf /etc/nginx/http.d/pterodactyl.conf
|
||||
fi
|
||||
fi
|
||||
log "Initialization complete"
|
Reference in New Issue
Block a user