Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
**/.DS_Store
.idea
.nvmrc

docker/certificates/*
!docker/certificates/.gitkeep
107 changes: 53 additions & 54 deletions build/panel/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,72 +1,71 @@
FROM debian:11-slim
FROM debian:12-slim

LABEL maintainer="dane@daneeveritt.com" \
description="Local development environment for Pterodactyl Panel." \
org.opencontainers.image.source=https://github.com/pterodactyl/development

ENV DEBIAN_FRONTEND noninteractive
ENV LANG=C.UTF-8
ARG TARGETARCHI
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG PHP_VERSION=8.2

ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
PHP_VERSION=$PHP_VERSION \
PHP=php$PHP_VERSION

USER root
RUN apt -y update \
&& apt -y --no-install-recommends install lsb-release ca-certificates apt-transport-https software-properties-common gnupg2 curl sudo \
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list \
&& curl -sL https://packages.sury.org/php/apt.gpg | apt-key add - \
&& apt -y --no-install-recommends install ca-certificates apt-transport-https software-properties-common \
gnupg2 curl sudo locales nginx unzip git supervisor cron default-mysql-client \
iproute2 iputils-ping tar nano \
&& curl -sL https://deb.nodesource.com/setup_22.x | bash - \
&& curl -fsSL https://packages.sury.org/php/apt.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg \
&& echo "deb [signed-by=/etc/apt/trusted.gpg.d/sury-keyring.gpg] https://packages.sury.org/php/ bookworm main" | tee /etc/apt/sources.list.d/sury-php.list \
&& apt -y update \
&& apt -y upgrade \
&& apt -y --no-install-recommends install \
locales \
iproute2 \
iputils-ping \
lsb-release \
nginx \
tar \
unzip \
git \
supervisor \
cron \
nodejs \
yarn \
nano \
&& apt -y --no-install-recommends install php8.1 \
php8.1-cli \
php8.1-common \
php8.1-gd \
php8.1-mysql \
php8.1-mbstring \
php8.1-bcmath \
php8.1-xml \
php8.1-fpm \
php8.1-curl \
php8.1-zip \
php8.1-xdebug \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& apt -y --no-install-recommends install nodejs \
php8.2 \
php8.2-cli \
php8.2-common \
php8.2-gd \
php8.2-mysql \
php8.2-mbstring \
php8.2-bcmath \
php8.2-xml \
php8.2-fpm \
php8.2-curl \
php8.2-zip \
php8.2-xdebug \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/*

COPY entrypoint /usr/local/bin/entrypoint
COPY setup-pterodactyl /usr/local/bin/setup-pterodactyl
COPY configs/supervisord.conf /etc/supervisord.conf
COPY configs/pterodactyl.conf /etc/nginx/sites-available/pterodactyl.conf
&& apt clean \
&& rm -rf /var/cache/apt/archives /var/cache/debconf /var/lib/apt/lists

RUN useradd -m pterodactyl \
&& usermod -a -g www-data -G sudo pterodactyl \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/sudoers \
&& chmod +x /usr/local/bin/setup-pterodactyl \
&& chmod +x /usr/local/bin/entrypoint \
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& npm i -g pnpm \
&& rm -rf /etc/nginx/sites-enabled/* \
&& ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/ \
&& phpdismod -s cli xdebug \
&& mkdir -p /var/run/php \
&& mkdir -p /var/www/html \
&& (crontab -l 2>/dev/null; echo "* * * * * php /var/www/html/artisan schedule:run >> /dev/null 2>&1") | crontab -
&& sed -i 's/;daemonize = yes/daemonize = no/' /etc/php/$PHP_VERSION/fpm/php-fpm.conf \
&& useradd -m pterodactyl \
&& usermod -a -g www-data -G sudo pterodactyl \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/sudoers \
&& phpdismod xdebug \
&& rm -rf /tmp/*

WORKDIR /var/www/html
COPY ./build/panel/php/99-pool.conf /etc/php/$PHP_VERSION/fpm/pool.d/99-pool.conf
COPY ./build/panel/php/99-pterodactyl.ini /etc/php/$PHP_VERSION/shared.d/99-pterodactyl.ini
COPY ./build/panel/configs/pterodactyl.conf /etc/nginx/sites-available/pterodactyl.conf

EXPOSE 80
EXPOSE 8080
RUN (crontab -l 2>/dev/null; echo "* * * * * php /var/www/html/artisan schedule:run >> /dev/null 2>&1") | crontab - \
&& ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/ \
&& ln -s /etc/php/$PHP_VERSION/shared.d/99-pterodactyl.ini /etc/php/$PHP_VERSION/fpm/99-pterodactyl.ini \
&& ln -s /etc/php/$PHP_VERSION/shared.d/99-pterodactyl.ini /etc/php/$PHP_VERSION/cli/99-pterodactyl.ini \
&& mv /etc/php/$PHP_VERSION/fpm/pool.d/www.conf /etc/php/$PHP_VERSION/fpm/pool.d/10-www.conf

COPY ./build/panel/configs/supervisor /etc/supervisor
COPY --chmod=700 ./build/panel/scripts/* /usr/local/bin

EXPOSE 80 8080
WORKDIR /var/www/html
ENTRYPOINT ["entrypoint"]
37 changes: 17 additions & 20 deletions build/panel/configs/pterodactyl.conf
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
server {
listen 80;
listen 8080 default_server;
server_name pterodactyl.test;

root /var/www/html/public;
index index.html index.htm index.php;
charset utf-8;

access_log off;
error_log /dev/stderr error;

gzip on;
gzip_comp_level 6;
gzip_types text/plain text/css application/json application/javascript text/javascript text/xml application/xml;

sendfile off;
client_max_body_size 100m;
client_body_timeout 120s;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

access_log off;
error_log /var/log/nginx/error.log error;

client_max_body_size 100m;
client_body_timeout 120s;

sendfile off;

add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
Expand All @@ -29,19 +32,13 @@ server {
add_header Referrer-Policy same-origin;

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;

fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTP_PROXY "";
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_param HTTPS "on";
fastcgi_buffer_size 8k;
}

location ~ /\.ht {
Expand Down
19 changes: 19 additions & 0 deletions build/panel/configs/supervisor/conf.d/web.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[program:php-fpm]
command=/usr/sbin/php-fpm8.2 -F
autostart=true
autorestart=true
priority=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:nginx]
command=/usr/sbin/nginx -g 'daemon off;'
autostart=true
autorestart=true
priority=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
24 changes: 24 additions & 0 deletions build/panel/configs/supervisor/conf.d/worker.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[program:worker]
process_name=%(program_name)s_%(process_num)02d
numprocs=2
user=www-data
autostart=true
autorestart=true
startretries=5
command=/usr/bin/php /var/www/html/artisan queue:listen --backoff=1 --tries=1 -v
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:cron]
process_name=%(program_name)s
user=root
command=/usr/sbin/cron -f
autostart=true
autorestart=true
startretries=3
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
18 changes: 18 additions & 0 deletions build/panel/configs/supervisor/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[supervisord]
user=root
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
pidfile=/var/run/supervisord.pid

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock

[unix_http_server]
file=/var/run/supervisor.sock

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[include]
files = /etc/supervisor/conf.d/*.conf
32 changes: 0 additions & 32 deletions build/panel/configs/supervisord.conf

This file was deleted.

39 changes: 0 additions & 39 deletions build/panel/entrypoint

This file was deleted.

16 changes: 16 additions & 0 deletions build/panel/php/99-pool.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[global]
error_log = /proc/self/fd/2

[www]
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
catch_workers_output = yes
decorate_workers_output = no

; PHP-FPM Configuration
pm = dynamic
pm.max_children = 15
pm.start_servers = 3
pm.min_spare_servers = 3
pm.max_spare_servers = 5
pm.max_requests = 1000
30 changes: 30 additions & 0 deletions build/panel/php/99-pterodactyl.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
memory_limit = 128M

[opcache]
opcache.jit = disable
opcache.enable = 1
opcache.enable_cli = 1
opcache.enable_file_override = 1
opcache.revalidate_freq = 0
opcache.validate_timestamps = 1
opcache.memory_consumption = 192
opcache.max_wasted_percentage = 10
opcache.interned_strings_buffer = 16
opcache.fast_shutdown = 1
opcache.max_accelerated_files = 32531

[xdebug]
xdebug.mode = debug
xdebug.start_with_request = trigger
xdebug.client_host = host.docker.internal
xdebug.client_port = 9003
xdebug.idekey = PHPSTORM

[curl]
curl.cainfo = /etc/certs/root_ca.pem

[openssl]
openssl.cafile = /etc/certs/root_ca.pem
Loading