From 1995c2425e8de43615cab8bf327677feb7f7591d Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Sat, 11 Apr 2020 21:01:42 -0400 Subject: [PATCH 1/8] update docker stuff --- .dev/docker/default.conf | 2 +- .dev/docker/entrypoint.sh | 15 ++++++++++----- .dev/docker/supervisord.conf | 4 ++-- .dev/docker/www.conf | 4 ++-- Dockerfile | 12 ++++++------ docker-compose.example.yml | 4 ++-- 6 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.dev/docker/default.conf b/.dev/docker/default.conf index 0944bf799..b6105e5fa 100644 --- a/.dev/docker/default.conf +++ b/.dev/docker/default.conf @@ -31,7 +31,7 @@ server { location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # the fastcgi_pass path needs to be changed accordingly when using CentOS - fastcgi_pass unix:/var/run/php/php-fpm7.2.sock; + fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M"; diff --git a/.dev/docker/entrypoint.sh b/.dev/docker/entrypoint.sh index c2b58375a..403f3df14 100644 --- a/.dev/docker/entrypoint.sh +++ b/.dev/docker/entrypoint.sh @@ -4,19 +4,19 @@ cd /app mkdir -p /var/log/panel/logs/ /var/log/supervisord/ /var/log/nginx/ /var/log/php7/ \ -&& rmdir /app/storage/logs/ \ +&& rm -rf /app/storage/logs/ \ && chmod 777 /var/log/panel/logs/ \ && ln -s /var/log/panel/logs/ /app/storage/ ## check for .env file and generate app keys if missing if [ -f /app/var/.env ]; then echo "external vars exist." - rm /app/.env + rm -rf /app/.env ln -s /app/var/.env /app/ else echo "external vars don't exist." - rm /app/.env + rm -rf /app/.env touch /app/var/.env ## manually generate a key because key generate --force fails @@ -31,12 +31,17 @@ fi echo "Checking if https is required." if [ -f /etc/nginx/conf.d/default.conf ]; then echo "Using nginx config already in place." + if [ $LE_EMAIL ]; then + echo "Checking for cert update" + certbot certonly -d $(echo $APP_URL | sed 's~http[s]*://~~g') --standalone -m $LE_EMAIL --agree-tos -n + else + echo "No letsencrypt email is set" + fi else echo "Checking if letsencrypt email is set." if [ -z $LE_EMAIL ]; then - echo "No letsencrypt email is set Failing to http." + echo "No letsencrypt email is set using http config." cp .dev/docker/default.conf /etc/nginx/conf.d/default.conf - else echo "writing ssl config" cp .dev/docker/default_ssl.conf /etc/nginx/conf.d/default.conf diff --git a/.dev/docker/supervisord.conf b/.dev/docker/supervisord.conf index f2fd3a1b5..da6823aeb 100644 --- a/.dev/docker/supervisord.conf +++ b/.dev/docker/supervisord.conf @@ -20,12 +20,12 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket [program:php-fpm] -command=/usr/sbin/php-fpm7 -F +command=/usr/local/sbin/php-fpm -F autostart=true autorestart=true [program:queue-worker] -command=/usr/bin/php /app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 +command=/usr/local/bin/php /app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 user=nginx autostart=true autorestart=true diff --git a/.dev/docker/www.conf b/.dev/docker/www.conf index 88142564c..c0c17903f 100644 --- a/.dev/docker/www.conf +++ b/.dev/docker/www.conf @@ -1,9 +1,9 @@ -[pterodactyl] +[www] user = nginx group = nginx -listen = /var/run/php/php-fpm7.2.sock +listen = 127.0.0.1:9000 listen.owner = nginx listen.group = nginx listen.mode = 0750 diff --git a/Dockerfile b/Dockerfile index 54ea1d760..76ad6b86f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,16 @@ -FROM php:7.2-fpm-alpine +FROM php:7.4-fpm-alpine WORKDIR /app -RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip; \ +RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot; \ docker-php-ext-install bcmath; \ - apk add --no-cache libpng-dev; \ docker-php-ext-install gd; \ docker-php-ext-install mbstring; \ docker-php-ext-install pdo; \ docker-php-ext-install pdo_mysql; \ docker-php-ext-install tokenizer; \ - apk add --no-cache libxml2-dev; \ docker-php-ext-install xml; \ + docker-php-ext-configure zip --with-libzip=/usr/include; \ docker-php-ext-install zip; \ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer @@ -23,7 +22,8 @@ RUN cp .env.example .env \ && chown -R nginx:nginx . && chmod -R 777 storage/* bootstrap/cache RUN cp .dev/docker/default.conf /etc/nginx/conf.d/default.conf \ - && cp .dev/docker/www.conf /etc/php7/php-fpm.d/www.conf \ + && cat .dev/docker/www.conf > /usr/local/etc/php-fpm.d/www.conf \ + && rm /usr/local/etc/php-fpm.d/www.conf.default \ && cat .dev/docker/supervisord.conf > /etc/supervisord.conf \ && echo "* * * * * /usr/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \ && sed -i s/ssl_session_cache/#ssl_session_cache/g /etc/nginx/nginx.conf \ @@ -33,4 +33,4 @@ EXPOSE 80 443 ENTRYPOINT ["/bin/ash", ".dev/docker/entrypoint.sh"] -CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] +CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] \ No newline at end of file diff --git a/docker-compose.example.yml b/docker-compose.example.yml index eb1bfaddf..7f6d4ea1b 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -1,7 +1,7 @@ version: '2' services: database: - image: mariadb + image: mariadb:10.4 volumes: - "/srv/pterodactyl/database:/var/lib/mysql" environment: @@ -68,7 +68,7 @@ services: - "MAIL_PASSWORD=''" - "MAIL_ENCRYPTION=true" ## certbot settings - Used to automatically generate ssl certs and - - "LE_EMAIL=''" ## leave blank unless you aree generating certs. + # - "LE_EMAIL=" ## uncomment if you are using ssl networks: default: From 8fdee3554cfacacaba9151fa0ee0f1cf343988f5 Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Sat, 11 Apr 2020 21:11:21 -0400 Subject: [PATCH 2/8] update docker stuff --- .dev/docker/default.conf | 2 +- .dev/docker/default_ssl.conf | 4 ++-- .dev/docker/entrypoint.sh | 15 ++++++++++----- .dev/docker/supervisord.conf | 4 ++-- .dev/docker/www.conf | 4 ++-- Dockerfile | 12 ++++++------ docker-compose.example.yml | 4 ++-- 7 files changed, 25 insertions(+), 20 deletions(-) diff --git a/.dev/docker/default.conf b/.dev/docker/default.conf index 0944bf799..b6105e5fa 100644 --- a/.dev/docker/default.conf +++ b/.dev/docker/default.conf @@ -31,7 +31,7 @@ server { location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # the fastcgi_pass path needs to be changed accordingly when using CentOS - fastcgi_pass unix:/var/run/php/php-fpm7.2.sock; + fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M"; diff --git a/.dev/docker/default_ssl.conf b/.dev/docker/default_ssl.conf index c2c2b6df0..9ec5c10db 100644 --- a/.dev/docker/default_ssl.conf +++ b/.dev/docker/default_ssl.conf @@ -1,4 +1,4 @@ -# If using Ubuntu this file should be placed in: +# If using Ubuntu this file should be placed in: # /etc/nginx/sites-available/ # server { @@ -49,7 +49,7 @@ server { location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/var/run/php/php-fpm7.2.sock; + fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M"; diff --git a/.dev/docker/entrypoint.sh b/.dev/docker/entrypoint.sh index c2b58375a..403f3df14 100644 --- a/.dev/docker/entrypoint.sh +++ b/.dev/docker/entrypoint.sh @@ -4,19 +4,19 @@ cd /app mkdir -p /var/log/panel/logs/ /var/log/supervisord/ /var/log/nginx/ /var/log/php7/ \ -&& rmdir /app/storage/logs/ \ +&& rm -rf /app/storage/logs/ \ && chmod 777 /var/log/panel/logs/ \ && ln -s /var/log/panel/logs/ /app/storage/ ## check for .env file and generate app keys if missing if [ -f /app/var/.env ]; then echo "external vars exist." - rm /app/.env + rm -rf /app/.env ln -s /app/var/.env /app/ else echo "external vars don't exist." - rm /app/.env + rm -rf /app/.env touch /app/var/.env ## manually generate a key because key generate --force fails @@ -31,12 +31,17 @@ fi echo "Checking if https is required." if [ -f /etc/nginx/conf.d/default.conf ]; then echo "Using nginx config already in place." + if [ $LE_EMAIL ]; then + echo "Checking for cert update" + certbot certonly -d $(echo $APP_URL | sed 's~http[s]*://~~g') --standalone -m $LE_EMAIL --agree-tos -n + else + echo "No letsencrypt email is set" + fi else echo "Checking if letsencrypt email is set." if [ -z $LE_EMAIL ]; then - echo "No letsencrypt email is set Failing to http." + echo "No letsencrypt email is set using http config." cp .dev/docker/default.conf /etc/nginx/conf.d/default.conf - else echo "writing ssl config" cp .dev/docker/default_ssl.conf /etc/nginx/conf.d/default.conf diff --git a/.dev/docker/supervisord.conf b/.dev/docker/supervisord.conf index f2fd3a1b5..da6823aeb 100644 --- a/.dev/docker/supervisord.conf +++ b/.dev/docker/supervisord.conf @@ -20,12 +20,12 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket [program:php-fpm] -command=/usr/sbin/php-fpm7 -F +command=/usr/local/sbin/php-fpm -F autostart=true autorestart=true [program:queue-worker] -command=/usr/bin/php /app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 +command=/usr/local/bin/php /app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 user=nginx autostart=true autorestart=true diff --git a/.dev/docker/www.conf b/.dev/docker/www.conf index 88142564c..c0c17903f 100644 --- a/.dev/docker/www.conf +++ b/.dev/docker/www.conf @@ -1,9 +1,9 @@ -[pterodactyl] +[www] user = nginx group = nginx -listen = /var/run/php/php-fpm7.2.sock +listen = 127.0.0.1:9000 listen.owner = nginx listen.group = nginx listen.mode = 0750 diff --git a/Dockerfile b/Dockerfile index 54ea1d760..76ad6b86f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,16 @@ -FROM php:7.2-fpm-alpine +FROM php:7.4-fpm-alpine WORKDIR /app -RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip; \ +RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot; \ docker-php-ext-install bcmath; \ - apk add --no-cache libpng-dev; \ docker-php-ext-install gd; \ docker-php-ext-install mbstring; \ docker-php-ext-install pdo; \ docker-php-ext-install pdo_mysql; \ docker-php-ext-install tokenizer; \ - apk add --no-cache libxml2-dev; \ docker-php-ext-install xml; \ + docker-php-ext-configure zip --with-libzip=/usr/include; \ docker-php-ext-install zip; \ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer @@ -23,7 +22,8 @@ RUN cp .env.example .env \ && chown -R nginx:nginx . && chmod -R 777 storage/* bootstrap/cache RUN cp .dev/docker/default.conf /etc/nginx/conf.d/default.conf \ - && cp .dev/docker/www.conf /etc/php7/php-fpm.d/www.conf \ + && cat .dev/docker/www.conf > /usr/local/etc/php-fpm.d/www.conf \ + && rm /usr/local/etc/php-fpm.d/www.conf.default \ && cat .dev/docker/supervisord.conf > /etc/supervisord.conf \ && echo "* * * * * /usr/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \ && sed -i s/ssl_session_cache/#ssl_session_cache/g /etc/nginx/nginx.conf \ @@ -33,4 +33,4 @@ EXPOSE 80 443 ENTRYPOINT ["/bin/ash", ".dev/docker/entrypoint.sh"] -CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] +CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] \ No newline at end of file diff --git a/docker-compose.example.yml b/docker-compose.example.yml index eb1bfaddf..7f6d4ea1b 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -1,7 +1,7 @@ version: '2' services: database: - image: mariadb + image: mariadb:10.4 volumes: - "/srv/pterodactyl/database:/var/lib/mysql" environment: @@ -68,7 +68,7 @@ services: - "MAIL_PASSWORD=''" - "MAIL_ENCRYPTION=true" ## certbot settings - Used to automatically generate ssl certs and - - "LE_EMAIL=''" ## leave blank unless you aree generating certs. + # - "LE_EMAIL=" ## uncomment if you are using ssl networks: default: From 744ad99283ed6cc0817ebd275d2595b77c5bc887 Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Sat, 11 Apr 2020 21:48:22 -0400 Subject: [PATCH 3/8] add packages for yarn --- .dev/docker/entrypoint.sh | 5 +++++ Dockerfile | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.dev/docker/entrypoint.sh b/.dev/docker/entrypoint.sh index 403f3df14..d353b9a69 100644 --- a/.dev/docker/entrypoint.sh +++ b/.dev/docker/entrypoint.sh @@ -71,5 +71,10 @@ php artisan db:seed --force echo -e "Starting cron jobs." crond -L /var/log/crond -l 5 +## install yarn stuff +yarn install --production +yarn add cross-env +yarn run build:production + echo -e "Starting supervisord." exec "$@" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 76ad6b86f..5a1caabdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM php:7.4-fpm-alpine WORKDIR /app -RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot; \ +RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot yarn; \ docker-php-ext-install bcmath; \ docker-php-ext-install gd; \ docker-php-ext-install mbstring; \ From 3090c99a623b8f5e08a137d51f612f024aa88108 Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Sat, 11 Apr 2020 21:01:42 -0400 Subject: [PATCH 4/8] update docker stuff --- .dev/docker/default.conf | 2 +- .dev/docker/entrypoint.sh | 15 ++++++++++----- .dev/docker/supervisord.conf | 4 ++-- .dev/docker/www.conf | 4 ++-- Dockerfile | 12 ++++++------ docker-compose.example.yml | 4 ++-- 6 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.dev/docker/default.conf b/.dev/docker/default.conf index 0944bf799..b6105e5fa 100644 --- a/.dev/docker/default.conf +++ b/.dev/docker/default.conf @@ -31,7 +31,7 @@ server { location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # the fastcgi_pass path needs to be changed accordingly when using CentOS - fastcgi_pass unix:/var/run/php/php-fpm7.2.sock; + fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M"; diff --git a/.dev/docker/entrypoint.sh b/.dev/docker/entrypoint.sh index c2b58375a..403f3df14 100644 --- a/.dev/docker/entrypoint.sh +++ b/.dev/docker/entrypoint.sh @@ -4,19 +4,19 @@ cd /app mkdir -p /var/log/panel/logs/ /var/log/supervisord/ /var/log/nginx/ /var/log/php7/ \ -&& rmdir /app/storage/logs/ \ +&& rm -rf /app/storage/logs/ \ && chmod 777 /var/log/panel/logs/ \ && ln -s /var/log/panel/logs/ /app/storage/ ## check for .env file and generate app keys if missing if [ -f /app/var/.env ]; then echo "external vars exist." - rm /app/.env + rm -rf /app/.env ln -s /app/var/.env /app/ else echo "external vars don't exist." - rm /app/.env + rm -rf /app/.env touch /app/var/.env ## manually generate a key because key generate --force fails @@ -31,12 +31,17 @@ fi echo "Checking if https is required." if [ -f /etc/nginx/conf.d/default.conf ]; then echo "Using nginx config already in place." + if [ $LE_EMAIL ]; then + echo "Checking for cert update" + certbot certonly -d $(echo $APP_URL | sed 's~http[s]*://~~g') --standalone -m $LE_EMAIL --agree-tos -n + else + echo "No letsencrypt email is set" + fi else echo "Checking if letsencrypt email is set." if [ -z $LE_EMAIL ]; then - echo "No letsencrypt email is set Failing to http." + echo "No letsencrypt email is set using http config." cp .dev/docker/default.conf /etc/nginx/conf.d/default.conf - else echo "writing ssl config" cp .dev/docker/default_ssl.conf /etc/nginx/conf.d/default.conf diff --git a/.dev/docker/supervisord.conf b/.dev/docker/supervisord.conf index f2fd3a1b5..da6823aeb 100644 --- a/.dev/docker/supervisord.conf +++ b/.dev/docker/supervisord.conf @@ -20,12 +20,12 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket [program:php-fpm] -command=/usr/sbin/php-fpm7 -F +command=/usr/local/sbin/php-fpm -F autostart=true autorestart=true [program:queue-worker] -command=/usr/bin/php /app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 +command=/usr/local/bin/php /app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 user=nginx autostart=true autorestart=true diff --git a/.dev/docker/www.conf b/.dev/docker/www.conf index 88142564c..c0c17903f 100644 --- a/.dev/docker/www.conf +++ b/.dev/docker/www.conf @@ -1,9 +1,9 @@ -[pterodactyl] +[www] user = nginx group = nginx -listen = /var/run/php/php-fpm7.2.sock +listen = 127.0.0.1:9000 listen.owner = nginx listen.group = nginx listen.mode = 0750 diff --git a/Dockerfile b/Dockerfile index 54ea1d760..76ad6b86f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,16 @@ -FROM php:7.2-fpm-alpine +FROM php:7.4-fpm-alpine WORKDIR /app -RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip; \ +RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot; \ docker-php-ext-install bcmath; \ - apk add --no-cache libpng-dev; \ docker-php-ext-install gd; \ docker-php-ext-install mbstring; \ docker-php-ext-install pdo; \ docker-php-ext-install pdo_mysql; \ docker-php-ext-install tokenizer; \ - apk add --no-cache libxml2-dev; \ docker-php-ext-install xml; \ + docker-php-ext-configure zip --with-libzip=/usr/include; \ docker-php-ext-install zip; \ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer @@ -23,7 +22,8 @@ RUN cp .env.example .env \ && chown -R nginx:nginx . && chmod -R 777 storage/* bootstrap/cache RUN cp .dev/docker/default.conf /etc/nginx/conf.d/default.conf \ - && cp .dev/docker/www.conf /etc/php7/php-fpm.d/www.conf \ + && cat .dev/docker/www.conf > /usr/local/etc/php-fpm.d/www.conf \ + && rm /usr/local/etc/php-fpm.d/www.conf.default \ && cat .dev/docker/supervisord.conf > /etc/supervisord.conf \ && echo "* * * * * /usr/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \ && sed -i s/ssl_session_cache/#ssl_session_cache/g /etc/nginx/nginx.conf \ @@ -33,4 +33,4 @@ EXPOSE 80 443 ENTRYPOINT ["/bin/ash", ".dev/docker/entrypoint.sh"] -CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] +CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] \ No newline at end of file diff --git a/docker-compose.example.yml b/docker-compose.example.yml index eb1bfaddf..7f6d4ea1b 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -1,7 +1,7 @@ version: '2' services: database: - image: mariadb + image: mariadb:10.4 volumes: - "/srv/pterodactyl/database:/var/lib/mysql" environment: @@ -68,7 +68,7 @@ services: - "MAIL_PASSWORD=''" - "MAIL_ENCRYPTION=true" ## certbot settings - Used to automatically generate ssl certs and - - "LE_EMAIL=''" ## leave blank unless you aree generating certs. + # - "LE_EMAIL=" ## uncomment if you are using ssl networks: default: From 656d306e24484be4d50d94f345d710e6c61b1ffe Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Sat, 11 Apr 2020 21:11:21 -0400 Subject: [PATCH 5/8] update docker stuff --- .dev/docker/default_ssl.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.dev/docker/default_ssl.conf b/.dev/docker/default_ssl.conf index c2c2b6df0..9ec5c10db 100644 --- a/.dev/docker/default_ssl.conf +++ b/.dev/docker/default_ssl.conf @@ -1,4 +1,4 @@ -# If using Ubuntu this file should be placed in: +# If using Ubuntu this file should be placed in: # /etc/nginx/sites-available/ # server { @@ -49,7 +49,7 @@ server { location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/var/run/php/php-fpm7.2.sock; + fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M"; From 61c2a491fcc8aa3a05452926aa65765b24d70570 Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Sat, 11 Apr 2020 21:48:22 -0400 Subject: [PATCH 6/8] add packages for yarn --- .dev/docker/entrypoint.sh | 5 +++++ Dockerfile | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.dev/docker/entrypoint.sh b/.dev/docker/entrypoint.sh index 403f3df14..d353b9a69 100644 --- a/.dev/docker/entrypoint.sh +++ b/.dev/docker/entrypoint.sh @@ -71,5 +71,10 @@ php artisan db:seed --force echo -e "Starting cron jobs." crond -L /var/log/crond -l 5 +## install yarn stuff +yarn install --production +yarn add cross-env +yarn run build:production + echo -e "Starting supervisord." exec "$@" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 76ad6b86f..5a1caabdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM php:7.4-fpm-alpine WORKDIR /app -RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot; \ +RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot yarn; \ docker-php-ext-install bcmath; \ docker-php-ext-install gd; \ docker-php-ext-install mbstring; \ From 05004a7a50aced710706ada574a3a5ffe7717447 Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Sun, 12 Apr 2020 16:02:48 -0400 Subject: [PATCH 7/8] move docker foler move docker folder from .dev/ update Dockerfile and entrypoint scripts to match --- Dockerfile | 8 ++++---- {.dev/docker => docker}/README.md | 0 {.dev/docker => docker}/default.conf | 0 {.dev/docker => docker}/default_ssl.conf | 0 {.dev/docker => docker}/entrypoint.sh | 4 ++-- {.dev/docker => docker}/supervisord.conf | 0 {.dev/docker => docker}/www.conf | 0 7 files changed, 6 insertions(+), 6 deletions(-) rename {.dev/docker => docker}/README.md (100%) rename {.dev/docker => docker}/default.conf (100%) rename {.dev/docker => docker}/default_ssl.conf (100%) rename {.dev/docker => docker}/entrypoint.sh (94%) rename {.dev/docker => docker}/supervisord.conf (100%) rename {.dev/docker => docker}/www.conf (100%) diff --git a/Dockerfile b/Dockerfile index 5a1caabdb..0525e5b39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,16 +21,16 @@ RUN cp .env.example .env \ && rm .env \ && chown -R nginx:nginx . && chmod -R 777 storage/* bootstrap/cache -RUN cp .dev/docker/default.conf /etc/nginx/conf.d/default.conf \ - && cat .dev/docker/www.conf > /usr/local/etc/php-fpm.d/www.conf \ +RUN cp docker/default.conf /etc/nginx/conf.d/default.conf \ + && cat docker/www.conf > /usr/local/etc/php-fpm.d/www.conf \ && rm /usr/local/etc/php-fpm.d/www.conf.default \ - && cat .dev/docker/supervisord.conf > /etc/supervisord.conf \ + && cat docker/supervisord.conf > /etc/supervisord.conf \ && echo "* * * * * /usr/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \ && sed -i s/ssl_session_cache/#ssl_session_cache/g /etc/nginx/nginx.conf \ && mkdir -p /var/run/php /var/run/nginx EXPOSE 80 443 -ENTRYPOINT ["/bin/ash", ".dev/docker/entrypoint.sh"] +ENTRYPOINT ["/bin/ash", "docker/entrypoint.sh"] CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] \ No newline at end of file diff --git a/.dev/docker/README.md b/docker/README.md similarity index 100% rename from .dev/docker/README.md rename to docker/README.md diff --git a/.dev/docker/default.conf b/docker/default.conf similarity index 100% rename from .dev/docker/default.conf rename to docker/default.conf diff --git a/.dev/docker/default_ssl.conf b/docker/default_ssl.conf similarity index 100% rename from .dev/docker/default_ssl.conf rename to docker/default_ssl.conf diff --git a/.dev/docker/entrypoint.sh b/docker/entrypoint.sh similarity index 94% rename from .dev/docker/entrypoint.sh rename to docker/entrypoint.sh index d353b9a69..84cf19576 100644 --- a/.dev/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -41,10 +41,10 @@ else echo "Checking if letsencrypt email is set." if [ -z $LE_EMAIL ]; then echo "No letsencrypt email is set using http config." - cp .dev/docker/default.conf /etc/nginx/conf.d/default.conf + cp docker/default.conf /etc/nginx/conf.d/default.conf else echo "writing ssl config" - cp .dev/docker/default_ssl.conf /etc/nginx/conf.d/default.conf + cp docker/default_ssl.conf /etc/nginx/conf.d/default.conf echo "updating ssl config for domain" sed -i "s||$(echo $APP_URL | sed 's~http[s]*://~~g')|g" /etc/nginx/conf.d/default.conf echo "generating certs" diff --git a/.dev/docker/supervisord.conf b/docker/supervisord.conf similarity index 100% rename from .dev/docker/supervisord.conf rename to docker/supervisord.conf diff --git a/.dev/docker/www.conf b/docker/www.conf similarity index 100% rename from .dev/docker/www.conf rename to docker/www.conf From de4543c79acdef1c522a6e17e0225f39238e340e Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Sun, 12 Apr 2020 16:09:09 -0400 Subject: [PATCH 8/8] remove vagrant files --- .dev/vagrant/.env.vagrant | 39 ------- .dev/vagrant/mailhog.service | 13 --- .dev/vagrant/mariadb.cnf | 189 ---------------------------------- .dev/vagrant/motd.txt | 17 --- .dev/vagrant/provision.sh | 90 ---------------- .dev/vagrant/pterodactyl.conf | 51 --------- .dev/vagrant/pteroq.service | 20 ---- .dev/vagrant/xdebug.ini | 10 -- 8 files changed, 429 deletions(-) delete mode 100644 .dev/vagrant/.env.vagrant delete mode 100644 .dev/vagrant/mailhog.service delete mode 100644 .dev/vagrant/mariadb.cnf delete mode 100644 .dev/vagrant/motd.txt delete mode 100644 .dev/vagrant/provision.sh delete mode 100644 .dev/vagrant/pterodactyl.conf delete mode 100644 .dev/vagrant/pteroq.service delete mode 100644 .dev/vagrant/xdebug.ini diff --git a/.dev/vagrant/.env.vagrant b/.dev/vagrant/.env.vagrant deleted file mode 100644 index 2427ec04e..000000000 --- a/.dev/vagrant/.env.vagrant +++ /dev/null @@ -1,39 +0,0 @@ -APP_ENV=develop -APP_DEBUG=true -APP_KEY=SomeRandomString3232RandomString -APP_THEME=pterodactyl -APP_TIMEZONE=UTC -APP_CLEAR_TASKLOG=720 -APP_DELETE_MINUTES=10 -APP_URL=http://192.168.50.2/ - -DB_HOST=localhost -DB_PORT=3306 -DB_DATABASE=panel -DB_USERNAME=pterodactyl -DB_PASSWORD=pterodactyl - -CACHE_DRIVER=memcached -MEMCACHED_HOST=127.0.0.1 -SESSION_DRIVER=database - -MAIL_DRIVER=smtp -MAIL_HOST=127.0.0.1 -MAIL_PORT=1025 -MAIL_USERNAME= -MAIL_PASSWORD= -MAIL_ENCRYPTION= -MAIL_FROM=support@pterodactyl.io - -API_PREFIX=api -API_VERSION=v1 -API_DEBUG=true - -QUEUE_DRIVER=database -QUEUE_HIGH=high -QUEUE_STANDARD=standard -QUEUE_LOW=low - -SQS_KEY=aws-public -SQS_SECRET=aws-secret -SQS_QUEUE_PREFIX=aws-queue-prefix diff --git a/.dev/vagrant/mailhog.service b/.dev/vagrant/mailhog.service deleted file mode 100644 index 01334183d..000000000 --- a/.dev/vagrant/mailhog.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Mailhog - -[Service] -# On some systems the user and group might be different. -# Some systems use `apache` as the user and group. -User=www-data -Group=www-data -Restart=on-failure -ExecStart=/usr/bin/mailhog - -[Install] -WantedBy=multi-user.target diff --git a/.dev/vagrant/mariadb.cnf b/.dev/vagrant/mariadb.cnf deleted file mode 100644 index 48b31ed8b..000000000 --- a/.dev/vagrant/mariadb.cnf +++ /dev/null @@ -1,189 +0,0 @@ -# MariaDB database server configuration file. -# -# You can copy this file to one of: -# - "/etc/mysql/my.cnf" to set global options, -# - "~/.my.cnf" to set user-specific options. -# -# One can use all long options that the program supports. -# Run program with --help to get a list of available options and with -# --print-defaults to see which it would actually understand and use. -# -# For explanations see -# http://dev.mysql.com/doc/mysql/en/server-system-variables.html - -# This will be passed to all mysql clients -# It has been reported that passwords should be enclosed with ticks/quotes -# escpecially if they contain "#" chars... -# Remember to edit /etc/mysql/debian.cnf when changing the socket location. -[client] -port = 3306 -socket = /var/run/mysqld/mysqld.sock - -# Here is entries for some specific programs -# The following values assume you have at least 32M ram - -# This was formally known as [safe_mysqld]. Both versions are currently parsed. -[mysqld_safe] -socket = /var/run/mysqld/mysqld.sock -nice = 0 - -[mysqld] -# -# * Basic Settings -# -user = mysql -pid-file = /var/run/mysqld/mysqld.pid -socket = /var/run/mysqld/mysqld.sock -port = 3306 -basedir = /usr -datadir = /var/lib/mysql -tmpdir = /tmp -lc_messages_dir = /usr/share/mysql -lc_messages = en_US -skip-external-locking -# -# Instead of skip-networking the default is now to listen only on -# localhost which is more compatible and is not less secure. -bind-address = 0.0.0.0 -# -# * Fine Tuning -# -max_connections = 100 -connect_timeout = 5 -wait_timeout = 600 -max_allowed_packet = 16M -thread_cache_size = 128 -sort_buffer_size = 4M -bulk_insert_buffer_size = 16M -tmp_table_size = 32M -max_heap_table_size = 32M -# -# * MyISAM -# -# This replaces the startup script and checks MyISAM tables if needed -# the first time they are touched. On error, make copy and try a repair. -myisam_recover_options = BACKUP -key_buffer_size = 128M -#open-files-limit = 2000 -table_open_cache = 400 -myisam_sort_buffer_size = 512M -concurrent_insert = 2 -read_buffer_size = 2M -read_rnd_buffer_size = 1M -# -# * Query Cache Configuration -# -# Cache only tiny result sets, so we can fit more in the query cache. -query_cache_limit = 128K -query_cache_size = 64M -# for more write intensive setups, set to DEMAND or OFF -#query_cache_type = DEMAND -# -# * Logging and Replication -# -# Both location gets rotated by the cronjob. -# Be aware that this log type is a performance killer. -# As of 5.1 you can enable the log at runtime! -#general_log_file = /var/log/mysql/mysql.log -#general_log = 1 -# -# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf. -# -# we do want to know about network errors and such -log_warnings = 2 -# -# Enable the slow query log to see queries with especially long duration -#slow_query_log[={0|1}] -slow_query_log_file = /var/log/mysql/mariadb-slow.log -long_query_time = 10 -#log_slow_rate_limit = 1000 -log_slow_verbosity = query_plan - -#log-queries-not-using-indexes -#log_slow_admin_statements -# -# The following can be used as easy to replay backup logs or for replication. -# note: if you are setting up a replication slave, see README.Debian about -# other settings you may need to change. -#server-id = 1 -#report_host = master1 -#auto_increment_increment = 2 -#auto_increment_offset = 1 -log_bin = /var/log/mysql/mariadb-bin -log_bin_index = /var/log/mysql/mariadb-bin.index -# not fab for performance, but safer -#sync_binlog = 1 -expire_logs_days = 10 -max_binlog_size = 100M -# slaves -#relay_log = /var/log/mysql/relay-bin -#relay_log_index = /var/log/mysql/relay-bin.index -#relay_log_info_file = /var/log/mysql/relay-bin.info -#log_slave_updates -#read_only -# -# If applications support it, this stricter sql_mode prevents some -# mistakes like inserting invalid dates etc. -#sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL -# -# * InnoDB -# -# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. -# Read the manual for more InnoDB related options. There are many! -default_storage_engine = InnoDB -# you can't just change log file size, requires special procedure -#innodb_log_file_size = 50M -innodb_buffer_pool_size = 256M -innodb_log_buffer_size = 8M -innodb_file_per_table = 1 -innodb_open_files = 400 -innodb_io_capacity = 400 -innodb_flush_method = O_DIRECT -# -# * Security Features -# -# Read the manual, too, if you want chroot! -# chroot = /var/lib/mysql/ -# -# For generating SSL certificates I recommend the OpenSSL GUI "tinyca". -# -# ssl-ca=/etc/mysql/cacert.pem -# ssl-cert=/etc/mysql/server-cert.pem -# ssl-key=/etc/mysql/server-key.pem - -# -# * Galera-related settings -# -[galera] -# Mandatory settings -#wsrep_on=ON -#wsrep_provider= -#wsrep_cluster_address= -#binlog_format=row -#default_storage_engine=InnoDB -#innodb_autoinc_lock_mode=2 -# -# Allow server to accept connections on all interfaces. -# -#bind-address=0.0.0.0 -# -# Optional setting -#wsrep_slave_threads=1 -#innodb_flush_log_at_trx_commit=0 - -[mysqldump] -quick -quote-names -max_allowed_packet = 16M - -[mysql] -#no-auto-rehash # faster start of mysql but no tab completion - -[isamchk] -key_buffer = 16M - -# -# * IMPORTANT: Additional settings that can override those from this file! -# The files must end with '.cnf', otherwise they'll be ignored. -# -!includedir /etc/mysql/conf.d/ diff --git a/.dev/vagrant/motd.txt b/.dev/vagrant/motd.txt deleted file mode 100644 index 22089d55a..000000000 --- a/.dev/vagrant/motd.txt +++ /dev/null @@ -1,17 +0,0 @@ -##################################################### - Pterodactyl Panel Vagrant VM - -Install: /var/www/html/pterodactyl -Ports: - Panel: 80 (50080 on host) - MailHog: 8025 (58025 on host) - MySQL: 3306 (53306 on host) - -Default panel users: - user: admin passwd: Ptero123 (admin user) - user: user passwd: Ptero123 (standard user) - -MySQL is accessible using root/pterodactyl or pterodactyl/pterodactyl - -Service for pteroq and mailhog are running -##################################################### diff --git a/.dev/vagrant/provision.sh b/.dev/vagrant/provision.sh deleted file mode 100644 index 35a2219f0..000000000 --- a/.dev/vagrant/provision.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -echo "Provisioning development environment for Pterodactyl Panel." -cp /var/www/html/pterodactyl/.dev/vagrant/motd.txt /etc/motd -chmod -x /etc/update-motd.d/10-help-text /etc/update-motd.d/51-cloudguest - -apt-get install -y software-properties-common > /dev/null - -echo "Add the ondrej/php ppa repository" -add-apt-repository -y ppa:ondrej/php > /dev/null -echo "Add the mariadb repository" -curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash > /dev/null - -apt-get update > /dev/null - -echo "Install the dependencies" -export DEBIAN_FRONTEND=noninteractive -# set the mariadb root password because mariadb asks for it -debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password password pterodactyl' -debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password_again password pterodactyl' -# actually install -apt-get install -y php7.2 php7.2-cli php7.2-gd php7.2-mysql php7.2-pdo php7.2-mbstring php7.2-tokenizer php7.2-bcmath php7.2-xml php7.2-fpm php7.2-memcached php7.2-curl php7.2-zip php-xdebug mariadb-server nginx curl tar unzip git memcached > /dev/null - -echo "Install nodejs and yarn" -curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - -echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list -curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - -apt-get -y install nodejs yarn > /dev/null - -echo "Install composer" -curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - -echo "Install and run mailhog" -curl -sL -o /usr/bin/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64 -chmod +x /usr/bin/mailhog -cp /var/www/html/pterodactyl/.dev/vagrant/mailhog.service /etc/systemd/system/ -systemctl enable mailhog.service -systemctl start mailhog - -echo "Configure xDebug" -cp /var/www/html/pterodactyl/.dev/vagrant/xdebug.ini /etc/php/7.2/mods-available/ -systemctl restart php7.2-fpm - -echo "Configure nginx" -cp /var/www/html/pterodactyl/.dev/vagrant/pterodactyl.conf /etc/nginx/sites-available/ -rm /etc/nginx/sites-available/default -ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/pterodactyl.conf -systemctl restart nginx - -echo "Setup database" -# Replace default config with custom one to bind mysql to 0.0.0.0 to make it accessible from the host -cp /var/www/html/pterodactyl/.dev/vagrant/mariadb.cnf /etc/mysql/my.cnf -systemctl restart mariadb -mysql -u root -ppterodactyl << SQL -CREATE DATABASE panel; -GRANT ALL PRIVILEGES ON panel.* TO 'pterodactyl'@'%' IDENTIFIED BY 'pterodactyl' WITH GRANT OPTION; -GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'pterodactyl' WITH GRANT OPTION; -FLUSH PRIVILEGES; -SQL - -echo "Setup pterodactyl queue worker service" -cp /var/www/html/pterodactyl/.dev/vagrant/pteroq.service /etc/systemd/system/ -systemctl enable pteroq.service - - -echo "Setup panel with base settings" -cp /var/www/html/pterodactyl/.dev/vagrant/.env.vagrant /var/www/html/pterodactyl/.env -cd /var/www/html/pterodactyl -chmod -R 755 storage/* bootstrap/cache -composer install --no-progress -php artisan key:generate --force -php artisan migrate -php artisan db:seed -php artisan p:user:make --name-first Test --name-last Admin --username admin --email testadmin@pterodactyl.io --password Ptero123 --admin 1 -php artisan p:user:make --name-first Test --name-last User --username user --email testuser@pterodactyl.io --password Ptero123 --admin 0 - -echo "Add queue cronjob and start queue worker" -(crontab -l 2>/dev/null; echo "* * * * * php /var/www/html/pterodactyl/artisan schedule:run >> /dev/null 2>&1") | crontab - -systemctl start pteroq - -echo " ----------------" -echo "Provisioning is completed." -echo "The panel should be available at http://localhost:50080/" -echo "You may use the default admin user to login: admin/Ptero123" -echo "A normal user has also been created: user/Ptero123" -echo "MailHog is available at http://localhost:58025/" -echo "Connect to the database using root/pterodactyl or pterodactyl/pterodactyl on localhost:53306" -echo "If you want to access the panel using http://pterodactyl.app you can use the vagrant-dns plugin" -echo "Install it with 'vagrant plugin install vagrant-dns', then run 'vagrant dns --install' once" -echo "On first use you'll have to manually start vagrant-dns with 'vagrant dns --start'" diff --git a/.dev/vagrant/pterodactyl.conf b/.dev/vagrant/pterodactyl.conf deleted file mode 100644 index 343cbad5f..000000000 --- a/.dev/vagrant/pterodactyl.conf +++ /dev/null @@ -1,51 +0,0 @@ -# If using Ubuntu this file should be placed in: -# /etc/nginx/sites-available/ -# -# If using CentOS this file should be placed in: -# /etc/nginx/conf.d/ -# -server { - listen 80; - server_name 0.0.0.0; - - root /var/www/html/pterodactyl/public; - index index.html index.htm index.php; - charset utf-8; - - 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/pterodactyl.app-error.log error; - - # allow larger file uploads and longer script runtimes - client_max_body_size 100m; - client_body_timeout 120s; - - sendfile off; - - location ~ \.php$ { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - # the fastcgi_pass path needs to be changed accordingly when using CentOS - fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; - fastcgi_index index.php; - include fastcgi_params; - 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; - } - - location ~ /\.ht { - deny all; - } -} diff --git a/.dev/vagrant/pteroq.service b/.dev/vagrant/pteroq.service deleted file mode 100644 index 7828ee91b..000000000 --- a/.dev/vagrant/pteroq.service +++ /dev/null @@ -1,20 +0,0 @@ -# Pterodactyl Queue Worker File -# ---------------------------------- -# File should be placed in: -# /etc/systemd/system -# -# nano /etc/systemd/system/pteroq.service - -[Unit] -Description=Pterodactyl Queue Worker - -[Service] -# On some systems the user and group might be different. -# Some systems use `apache` as the user and group. -User=www-data -Group=www-data -Restart=on-failure -ExecStart=/usr/bin/php /var/www/html/pterodactyl/artisan queue:work database --queue=high,standard,low --sleep=3 --tries=3 - -[Install] -WantedBy=multi-user.target diff --git a/.dev/vagrant/xdebug.ini b/.dev/vagrant/xdebug.ini deleted file mode 100644 index 1725b8e84..000000000 --- a/.dev/vagrant/xdebug.ini +++ /dev/null @@ -1,10 +0,0 @@ -zend_extension=xdebug.so - -xdebug.remote_enable=1 -xdebug.remote_connect_back=1 -xdebug.remote_port=9000 -xdebug.scream=0 -xdebug.show_local_vars=1 -xdebug.idekey=PHPSTORM - -xdebug.remote_log=/tmp/xdebug.log \ No newline at end of file