From 1995c2425e8de43615cab8bf327677feb7f7591d Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Sat, 11 Apr 2020 21:01:42 -0400 Subject: [PATCH 1/3] 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 0944bf79..b6105e5f 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 c2b58375..403f3df1 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 f2fd3a1b..da6823ae 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 88142564..c0c17903 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 54ea1d76..76ad6b86 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 eb1bfadd..7f6d4ea1 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/3] 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 0944bf79..b6105e5f 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 c2c2b6df..9ec5c10d 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 c2b58375..403f3df1 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 f2fd3a1b..da6823ae 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 88142564..c0c17903 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 54ea1d76..76ad6b86 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 eb1bfadd..7f6d4ea1 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/3] 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 403f3df1..d353b9a6 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 76ad6b86..5a1caabd 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; \