Reconfigure to run out of /app directory

This commit is contained in:
2024-01-23 16:34:37 -06:00
parent d5c553af5a
commit 17107bd7bb
8 changed files with 30 additions and 22 deletions

View File

@@ -31,18 +31,16 @@ RUN apk --no-cache add \
${PHP_VER}-xmlwriter \ ${PHP_VER}-xmlwriter \
${PHP_VER}-zip \ ${PHP_VER}-zip \
${PHP_VER}-zlib && \ ${PHP_VER}-zlib && \
rm -rf /var/www/localhost && \
mkdir -p \ mkdir -p \
/var/www/pterodactyl \ /app \
/run/nginx \ /run/nginx \
/run/php-fpm && \ /run/php-fpm && \
ln -s /etc/${PHP_VER} /etc/php && \ ln -s /etc/${PHP_VER} /etc/php && \
ln -s /usr/bin/${PHP_VER} /usr/bin/php && \ ln -s /usr/bin/${PHP_VER} /usr/bin/php && \
ln -s /usr/sbin/${PHPFPM_VER} /usr/sbin/php-fpm && \ ln -s /usr/sbin/${PHPFPM_VER} /usr/sbin/php-fpm
ln -s /var/log/${PHP_VER} /var/log/php
FROM base AS build FROM base AS build
WORKDIR /var/www/pterodactyl WORKDIR /app
# Download latest Panel build from project repository: https://github.com/pterodactyl/panel # Download latest Panel build from project repository: https://github.com/pterodactyl/panel
ADD https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz panel.tar.gz ADD https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz panel.tar.gz
@@ -63,11 +61,11 @@ RUN apk --no-cache add yarn && \
rm -rf node_modules .env ./storage rm -rf node_modules .env ./storage
FROM base AS release FROM base AS release
WORKDIR /var/www/pterodactyl WORKDIR /app
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS="2" ENV S6_BEHAVIOUR_IF_STAGE2_FAILS="2"
# Copy built Panel from Build stage # Copy built Panel from Build stage
COPY --from=build --chown=nginx:nginx /var/www /var/www COPY --from=build --chown=nginx:nginx /app /app
COPY root/ / COPY root/ /
# Download latest S6-Overlay components from project repository: https://github.com/just-containers/s6-overlay # Download latest S6-Overlay components from project repository: https://github.com/just-containers/s6-overlay

View File

@@ -7,7 +7,7 @@ server {
server_name _; server_name _;
root /var/www/pterodactyl/public; root /app/public;
index index.php; index index.php;
charset utf-8; charset utf-8;
@@ -19,7 +19,7 @@ server {
location = /robots.txt { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; }
access_log off; access_log off;
error_log /var/log/nginx/pterodactyl.app-error.log error; error_log /config/logs/nginx/pterodactyl.app-error.log error;
# allow larger file uploads and longer script runtimes # allow larger file uploads and longer script runtimes
client_max_body_size 100m; client_max_body_size 100m;

View File

@@ -13,11 +13,11 @@ server {
listen 443 ssl http2; listen 443 ssl http2;
server_name _; server_name _;
root /var/www/pterodactyl/public; root /app/public;
index index.php; index index.php;
access_log /var/log/nginx/pterodactyl.app-access.log; access_log /config/logs/nginx/pterodactyl.app-access.log;
error_log /var/log/nginx/pterodactyl.app-error.log error; error_log /config/logs/nginx/pterodactyl.app-error.log error;
# allow larger file uploads and longer script runtimes # allow larger file uploads and longer script runtimes
client_max_body_size 100m; client_max_body_size 100m;

View File

@@ -1 +1 @@
* * * * * php /var/www/pterodactyl/artisan schedule:run >> /dev/null 2>&1 * * * * * php /app/artisan schedule:run >> /dev/null 2>&1

View File

@@ -1,7 +1,7 @@
user nginx; user nginx;
worker_processes auto; worker_processes auto;
pcre_jit on; pcre_jit on;
error_log /var/log/nginx/error.log warn; error_log /config/logs/nginx/error.log warn;
include /etc/nginx/modules/*.conf; include /etc/nginx/modules/*.conf;
events { events {
@@ -39,6 +39,6 @@ http {
'$status $body_bytes_sent "$http_referer" ' '$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; '"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main; access_log /config/logs/nginx/access.log main;
include /etc/nginx/http.d/*.conf; include /etc/nginx/http.d/*.conf;
} }

View File

@@ -1,5 +1,5 @@
[global] [global]
pid = /run/php-fpm/php-fpm.pid pid = /run/php-fpm/php-fpm.pid
error_log = /var/log/php/error.log error_log = /config/logs/php/error.log
log_level = warning log_level = warning
include=/etc/php/php-fpm.d/*.conf include=/etc/php/php-fpm.d/*.conf

View File

@@ -1,4 +1,4 @@
#!/command/with-contenv bash #!/command/with-contenv bash
s6-setuidgid nginx s6-setuidgid nginx
/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 /usr/bin/php /app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3

View File

@@ -2,7 +2,7 @@
source ContainerTools source ContainerTools
SNAME=${0##*/} SNAME=${0##*/}
WORKDIR="/var/www/pterodactyl" WORKDIR="/app"
# If DBHOST value is present, pause boot until target container is up. # If DBHOST value is present, pause boot until target container is up.
if [ -n "$DBHOST" ]; then if [ -n "$DBHOST" ]; then
@@ -34,10 +34,16 @@ if [ ! -d "/config/storage" ]; then
done done
fi fi
# Check for persistent logging directory, create file path if not present. # Check for persistent Nginx logging directory, create file path if not present.
if [ ! -d "/config/log/nginx" ]; then if [ ! -d "/config/logs/nginx" ]; then
log "Creating log directory." log "Creating Nginx log directory."
mkdir -p "/config/log/nginx" mkdir -p "/config/logs/nginx"
fi
# Check for persistent PHP logging directory, create file path if not present.
if [ ! -d "/config/logs/php" ]; then
log "Creating PHP log directory."
mkdir -p "/config/logs/php"
fi fi
# Check for config file, create template if not present. # Check for config file, create template if not present.
@@ -62,11 +68,15 @@ if [ "$HTTPS" == "true" ]; then
if [ ! -e "/etc/nginx/http.d/pterodactyl.conf" ]; then if [ ! -e "/etc/nginx/http.d/pterodactyl.conf" ]; then
log "Symlinking Nginx config file for HTTPS" log "Symlinking Nginx config file for HTTPS"
ln -s /defaults/nginx/https.conf /etc/nginx/http.d/pterodactyl.conf ln -s /defaults/nginx/https.conf /etc/nginx/http.d/pterodactyl.conf
else
log "HTTPS Nginx config is already in place"
fi fi
else else
if [ ! -e "/etc/nginx/http.d/pterodactyl.conf" ]; then if [ ! -e "/etc/nginx/http.d/pterodactyl.conf" ]; then
log "Symlinking Nginx config file for HTTP" log "Symlinking Nginx config file for HTTP"
ln -s /defaults/nginx/http.conf /etc/nginx/http.d/pterodactyl.conf ln -s /defaults/nginx/http.conf /etc/nginx/http.d/pterodactyl.conf
else
log "HTTP Nginx config file is already in place"
fi fi
fi fi
log "Initialization complete" log "Initialization complete"