From 508e1c96458472b49145487e6ce04ae6dee248fe Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Sun, 2 Jun 2024 21:57:23 -0400 Subject: [PATCH 01/27] Add some docker --- .dockerignore | 9 ++++ .env.docker | 6 +++ .github/docker/entrypoint.sh | 79 ++++++------------------------------ Caddyfile | 7 ++++ better.Dockerfile | 64 +++++++++++++++++++++++++++++ composer.json | 1 - composer.lock | 1 - 7 files changed, 98 insertions(+), 69 deletions(-) create mode 100644 .dockerignore create mode 100644 .env.docker create mode 100644 Caddyfile create mode 100644 better.Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..4110ddf9c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.git +node_modules +vendor +storage/debugbar/*.json +storage/logs/*.log +storage/framework/cache/data/* +storage/framework/sessions/* +storage/framework/testing +storage/framework/views/*.php diff --git a/.env.docker b/.env.docker new file mode 100644 index 000000000..485b23d45 --- /dev/null +++ b/.env.docker @@ -0,0 +1,6 @@ +APP_ENV=production +APP_DEBUG=true +APP_KEY= +APP_URL=http://panel.test + +SESSION_DRIVER=file diff --git a/.github/docker/entrypoint.sh b/.github/docker/entrypoint.sh index 7f4de80cd..27e146303 100644 --- a/.github/docker/entrypoint.sh +++ b/.github/docker/entrypoint.sh @@ -1,77 +1,22 @@ #!/bin/ash -e -cd /app -mkdir -p /var/log/panel/logs/ /var/log/supervisord/ /var/log/nginx/ /var/log/php8/ \ - && chmod 777 /var/log/panel/logs/ \ - && ln -s /app/storage/logs/ /var/log/panel/ +#mkdir -p /var/log/supervisord/ /var/log/php8/ \ -## check for .env file and generate app keys if missing -if [ -f /app/var/.env ]; then - echo "external vars exist." - rm -rf /app/.env - ln -s /app/var/.env /app/ +cd /var/www/html + +#chmod -R 775 storage/* bootstrap/cache/ +#chown -R caddy:caddy . + +if ! grep -q "APP_KEY=" .env || grep -q "APP_KEY=$" .env; then + echo "Generating APP_KEY..." + php artisan key:generate --force else - echo "external vars don't exist." - rm -rf /app/.env - touch /app/var/.env - - ## manually generate a key because key generate --force fails - if [ -z $APP_KEY ]; then - echo -e "Generating key." - APP_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) - echo -e "Generated app key: $APP_KEY" - echo -e "APP_KEY=$APP_KEY" > /app/var/.env - else - echo -e "APP_KEY exists in environment, using that." - echo -e "APP_KEY=$APP_KEY" > /app/var/.env - fi - - ln -s /app/var/.env /app/ + echo "APP_KEY is already set." fi -echo "Checking if https is required." -if [ -f /etc/nginx/http.d/panel.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 using http config." - cp .github/docker/default.conf /etc/nginx/http.d/panel.conf - else - echo "writing ssl config" - cp .github/docker/default_ssl.conf /etc/nginx/http.d/panel.conf - echo "updating ssl config for domain" - sed -i "s||$(echo $APP_URL | sed 's~http[s]*://~~g')|g" /etc/nginx/http.d/panel.conf - echo "generating certs" - certbot certonly -d $(echo $APP_URL | sed 's~http[s]*://~~g') --standalone -m $LE_EMAIL --agree-tos -n - fi - echo "Removing the default nginx config" - rm -rf /etc/nginx/http.d/default.conf -fi - -if [[ -z $DB_PORT ]]; then - echo -e "DB_PORT not specified, defaulting to 3306" - DB_PORT=3306 -fi - -## check for DB up before starting the panel -echo "Checking database status." -until nc -z -v -w30 $DB_HOST $DB_PORT -do - echo "Waiting for database connection..." - # wait for 1 seconds before check again - sleep 1 -done - ## make sure the db is set up -echo -e "Migrating and Seeding D.B" -php artisan migrate --seed --force +echo -e "Migrating and Seeding Database" +php artisan migrate --force ## start cronjobs for the queue echo -e "Starting cron jobs." diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 000000000..fb8d83eae --- /dev/null +++ b/Caddyfile @@ -0,0 +1,7 @@ +:80 { + root * /var/www/html/public + encode gzip + + php_fastcgi 127.0.0.1:9000 + file_server +} diff --git a/better.Dockerfile b/better.Dockerfile new file mode 100644 index 000000000..53a45d306 --- /dev/null +++ b/better.Dockerfile @@ -0,0 +1,64 @@ +# Pelican Production Dockerfile + +FROM node:20-alpine AS yarn +WORKDIR /app + +#FROM --platform=$TARGETOS/$TARGETARCH node:20-alpine AS yarn + +COPY . ./ + +RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --frozen-lockfile && yarn run build:production + +FROM php:8.3-fpm-alpine +# FROM --platform=$TARGETOS/$TARGETARCH php:8.3-fpm-alpine + +COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer + +# Set working directory +WORKDIR /var/www/html + +# Install dependencies +RUN apk update && apk add --no-cache \ + libpng-dev \ + libjpeg-turbo-dev \ + freetype-dev \ + libzip-dev \ + icu-dev \ + zip \ + unzip \ + caddy \ + #&& docker-php-ext-configure zip \ + #&& docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install bcmath gd intl zip opcache pcntl posix + +# ca-certificates dcron curl git supervisor tar libxml2-dev + +# Copy the Caddyfile to the container +COPY Caddyfile /etc/caddy/Caddyfile + +# Copy the application code to the container +COPY . . + +COPY --from=yarn /app/public/assets ./public/assets + +RUN cp .env.docker .env + +RUN composer install --no-dev --optimize-autoloader + +# Set file permissions +RUN chown -R www-data:www-data /var/www/html \ + && chmod -R 755 /var/www/html/storage \ + && chmod -R 755 /var/www/html/bootstrap/cache + +#RUN rm /usr/local/etc/php-fpm.conf \ +# && echo "* * * * * /usr/local/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \ +# && mkdir -p /var/run/php + +EXPOSE 80 +EXPOSE 443 + +# Start PHP-FPM +CMD ["sh", "-c", "php-fpm & caddy run --config /etc/caddy/Caddyfile --adapter caddyfile"] + +ENTRYPOINT [ "/bin/ash", ".github/docker/entrypoint.sh" ] +# CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] diff --git a/composer.json b/composer.json index 7e8ac8a0c..8907db6e7 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,6 @@ "ext-json": "*", "ext-mbstring": "*", "ext-pdo": "*", - "ext-pdo_mysql": "*", "ext-zip": "*", "abdelhamiderrahmouni/filament-monaco-editor": "0.2.1", "aws/aws-sdk-php": "~3.288.1", diff --git a/composer.lock b/composer.lock index c8e3fa55a..79bdc5db9 100644 --- a/composer.lock +++ b/composer.lock @@ -13554,7 +13554,6 @@ "ext-json": "*", "ext-mbstring": "*", "ext-pdo": "*", - "ext-pdo_mysql": "*", "ext-zip": "*" }, "platform-dev": [], From 6b706de23d9c72f2228e56d37734d3aa92cbed50 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Tue, 11 Jun 2024 18:36:47 -0400 Subject: [PATCH 02/27] =?UTF-8?q?Don=E2=80=99t=20include=20this?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.dockerignore b/.dockerignore index 4110ddf9c..0af94525e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,7 @@ .git node_modules vendor +database/database.sqlite storage/debugbar/*.json storage/logs/*.log storage/framework/cache/data/* From 478948c81b8ee2c99259adad2514d003e3696478 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Tue, 11 Jun 2024 19:17:23 -0400 Subject: [PATCH 03/27] Use variables --- Caddyfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Caddyfile b/Caddyfile index fb8d83eae..1c835bf05 100644 --- a/Caddyfile +++ b/Caddyfile @@ -1,4 +1,8 @@ -:80 { +{ + email {$ADMIN_EMAIL} +} + +{$APP_URL} { root * /var/www/html/public encode gzip From 17c0041bfda0a9953564a2f6b37b7c2236a5ddf7 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Tue, 11 Jun 2024 19:17:44 -0400 Subject: [PATCH 04/27] Already have defaults --- .env.docker | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.env.docker b/.env.docker index 485b23d45..58f5da060 100644 --- a/.env.docker +++ b/.env.docker @@ -1,6 +1,3 @@ -APP_ENV=production -APP_DEBUG=true APP_KEY= -APP_URL=http://panel.test -SESSION_DRIVER=file +DB_DATABASE=docker/database.sqlite From b6e55795c12fc5f6e0f027e6a4216ef2e3bf7de5 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Tue, 11 Jun 2024 19:17:48 -0400 Subject: [PATCH 05/27] Docker --- .github/docker/entrypoint.sh | 29 +++++++++++++++++-- better.Dockerfile | 38 ++++++++++--------------- compose.yml | 54 ++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 26 deletions(-) create mode 100644 compose.yml diff --git a/.github/docker/entrypoint.sh b/.github/docker/entrypoint.sh index 27e146303..d3b891de6 100644 --- a/.github/docker/entrypoint.sh +++ b/.github/docker/entrypoint.sh @@ -2,10 +2,30 @@ #mkdir -p /var/log/supervisord/ /var/log/php8/ \ -cd /var/www/html +## check for .env file and generate app keys if missing +if [ -f /pelican-data/.env ]; then + echo "external vars exist." + rm -rf /var/www/html/.env +else + echo "external vars don't exist." + rm -rf /var/www/html/.env + touch /pelican-data/.env -#chmod -R 775 storage/* bootstrap/cache/ -#chown -R caddy:caddy . + ## manually generate a key because key generate --force fails + if [ -z $APP_KEY ]; then + echo -e "Generating key." + APP_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) + echo -e "Generated app key: $APP_KEY" + echo -e "APP_KEY=$APP_KEY" > /pelican-data/.env + else + echo -e "APP_KEY exists in environment, using that." + echo -e "APP_KEY=$APP_KEY" > /pelican-data/.env + fi +fi + +ln -s /pelican-data/.env /var/www/html/ + +touch /pelican-data/database.sqlite if ! grep -q "APP_KEY=" .env || grep -q "APP_KEY=$" .env; then echo "Generating APP_KEY..." @@ -22,5 +42,8 @@ php artisan migrate --force echo -e "Starting cron jobs." crond -L /var/log/crond -l 5 +#chmod -R 755 storage/* bootstrap/cache/ +chown -R www-data:www-data . + echo -e "Starting supervisord." exec "$@" diff --git a/better.Dockerfile b/better.Dockerfile index 53a45d306..57d388812 100644 --- a/better.Dockerfile +++ b/better.Dockerfile @@ -1,62 +1,54 @@ # Pelican Production Dockerfile FROM node:20-alpine AS yarn -WORKDIR /app - #FROM --platform=$TARGETOS/$TARGETARCH node:20-alpine AS yarn +WORKDIR /build + COPY . ./ -RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --frozen-lockfile && yarn run build:production +RUN yarn install --frozen-lockfile && yarn run build:production FROM php:8.3-fpm-alpine # FROM --platform=$TARGETOS/$TARGETARCH php:8.3-fpm-alpine COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer -# Set working directory WORKDIR /var/www/html # Install dependencies RUN apk update && apk add --no-cache \ - libpng-dev \ - libjpeg-turbo-dev \ - freetype-dev \ - libzip-dev \ - icu-dev \ - zip \ - unzip \ - caddy \ - #&& docker-php-ext-configure zip \ - #&& docker-php-ext-configure gd --with-freetype --with-jpeg \ + libpng-dev libjpeg-turbo-dev freetype-dev libzip-dev icu-dev \ + zip unzip curl \ + caddy ca-certificates supervisor \ && docker-php-ext-install bcmath gd intl zip opcache pcntl posix -# ca-certificates dcron curl git supervisor tar libxml2-dev - # Copy the Caddyfile to the container COPY Caddyfile /etc/caddy/Caddyfile # Copy the application code to the container COPY . . -COPY --from=yarn /app/public/assets ./public/assets +COPY --from=yarn /build/public/assets ./public/assets RUN cp .env.docker .env RUN composer install --no-dev --optimize-autoloader # Set file permissions -RUN chown -R www-data:www-data /var/www/html \ - && chmod -R 755 /var/www/html/storage \ +RUN chmod -R 755 /var/www/html/storage \ && chmod -R 755 /var/www/html/bootstrap/cache -#RUN rm /usr/local/etc/php-fpm.conf \ -# && echo "* * * * * /usr/local/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \ -# && mkdir -p /var/run/php +#echo "* * * * * /usr/local/bin/php /build/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root -EXPOSE 80 +HEALTHCHECK --interval=5m --timeout=10s --start-period=5s --retries=3 \ + CMD curl -f http://localhost/up || exit 1 + +EXPOSE 80:2019 EXPOSE 443 +VOLUME /pelican-data + # Start PHP-FPM CMD ["sh", "-c", "php-fpm & caddy run --config /etc/caddy/Caddyfile --adapter caddyfile"] diff --git a/compose.yml b/compose.yml new file mode 100644 index 000000000..12ae387ad --- /dev/null +++ b/compose.yml @@ -0,0 +1,54 @@ +x-common: + panel: + &panel-environment + APP_URL: "https://localhost" + # A list of valid timezones can be found here: http://php.net/manual/en/timezones.php + APP_TIMEZONE: "UTC" + APP_SERVICE_AUTHOR: "pelican@example.com" + # Uncomment the line below and set to a non-empty value if you want to use Let's Encrypt + # to generate an SSL certificate for the Panel. + ADMIN_EMAIL: "pelican@example.com" + mail: + &mail-environment + MAIL_DRIVER: "log" + # MAIL_HOST: "" + # MAIL_PORT: "" + # MAIL_FROM: "" + # MAIL_USERNAME: "" + # MAIL_PASSWORD: "" + # MAIL_ENCRYPTION: "" + +# +# ------------------------------------------------------------------------------------------ +# DANGER ZONE BELOW +# +# The remainder of this file likely does not need to be changed. Please only make modifications +# below if you understand what you are doing. +# + +services: + panel: + image: panel + restart: always + ports: + - "80:2019" + - "443:443" + extra_hosts: + - "host.docker.internal:host-gateway" + volumes: + - pelican-data:/pelican-data + environment: + <<: [*panel-environment, *mail-environment] +# APP_ENV: "production" +# APP_DEBUG: "false" +# APP_ENVIRONMENT_ONLY: "false" +# SESSION_DRIVER: "file" + +volumes: + pelican-data: + +networks: + default: + ipam: + config: + - subnet: 172.20.0.0/16 From f7cb42e008727f7d1a3fe6d52878167b0ea92929 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Tue, 11 Jun 2024 19:18:51 -0400 Subject: [PATCH 06/27] Remove old one --- Dockerfile | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ef134d55b..000000000 --- a/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -# Stage 0: -# Build the assets that are needed for the frontend. This build stage is then discarded -# since we won't need NodeJS anymore in the future. This Docker image ships a final production -# level distribution -FROM --platform=$TARGETOS/$TARGETARCH node:20-alpine -WORKDIR /app -COPY . ./ -RUN yarn install --frozen-lockfile \ - && yarn run build:production - -# Stage 1: -# Build the actual container with all of the needed PHP dependencies that will run the application. -FROM --platform=$TARGETOS/$TARGETARCH php:8.3-fpm-alpine -WORKDIR /app -COPY . ./ -COPY --from=0 /app/public/assets ./public/assets -RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev icu-dev certbot certbot-nginx \ - && docker-php-ext-configure zip \ - && docker-php-ext-install bcmath gd intl pdo_mysql zip \ - && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ - && cp .env.example .env \ - && mkdir -p bootstrap/cache/ storage/logs storage/framework/sessions storage/framework/views storage/framework/cache \ - && chmod 777 -R bootstrap storage \ - && composer install --no-dev --optimize-autoloader \ - && rm -rf .env bootstrap/cache/*.php \ - && mkdir -p /app/storage/logs/ \ - && chown -R nginx:nginx . - -RUN rm /usr/local/etc/php-fpm.conf \ - && echo "* * * * * /usr/local/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \ - && echo "0 23 * * * certbot renew --nginx --quiet" >> /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 - -COPY .github/docker/default.conf /etc/nginx/http.d/default.conf -COPY .github/docker/www.conf /usr/local/etc/php-fpm.conf -COPY .github/docker/supervisord.conf /etc/supervisord.conf - -EXPOSE 80 443 -ENTRYPOINT [ "/bin/ash", ".github/docker/entrypoint.sh" ] -CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] From 3401703ccd0f32927b67504fa5cecde28f2806ef Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Tue, 11 Jun 2024 19:19:03 -0400 Subject: [PATCH 07/27] Use this one primarily --- better.Dockerfile => Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename better.Dockerfile => Dockerfile (100%) diff --git a/better.Dockerfile b/Dockerfile similarity index 100% rename from better.Dockerfile rename to Dockerfile From 1e841ac40dc486bbf45d15d506380db3db5b9c37 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Sun, 16 Jun 2024 13:20:20 -0400 Subject: [PATCH 08/27] Update variables --- compose.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/compose.yml b/compose.yml index 12ae387ad..4717b0f8e 100644 --- a/compose.yml +++ b/compose.yml @@ -2,12 +2,13 @@ x-common: panel: &panel-environment APP_URL: "https://localhost" - # A list of valid timezones can be found here: http://php.net/manual/en/timezones.php - APP_TIMEZONE: "UTC" - APP_SERVICE_AUTHOR: "pelican@example.com" - # Uncomment the line below and set to a non-empty value if you want to use Let's Encrypt - # to generate an SSL certificate for the Panel. - ADMIN_EMAIL: "pelican@example.com" + APP_DEBUG: "false" + ADMIN_EMAIL: "USEYOUROWNEMAILHERE@example.com" + + APP_ENVIRONMENT_ONLY: "false" + APP_ENV: "production" + SESSION_DRIVER: "file" + mail: &mail-environment MAIL_DRIVER: "log" @@ -39,10 +40,6 @@ services: - pelican-data:/pelican-data environment: <<: [*panel-environment, *mail-environment] -# APP_ENV: "production" -# APP_DEBUG: "false" -# APP_ENVIRONMENT_ONLY: "false" -# SESSION_DRIVER: "file" volumes: pelican-data: From 116175ba604c483ab142ce4f31e48d478ab90a4c Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Sun, 16 Jun 2024 13:20:35 -0400 Subject: [PATCH 09/27] Store caddy config and certs in a volume --- compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/compose.yml b/compose.yml index 4717b0f8e..7e67fbbd7 100644 --- a/compose.yml +++ b/compose.yml @@ -40,6 +40,7 @@ services: - pelican-data:/pelican-data environment: <<: [*panel-environment, *mail-environment] + XDG_DATA_HOME: /pelican-data volumes: pelican-data: From 7d0b9af21a084c8d2ff8bb94aa4570a3ebdd1b0d Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Sun, 16 Jun 2024 13:20:59 -0400 Subject: [PATCH 10/27] Add logs volume --- compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compose.yml b/compose.yml index 7e67fbbd7..c4737d755 100644 --- a/compose.yml +++ b/compose.yml @@ -38,12 +38,14 @@ services: - "host.docker.internal:host-gateway" volumes: - pelican-data:/pelican-data + - pelican-logs:/var/www/html/storage/logs environment: <<: [*panel-environment, *mail-environment] XDG_DATA_HOME: /pelican-data volumes: pelican-data: + pelican-logs: networks: default: From 6e998498e31e0d1e2d09ecfa67896eacfc0afaba Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Sun, 16 Jun 2024 14:08:24 -0400 Subject: [PATCH 11/27] Update composer --- composer.lock | 142 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 108 insertions(+), 34 deletions(-) diff --git a/composer.lock b/composer.lock index 79bdc5db9..0ab5ce4a1 100644 --- a/composer.lock +++ b/composer.lock @@ -745,16 +745,16 @@ }, { "name": "danharrin/date-format-converter", - "version": "v0.3.0", + "version": "v0.3.1", "source": { "type": "git", "url": "https://github.com/danharrin/date-format-converter.git", - "reference": "42b6ddc52059d4ba228a67c15adaaa0c039e75f2" + "reference": "7c31171bc981e48726729a5f3a05a2d2b63f0b1e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/danharrin/date-format-converter/zipball/42b6ddc52059d4ba228a67c15adaaa0c039e75f2", - "reference": "42b6ddc52059d4ba228a67c15adaaa0c039e75f2", + "url": "https://api.github.com/repos/danharrin/date-format-converter/zipball/7c31171bc981e48726729a5f3a05a2d2b63f0b1e", + "reference": "7c31171bc981e48726729a5f3a05a2d2b63f0b1e", "shasum": "" }, "require": { @@ -792,7 +792,7 @@ "type": "github" } ], - "time": "2022-09-29T07:48:20+00:00" + "time": "2024-06-13T09:38:44+00:00" }, { "name": "danharrin/livewire-rate-limiting", @@ -6293,16 +6293,16 @@ }, { "name": "psy/psysh", - "version": "v0.12.3", + "version": "v0.12.4", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73" + "reference": "2fd717afa05341b4f8152547f142cd2f130f6818" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73", - "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/2fd717afa05341b4f8152547f142cd2f130f6818", + "reference": "2fd717afa05341b4f8152547f142cd2f130f6818", "shasum": "" }, "require": { @@ -6366,9 +6366,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.12.3" + "source": "https://github.com/bobthecow/psysh/tree/v0.12.4" }, - "time": "2024-04-02T15:57:53+00:00" + "time": "2024-06-10T01:18:23+00:00" }, { "name": "ralouphie/getallheaders", @@ -11318,16 +11318,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -11335,11 +11335,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -11365,7 +11366,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -11373,7 +11374,7 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "nunomaduro/collision", @@ -12170,16 +12171,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.20", + "version": "10.5.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3" + "reference": "ac837816fa52078f7a5e17ed774f256a72a51af6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/547d314dc24ec1e177720d45c6263fb226cc2ae3", - "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ac837816fa52078f7a5e17ed774f256a72a51af6", + "reference": "ac837816fa52078f7a5e17ed774f256a72a51af6", "shasum": "" }, "require": { @@ -12251,7 +12252,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.21" }, "funding": [ { @@ -12267,7 +12268,7 @@ "type": "tidelift" } ], - "time": "2024-04-24T06:32:35+00:00" + "time": "2024-06-15T09:13:15+00:00" }, { "name": "sebastian/cli-parser", @@ -13248,6 +13249,80 @@ ], "time": "2024-04-24T13:22:11+00:00" }, + { + "name": "spatie/error-solutions", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/error-solutions.git", + "reference": "202108314a6988ede156fba1b3ea80a784c1734a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/error-solutions/zipball/202108314a6988ede156fba1b3ea80a784c1734a", + "reference": "202108314a6988ede156fba1b3ea80a784c1734a", + "shasum": "" + }, + "require": { + "php": "^8.0" + }, + "require-dev": { + "illuminate/broadcasting": "^10.0|^11.0", + "illuminate/cache": "^10.0|^11.0", + "illuminate/support": "^10.0|^11.0", + "livewire/livewire": "^2.11|^3.3.5", + "openai-php/client": "^0.10.1", + "orchestra/testbench": "^7.0|8.22.3|^9.0", + "pestphp/pest": "^2.20", + "phpstan/phpstan": "^1.11", + "psr/simple-cache": "^3.0", + "psr/simple-cache-implementation": "^3.0", + "spatie/ray": "^1.28", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "vlucas/phpdotenv": "^5.5" + }, + "suggest": { + "openai-php/client": "Require get solutions from OpenAI", + "simple-cache-implementation": "To cache solutions from OpenAI" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\Ignition\\": "legacy/ignition", + "Spatie\\ErrorSolutions\\": "src", + "Spatie\\LaravelIgnition\\": "legacy/laravel-ignition" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ruben Van Assche", + "email": "ruben@spatie.be", + "role": "Developer" + } + ], + "description": "This is my package error-solutions", + "homepage": "https://github.com/spatie/error-solutions", + "keywords": [ + "error-solutions", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/error-solutions/issues", + "source": "https://github.com/spatie/error-solutions/tree/1.0.0" + }, + "funding": [ + { + "url": "https://github.com/Spatie", + "type": "github" + } + ], + "time": "2024-06-12T14:49:54+00:00" + }, { "name": "spatie/flare-client-php", "version": "1.6.0", @@ -13265,7 +13340,7 @@ "require": { "illuminate/pipeline": "^8.0|^9.0|^10.0|^11.0", "php": "^8.0", - "spatie/backtrace": "^1.5.2", + "spatie/backtrace": "^1.6.1", "symfony/http-foundation": "^5.2|^6.0|^7.0", "symfony/mime": "^5.2|^6.0|^7.0", "symfony/process": "^5.2|^6.0|^7.0", @@ -13335,8 +13410,8 @@ "ext-json": "*", "ext-mbstring": "*", "php": "^8.0", - "spatie/backtrace": "^1.5.3", - "spatie/flare-client-php": "^1.4.0", + "spatie/error-solutions": "^1.0", + "spatie/flare-client-php": "^1.7", "symfony/console": "^5.4|^6.0|^7.0", "symfony/var-dumper": "^5.4|^6.0|^7.0" }, @@ -13402,16 +13477,16 @@ }, { "name": "spatie/laravel-ignition", - "version": "2.7.0", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-ignition.git", - "reference": "f52124d50122611e8a40f628cef5c19ff6cc5b57" + "reference": "3c067b75bfb50574db8f7e2c3978c65eed71126c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/f52124d50122611e8a40f628cef5c19ff6cc5b57", - "reference": "f52124d50122611e8a40f628cef5c19ff6cc5b57", + "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/3c067b75bfb50574db8f7e2c3978c65eed71126c", + "reference": "3c067b75bfb50574db8f7e2c3978c65eed71126c", "shasum": "" }, "require": { @@ -13420,8 +13495,7 @@ "ext-mbstring": "*", "illuminate/support": "^10.0|^11.0", "php": "^8.1", - "spatie/flare-client-php": "^1.5", - "spatie/ignition": "^1.14", + "spatie/ignition": "^1.15", "symfony/console": "^6.2.3|^7.0", "symfony/var-dumper": "^6.2.3|^7.0" }, @@ -13490,7 +13564,7 @@ "type": "github" } ], - "time": "2024-05-02T13:42:49+00:00" + "time": "2024-06-12T15:01:18+00:00" }, { "name": "theseer/tokenizer", From 97793654325e037538200de82fc81b9210214fe8 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Wed, 26 Jun 2024 15:42:16 -0400 Subject: [PATCH 12/27] wip --- .env.docker | 2 +- .github/docker/entrypoint.sh | 34 +++------------------------------ Caddyfile | 5 ++--- Dockerfile | 12 ++++-------- compose.yml | 37 ++++++++++++++++++++++++++++++------ 5 files changed, 41 insertions(+), 49 deletions(-) diff --git a/.env.docker b/.env.docker index 58f5da060..91aac2b04 100644 --- a/.env.docker +++ b/.env.docker @@ -1,3 +1,3 @@ APP_KEY= -DB_DATABASE=docker/database.sqlite +DB_DATABASE=database.sqlite diff --git a/.github/docker/entrypoint.sh b/.github/docker/entrypoint.sh index d3b891de6..20fe6b8c6 100644 --- a/.github/docker/entrypoint.sh +++ b/.github/docker/entrypoint.sh @@ -2,40 +2,12 @@ #mkdir -p /var/log/supervisord/ /var/log/php8/ \ -## check for .env file and generate app keys if missing -if [ -f /pelican-data/.env ]; then - echo "external vars exist." - rm -rf /var/www/html/.env -else - echo "external vars don't exist." - rm -rf /var/www/html/.env - touch /pelican-data/.env - - ## manually generate a key because key generate --force fails - if [ -z $APP_KEY ]; then - echo -e "Generating key." - APP_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) - echo -e "Generated app key: $APP_KEY" - echo -e "APP_KEY=$APP_KEY" > /pelican-data/.env - else - echo -e "APP_KEY exists in environment, using that." - echo -e "APP_KEY=$APP_KEY" > /pelican-data/.env - fi -fi - -ln -s /pelican-data/.env /var/www/html/ - -touch /pelican-data/database.sqlite - -if ! grep -q "APP_KEY=" .env || grep -q "APP_KEY=$" .env; then - echo "Generating APP_KEY..." - php artisan key:generate --force -else - echo "APP_KEY is already set." -fi +## Make sure the app key is set +php artisan key:generate ## make sure the db is set up echo -e "Migrating and Seeding Database" +touch database/database.sqlite php artisan migrate --force ## start cronjobs for the queue diff --git a/Caddyfile b/Caddyfile index 1c835bf05..f3b65899f 100644 --- a/Caddyfile +++ b/Caddyfile @@ -3,9 +3,8 @@ } {$APP_URL} { - root * /var/www/html/public + root * /srv/public encode gzip - - php_fastcgi 127.0.0.1:9000 + php_fastcgi panel:9000 file_server } diff --git a/Dockerfile b/Dockerfile index 57d388812..31e840f07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,11 +20,10 @@ WORKDIR /var/www/html RUN apk update && apk add --no-cache \ libpng-dev libjpeg-turbo-dev freetype-dev libzip-dev icu-dev \ zip unzip curl \ - caddy ca-certificates supervisor \ - && docker-php-ext-install bcmath gd intl zip opcache pcntl posix + ca-certificates supervisor -# Copy the Caddyfile to the container -COPY Caddyfile /etc/caddy/Caddyfile +# Additional PHP Extensions +RUN docker-php-ext-install bcmath gd intl zip opcache pcntl posix # Copy the application code to the container COPY . . @@ -44,13 +43,10 @@ RUN chmod -R 755 /var/www/html/storage \ HEALTHCHECK --interval=5m --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost/up || exit 1 -EXPOSE 80:2019 -EXPOSE 443 - VOLUME /pelican-data # Start PHP-FPM -CMD ["sh", "-c", "php-fpm & caddy run --config /etc/caddy/Caddyfile --adapter caddyfile"] +CMD ["sh", "-c", "php-fpm"] ENTRYPOINT [ "/bin/ash", ".github/docker/entrypoint.sh" ] # CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] diff --git a/compose.yml b/compose.yml index c4737d755..38e48035a 100644 --- a/compose.yml +++ b/compose.yml @@ -30,22 +30,47 @@ x-common: services: panel: image: panel - restart: always - ports: - - "80:2019" - - "443:443" + restart: unless-stopped extra_hosts: - "host.docker.internal:host-gateway" volumes: - pelican-data:/pelican-data - - pelican-logs:/var/www/html/storage/logs + - .:/srv environment: <<: [*panel-environment, *mail-environment] + working_dir: /srv + + caddy: + image: caddy:2-alpine + restart: unless-stopped + volumes: + - ./Caddyfile:/etc/caddy/Caddyfile + - caddy-data:/data + - caddy-config:/config + - .:/srv + ports: + - 80:80 + - 443:443 + env_file: + - ./.env.docker + environment: + <<: [ *panel-environment, *mail-environment ] XDG_DATA_HOME: /pelican-data + logging: + driver: "json-file" + options: + max-size: "1M" + max-file: "10" + command: + - /bin/sh + - -c + - | + caddy run --config /etc/caddy/Caddyfile --adapter caddyfile volumes: pelican-data: - pelican-logs: + caddy-data: + caddy-config: networks: default: From 4fc8d98a0f91b25f4df97d092aa5ab6150e79fa1 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Thu, 27 Jun 2024 14:56:49 -0400 Subject: [PATCH 13/27] Revert "wip" This reverts commit 649e82d0c06f068f08b024a1f8fc4837b488cb3d. --- .env.docker | 2 +- .github/docker/entrypoint.sh | 34 ++++++++++++++++++++++++++++++--- Caddyfile | 5 +++-- Dockerfile | 12 ++++++++---- compose.yml | 37 ++++++------------------------------ 5 files changed, 49 insertions(+), 41 deletions(-) diff --git a/.env.docker b/.env.docker index 91aac2b04..58f5da060 100644 --- a/.env.docker +++ b/.env.docker @@ -1,3 +1,3 @@ APP_KEY= -DB_DATABASE=database.sqlite +DB_DATABASE=docker/database.sqlite diff --git a/.github/docker/entrypoint.sh b/.github/docker/entrypoint.sh index 20fe6b8c6..d3b891de6 100644 --- a/.github/docker/entrypoint.sh +++ b/.github/docker/entrypoint.sh @@ -2,12 +2,40 @@ #mkdir -p /var/log/supervisord/ /var/log/php8/ \ -## Make sure the app key is set -php artisan key:generate +## check for .env file and generate app keys if missing +if [ -f /pelican-data/.env ]; then + echo "external vars exist." + rm -rf /var/www/html/.env +else + echo "external vars don't exist." + rm -rf /var/www/html/.env + touch /pelican-data/.env + + ## manually generate a key because key generate --force fails + if [ -z $APP_KEY ]; then + echo -e "Generating key." + APP_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) + echo -e "Generated app key: $APP_KEY" + echo -e "APP_KEY=$APP_KEY" > /pelican-data/.env + else + echo -e "APP_KEY exists in environment, using that." + echo -e "APP_KEY=$APP_KEY" > /pelican-data/.env + fi +fi + +ln -s /pelican-data/.env /var/www/html/ + +touch /pelican-data/database.sqlite + +if ! grep -q "APP_KEY=" .env || grep -q "APP_KEY=$" .env; then + echo "Generating APP_KEY..." + php artisan key:generate --force +else + echo "APP_KEY is already set." +fi ## make sure the db is set up echo -e "Migrating and Seeding Database" -touch database/database.sqlite php artisan migrate --force ## start cronjobs for the queue diff --git a/Caddyfile b/Caddyfile index f3b65899f..1c835bf05 100644 --- a/Caddyfile +++ b/Caddyfile @@ -3,8 +3,9 @@ } {$APP_URL} { - root * /srv/public + root * /var/www/html/public encode gzip - php_fastcgi panel:9000 + + php_fastcgi 127.0.0.1:9000 file_server } diff --git a/Dockerfile b/Dockerfile index 31e840f07..57d388812 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,10 +20,11 @@ WORKDIR /var/www/html RUN apk update && apk add --no-cache \ libpng-dev libjpeg-turbo-dev freetype-dev libzip-dev icu-dev \ zip unzip curl \ - ca-certificates supervisor + caddy ca-certificates supervisor \ + && docker-php-ext-install bcmath gd intl zip opcache pcntl posix -# Additional PHP Extensions -RUN docker-php-ext-install bcmath gd intl zip opcache pcntl posix +# Copy the Caddyfile to the container +COPY Caddyfile /etc/caddy/Caddyfile # Copy the application code to the container COPY . . @@ -43,10 +44,13 @@ RUN chmod -R 755 /var/www/html/storage \ HEALTHCHECK --interval=5m --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost/up || exit 1 +EXPOSE 80:2019 +EXPOSE 443 + VOLUME /pelican-data # Start PHP-FPM -CMD ["sh", "-c", "php-fpm"] +CMD ["sh", "-c", "php-fpm & caddy run --config /etc/caddy/Caddyfile --adapter caddyfile"] ENTRYPOINT [ "/bin/ash", ".github/docker/entrypoint.sh" ] # CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] diff --git a/compose.yml b/compose.yml index 38e48035a..c4737d755 100644 --- a/compose.yml +++ b/compose.yml @@ -30,47 +30,22 @@ x-common: services: panel: image: panel - restart: unless-stopped + restart: always + ports: + - "80:2019" + - "443:443" extra_hosts: - "host.docker.internal:host-gateway" volumes: - pelican-data:/pelican-data - - .:/srv + - pelican-logs:/var/www/html/storage/logs environment: <<: [*panel-environment, *mail-environment] - working_dir: /srv - - caddy: - image: caddy:2-alpine - restart: unless-stopped - volumes: - - ./Caddyfile:/etc/caddy/Caddyfile - - caddy-data:/data - - caddy-config:/config - - .:/srv - ports: - - 80:80 - - 443:443 - env_file: - - ./.env.docker - environment: - <<: [ *panel-environment, *mail-environment ] XDG_DATA_HOME: /pelican-data - logging: - driver: "json-file" - options: - max-size: "1M" - max-file: "10" - command: - - /bin/sh - - -c - - | - caddy run --config /etc/caddy/Caddyfile --adapter caddyfile volumes: pelican-data: - caddy-data: - caddy-config: + pelican-logs: networks: default: From 6f15537d778165d2b146fb552822521d8e7876a2 Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Thu, 27 Jun 2024 15:59:07 -0400 Subject: [PATCH 14/27] add ability to skip starting caddy dockerfile cmd updated to just start php-fpm entrypoint now starts caddy unless SKIP_CADDY has been set. compose file updated ports to work properly. updated networks to use the correct network. added commented port and variable to disable caddy added further notes. --- .github/docker/entrypoint.sh | 7 +++++++ Dockerfile | 2 +- compose.yml | 12 ++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/docker/entrypoint.sh b/.github/docker/entrypoint.sh index d3b891de6..5590102b2 100644 --- a/.github/docker/entrypoint.sh +++ b/.github/docker/entrypoint.sh @@ -42,6 +42,13 @@ php artisan migrate --force echo -e "Starting cron jobs." crond -L /var/log/crond -l 5 +if [[ -z $SKIP_CADDY ]]; then + echo "Starting PHP-FPM and Caddy" + caddy run --config /etc/caddy/Caddyfile --adapter caddyfile & +else + echo "Starting PHP-FPM only" +fi + #chmod -R 755 storage/* bootstrap/cache/ chown -R www-data:www-data . diff --git a/Dockerfile b/Dockerfile index 57d388812..350388f15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,7 +50,7 @@ EXPOSE 443 VOLUME /pelican-data # Start PHP-FPM -CMD ["sh", "-c", "php-fpm & caddy run --config /etc/caddy/Caddyfile --adapter caddyfile"] +CMD ["sh", "-c", "php-fpm"] ENTRYPOINT [ "/bin/ash", ".github/docker/entrypoint.sh" ] # CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] diff --git a/compose.yml b/compose.yml index c4737d755..e4d737cbe 100644 --- a/compose.yml +++ b/compose.yml @@ -1,7 +1,7 @@ x-common: panel: &panel-environment - APP_URL: "https://localhost" + APP_URL: "https://localhost" # can be set to 'http://localhost' to un on port 80 only APP_DEBUG: "false" ADMIN_EMAIL: "USEYOUROWNEMAILHERE@example.com" @@ -29,19 +29,23 @@ x-common: services: panel: - image: panel + image: ghcr.io/pelican-dev/panel:latest restart: always + networks: + - default ports: - - "80:2019" + - "80:80" - "443:443" + # - "9000:9000" # enable when not using caddy to be abel to reach php-fpm extra_hosts: - - "host.docker.internal:host-gateway" + - "host.docker.internal:host-gateway" # shows the panel on te internal docker network as well. usually '172.17.0.1' volumes: - pelican-data:/pelican-data - pelican-logs:/var/www/html/storage/logs environment: <<: [*panel-environment, *mail-environment] XDG_DATA_HOME: /pelican-data + # SKIP_CADDY: true # enable when not using caddy. volumes: pelican-data: From 83ba05d7fb2376e514ba6d830075cfbf583f42c0 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 27 Sep 2024 15:32:22 -0400 Subject: [PATCH 15/27] Update installer --- .../Pages/Installer/PanelInstaller.php | 20 +++++++++--- app/Http/Controllers/Auth/LoginController.php | 7 ++++- app/helpers.php | 31 ------------------- config/panel.php | 6 +++- 4 files changed, 27 insertions(+), 37 deletions(-) diff --git a/app/Filament/Pages/Installer/PanelInstaller.php b/app/Filament/Pages/Installer/PanelInstaller.php index 160439086..cca387332 100644 --- a/app/Filament/Pages/Installer/PanelInstaller.php +++ b/app/Filament/Pages/Installer/PanelInstaller.php @@ -7,6 +7,7 @@ use App\Filament\Pages\Installer\Steps\DatabaseStep; use App\Filament\Pages\Installer\Steps\EnvironmentStep; use App\Filament\Pages\Installer\Steps\RedisStep; use App\Filament\Pages\Installer\Steps\RequirementsStep; +use App\Models\User; use App\Services\Users\UserCreationService; use App\Traits\CheckMigrationsTrait; use App\Traits\EnvironmentWriterTrait; @@ -44,11 +45,22 @@ class PanelInstaller extends SimplePage implements HasForms return MaxWidth::SevenExtraLarge; } + public static function show(): bool + { + if (User::count() <= 0) { + return true; + } + + if (config('panel.client_features.installer.enabled')) { + return true; + } + + return false; + } + public function mount() { - if (is_installed()) { - abort(404); - } + abort_unless(self::show(), 404); $this->form->fill(); } @@ -123,7 +135,7 @@ class PanelInstaller extends SimplePage implements HasForms app(UserCreationService::class)->handle($userData); // Install setup complete - $this->writeToEnvironment(['APP_INSTALLED' => 'true']); + $this->writeToEnvironment(['APP_INSTALLER' => 'false']); $this->rememberData(); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index e1984bc88..45e4a7729 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Auth; +use App\Filament\Pages\Installer\PanelInstaller; use Carbon\CarbonImmutable; use Illuminate\Support\Str; use Illuminate\Http\Request; @@ -17,8 +18,12 @@ class LoginController extends AbstractLoginController * base authentication view component. React will take over at this point and * turn the login area into an SPA. */ - public function index(): View + public function index() { + if (PanelInstaller::show()) { + return redirect('/installer'); + } + return view('templates/auth.core'); } diff --git a/app/helpers.php b/app/helpers.php index 4f3e87021..2e21fc728 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -17,34 +17,3 @@ if (!function_exists('is_ip')) { return $address !== null && filter_var($address, FILTER_VALIDATE_IP) !== false; } } - -if (!function_exists('object_get_strict')) { - /** - * Get an object using dot notation. An object key with a value of null is still considered valid - * and will not trigger the response of a default value (unlike object_get). - */ - function object_get_strict(object $object, ?string $key, mixed $default = null): mixed - { - if (is_null($key) || trim($key) == '') { - return $object; - } - - foreach (explode('.', $key) as $segment) { - if (!is_object($object) || !property_exists($object, $segment)) { - return value($default); - } - - $object = $object->{$segment}; - } - - return $object; - } -} - -if (!function_exists('is_installed')) { - function is_installed(): bool - { - // This defaults to true so existing panels count as "installed" - return env('APP_INSTALLED', true); - } -} diff --git a/config/panel.php b/config/panel.php index 32b11bc3a..62273bbbf 100644 --- a/config/panel.php +++ b/config/panel.php @@ -74,7 +74,7 @@ return [ | Client Features |-------------------------------------------------------------------------- | - | Allow clients to create their own databases. + | Allow clients to turn features on or off */ 'client_features' => [ @@ -93,6 +93,10 @@ return [ 'range_start' => env('PANEL_CLIENT_ALLOCATIONS_RANGE_START'), 'range_end' => env('PANEL_CLIENT_ALLOCATIONS_RANGE_END'), ], + + 'installer' => [ + 'enabled' => env('APP_INSTALLER', true), + ], ], /* From 0f58643cf2a2915e23ecba568583ad95e2c32ada Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 27 Sep 2024 15:32:31 -0400 Subject: [PATCH 16/27] Fix order of params --- compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compose.yml b/compose.yml index e4d737cbe..23d2f2a39 100644 --- a/compose.yml +++ b/compose.yml @@ -1,10 +1,10 @@ x-common: panel: &panel-environment - APP_URL: "https://localhost" # can be set to 'http://localhost' to un on port 80 only - APP_DEBUG: "false" + APP_URL: "https://localhost" # can be set to 'http://localhost' on port 80 only ADMIN_EMAIL: "USEYOUROWNEMAILHERE@example.com" + APP_DEBUG: "false" APP_ENVIRONMENT_ONLY: "false" APP_ENV: "production" SESSION_DRIVER: "file" From f686eda718a8f2635f022529c65fe7de66de018f Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 27 Sep 2024 15:32:41 -0400 Subject: [PATCH 17/27] Allow absolute path in database file --- config/database.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/database.php b/config/database.php index 016d1a926..bc995edda 100644 --- a/config/database.php +++ b/config/database.php @@ -1,5 +1,11 @@ startsWith('/')) { + $databasePath = $database; +} + return [ 'default' => env('DB_CONNECTION', 'sqlite'), @@ -8,7 +14,7 @@ return [ 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DB_URL'), - 'database' => database_path(env('DB_DATABASE', 'database.sqlite')), + 'database' => $datapasePath, 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], From 476eccca53ff2e48ad66e5238af641ff3b0ae519 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 27 Sep 2024 15:33:18 -0400 Subject: [PATCH 18/27] Add mysql --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 350388f15..89fe68c36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ RUN apk update && apk add --no-cache \ libpng-dev libjpeg-turbo-dev freetype-dev libzip-dev icu-dev \ zip unzip curl \ caddy ca-certificates supervisor \ - && docker-php-ext-install bcmath gd intl zip opcache pcntl posix + && docker-php-ext-install bcmath gd intl zip opcache pcntl posix pdo_mysql # Copy the Caddyfile to the container COPY Caddyfile /etc/caddy/Caddyfile From 3ca77765e6e78cbb3d1a9a788cc3ca9da3aebeca Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 27 Sep 2024 15:33:51 -0400 Subject: [PATCH 19/27] Small installer updates --- app/Filament/Pages/Installer/Steps/AdminUserStep.php | 4 ++-- app/Filament/Pages/Installer/Steps/EnvironmentStep.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Filament/Pages/Installer/Steps/AdminUserStep.php b/app/Filament/Pages/Installer/Steps/AdminUserStep.php index 68ebb6510..cbd8424e7 100644 --- a/app/Filament/Pages/Installer/Steps/AdminUserStep.php +++ b/app/Filament/Pages/Installer/Steps/AdminUserStep.php @@ -16,11 +16,11 @@ class AdminUserStep ->label('Admin E-Mail') ->required() ->email() - ->default('admin@example.com'), + ->placeholder('admin@example.com'), TextInput::make('user.username') ->label('Admin Username') ->required() - ->default('admin'), + ->placeholder('admin'), TextInput::make('user.password') ->label('Admin Password') ->required() diff --git a/app/Filament/Pages/Installer/Steps/EnvironmentStep.php b/app/Filament/Pages/Installer/Steps/EnvironmentStep.php index d9cc5eafa..5cec6147a 100644 --- a/app/Filament/Pages/Installer/Steps/EnvironmentStep.php +++ b/app/Filament/Pages/Installer/Steps/EnvironmentStep.php @@ -23,9 +23,9 @@ class EnvironmentStep ]; public const QUEUE_DRIVERS = [ + 'sync' => 'Sync', 'database' => 'Database', 'redis' => 'Redis', - 'sync' => 'Synchronous', ]; public const DATABASE_DRIVERS = [ @@ -76,11 +76,11 @@ class EnvironmentStep ToggleButtons::make('env.QUEUE_CONNECTION') ->label('Queue Driver') ->hintIcon('tabler-question-mark') - ->hintIconTooltip('The driver used for handling queues. We recommend "Database".') + ->hintIconTooltip('The driver used for handling queues. We recommend "Sync" or "Database".') ->required() ->inline() ->options(self::QUEUE_DRIVERS) - ->default(config('queue.default', 'database')), + ->default(config('queue.default', 'sync')), ToggleButtons::make('env.DB_CONNECTION') ->label('Database Driver') ->hintIcon('tabler-question-mark') From b098d20afb9c4bd4efdb1b7009cfb5e3eeaed850 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 27 Sep 2024 15:34:22 -0400 Subject: [PATCH 20/27] Make this work --- .github/docker/entrypoint.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/docker/entrypoint.sh b/.github/docker/entrypoint.sh index 5590102b2..8e545161f 100644 --- a/.github/docker/entrypoint.sh +++ b/.github/docker/entrypoint.sh @@ -23,9 +23,9 @@ else fi fi +mkdir /pelican-data/database ln -s /pelican-data/.env /var/www/html/ - -touch /pelican-data/database.sqlite +ln -s /pelican-data/database/database.sqlite /var/www/html/database/ if ! grep -q "APP_KEY=" .env || grep -q "APP_KEY=$" .env; then echo "Generating APP_KEY..." @@ -35,7 +35,7 @@ else fi ## make sure the db is set up -echo -e "Migrating and Seeding Database" +echo -e "Migrating Database" php artisan migrate --force ## start cronjobs for the queue @@ -49,8 +49,7 @@ else echo "Starting PHP-FPM only" fi -#chmod -R 755 storage/* bootstrap/cache/ -chown -R www-data:www-data . +chown -R www-data:www-data . /pelican-data/.env /pelican-data/database echo -e "Starting supervisord." exec "$@" From a8a2668754e4297c62fa382d9a547c76bff43c39 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 27 Sep 2024 15:43:04 -0400 Subject: [PATCH 21/27] Revert the composer lock --- composer.lock | 143 ++++++++++++-------------------------------------- 1 file changed, 35 insertions(+), 108 deletions(-) diff --git a/composer.lock b/composer.lock index 0ab5ce4a1..c8e3fa55a 100644 --- a/composer.lock +++ b/composer.lock @@ -745,16 +745,16 @@ }, { "name": "danharrin/date-format-converter", - "version": "v0.3.1", + "version": "v0.3.0", "source": { "type": "git", "url": "https://github.com/danharrin/date-format-converter.git", - "reference": "7c31171bc981e48726729a5f3a05a2d2b63f0b1e" + "reference": "42b6ddc52059d4ba228a67c15adaaa0c039e75f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/danharrin/date-format-converter/zipball/7c31171bc981e48726729a5f3a05a2d2b63f0b1e", - "reference": "7c31171bc981e48726729a5f3a05a2d2b63f0b1e", + "url": "https://api.github.com/repos/danharrin/date-format-converter/zipball/42b6ddc52059d4ba228a67c15adaaa0c039e75f2", + "reference": "42b6ddc52059d4ba228a67c15adaaa0c039e75f2", "shasum": "" }, "require": { @@ -792,7 +792,7 @@ "type": "github" } ], - "time": "2024-06-13T09:38:44+00:00" + "time": "2022-09-29T07:48:20+00:00" }, { "name": "danharrin/livewire-rate-limiting", @@ -6293,16 +6293,16 @@ }, { "name": "psy/psysh", - "version": "v0.12.4", + "version": "v0.12.3", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "2fd717afa05341b4f8152547f142cd2f130f6818" + "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/2fd717afa05341b4f8152547f142cd2f130f6818", - "reference": "2fd717afa05341b4f8152547f142cd2f130f6818", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73", + "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73", "shasum": "" }, "require": { @@ -6366,9 +6366,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.12.4" + "source": "https://github.com/bobthecow/psysh/tree/v0.12.3" }, - "time": "2024-06-10T01:18:23+00:00" + "time": "2024-04-02T15:57:53+00:00" }, { "name": "ralouphie/getallheaders", @@ -11318,16 +11318,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.12.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -11335,12 +11335,11 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3 <3.2.2" + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", - "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -11366,7 +11365,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -11374,7 +11373,7 @@ "type": "tidelift" } ], - "time": "2024-06-12T14:39:25+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "nunomaduro/collision", @@ -12171,16 +12170,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.21", + "version": "10.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ac837816fa52078f7a5e17ed774f256a72a51af6" + "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ac837816fa52078f7a5e17ed774f256a72a51af6", - "reference": "ac837816fa52078f7a5e17ed774f256a72a51af6", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/547d314dc24ec1e177720d45c6263fb226cc2ae3", + "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3", "shasum": "" }, "require": { @@ -12252,7 +12251,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.21" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.20" }, "funding": [ { @@ -12268,7 +12267,7 @@ "type": "tidelift" } ], - "time": "2024-06-15T09:13:15+00:00" + "time": "2024-04-24T06:32:35+00:00" }, { "name": "sebastian/cli-parser", @@ -13249,80 +13248,6 @@ ], "time": "2024-04-24T13:22:11+00:00" }, - { - "name": "spatie/error-solutions", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/spatie/error-solutions.git", - "reference": "202108314a6988ede156fba1b3ea80a784c1734a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/error-solutions/zipball/202108314a6988ede156fba1b3ea80a784c1734a", - "reference": "202108314a6988ede156fba1b3ea80a784c1734a", - "shasum": "" - }, - "require": { - "php": "^8.0" - }, - "require-dev": { - "illuminate/broadcasting": "^10.0|^11.0", - "illuminate/cache": "^10.0|^11.0", - "illuminate/support": "^10.0|^11.0", - "livewire/livewire": "^2.11|^3.3.5", - "openai-php/client": "^0.10.1", - "orchestra/testbench": "^7.0|8.22.3|^9.0", - "pestphp/pest": "^2.20", - "phpstan/phpstan": "^1.11", - "psr/simple-cache": "^3.0", - "psr/simple-cache-implementation": "^3.0", - "spatie/ray": "^1.28", - "symfony/cache": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "vlucas/phpdotenv": "^5.5" - }, - "suggest": { - "openai-php/client": "Require get solutions from OpenAI", - "simple-cache-implementation": "To cache solutions from OpenAI" - }, - "type": "library", - "autoload": { - "psr-4": { - "Spatie\\Ignition\\": "legacy/ignition", - "Spatie\\ErrorSolutions\\": "src", - "Spatie\\LaravelIgnition\\": "legacy/laravel-ignition" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ruben Van Assche", - "email": "ruben@spatie.be", - "role": "Developer" - } - ], - "description": "This is my package error-solutions", - "homepage": "https://github.com/spatie/error-solutions", - "keywords": [ - "error-solutions", - "spatie" - ], - "support": { - "issues": "https://github.com/spatie/error-solutions/issues", - "source": "https://github.com/spatie/error-solutions/tree/1.0.0" - }, - "funding": [ - { - "url": "https://github.com/Spatie", - "type": "github" - } - ], - "time": "2024-06-12T14:49:54+00:00" - }, { "name": "spatie/flare-client-php", "version": "1.6.0", @@ -13340,7 +13265,7 @@ "require": { "illuminate/pipeline": "^8.0|^9.0|^10.0|^11.0", "php": "^8.0", - "spatie/backtrace": "^1.6.1", + "spatie/backtrace": "^1.5.2", "symfony/http-foundation": "^5.2|^6.0|^7.0", "symfony/mime": "^5.2|^6.0|^7.0", "symfony/process": "^5.2|^6.0|^7.0", @@ -13410,8 +13335,8 @@ "ext-json": "*", "ext-mbstring": "*", "php": "^8.0", - "spatie/error-solutions": "^1.0", - "spatie/flare-client-php": "^1.7", + "spatie/backtrace": "^1.5.3", + "spatie/flare-client-php": "^1.4.0", "symfony/console": "^5.4|^6.0|^7.0", "symfony/var-dumper": "^5.4|^6.0|^7.0" }, @@ -13477,16 +13402,16 @@ }, { "name": "spatie/laravel-ignition", - "version": "2.8.0", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-ignition.git", - "reference": "3c067b75bfb50574db8f7e2c3978c65eed71126c" + "reference": "f52124d50122611e8a40f628cef5c19ff6cc5b57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/3c067b75bfb50574db8f7e2c3978c65eed71126c", - "reference": "3c067b75bfb50574db8f7e2c3978c65eed71126c", + "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/f52124d50122611e8a40f628cef5c19ff6cc5b57", + "reference": "f52124d50122611e8a40f628cef5c19ff6cc5b57", "shasum": "" }, "require": { @@ -13495,7 +13420,8 @@ "ext-mbstring": "*", "illuminate/support": "^10.0|^11.0", "php": "^8.1", - "spatie/ignition": "^1.15", + "spatie/flare-client-php": "^1.5", + "spatie/ignition": "^1.14", "symfony/console": "^6.2.3|^7.0", "symfony/var-dumper": "^6.2.3|^7.0" }, @@ -13564,7 +13490,7 @@ "type": "github" } ], - "time": "2024-06-12T15:01:18+00:00" + "time": "2024-05-02T13:42:49+00:00" }, { "name": "theseer/tokenizer", @@ -13628,6 +13554,7 @@ "ext-json": "*", "ext-mbstring": "*", "ext-pdo": "*", + "ext-pdo_mysql": "*", "ext-zip": "*" }, "platform-dev": [], From 4c191446402f4701d29a41a3f99a76e28dfceefa Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 27 Sep 2024 15:53:44 -0400 Subject: [PATCH 22/27] =?UTF-8?q?Don=E2=80=99t=20need=20separate=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.docker | 3 --- Dockerfile | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 .env.docker diff --git a/.env.docker b/.env.docker deleted file mode 100644 index 58f5da060..000000000 --- a/.env.docker +++ /dev/null @@ -1,3 +0,0 @@ -APP_KEY= - -DB_DATABASE=docker/database.sqlite diff --git a/Dockerfile b/Dockerfile index 89fe68c36..f41bc9bdd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,7 +31,7 @@ COPY . . COPY --from=yarn /build/public/assets ./public/assets -RUN cp .env.docker .env +RUN touch .env RUN composer install --no-dev --optimize-autoloader From 1785883c55e07075f77554c841b766cc43438df2 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 27 Sep 2024 15:54:00 -0400 Subject: [PATCH 23/27] =?UTF-8?q?Don=E2=80=99t=20need=20this=20anymore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 1 - 1 file changed, 1 deletion(-) diff --git a/.env.example b/.env.example index 84ff1d432..6a128b13d 100644 --- a/.env.example +++ b/.env.example @@ -4,7 +4,6 @@ APP_KEY= APP_TIMEZONE=UTC APP_URL=http://panel.test APP_LOCALE=en -APP_INSTALLED=false LOG_CHANNEL=daily LOG_STACK=single From 4dba73163bf598741b17ac738908173194cf453a Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 27 Sep 2024 16:50:10 -0400 Subject: [PATCH 24/27] Switch this back --- app/Filament/Pages/Installer/Steps/EnvironmentStep.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Filament/Pages/Installer/Steps/EnvironmentStep.php b/app/Filament/Pages/Installer/Steps/EnvironmentStep.php index 5cec6147a..b70c47f32 100644 --- a/app/Filament/Pages/Installer/Steps/EnvironmentStep.php +++ b/app/Filament/Pages/Installer/Steps/EnvironmentStep.php @@ -80,7 +80,7 @@ class EnvironmentStep ->required() ->inline() ->options(self::QUEUE_DRIVERS) - ->default(config('queue.default', 'sync')), + ->default(config('queue.default', 'database')), ToggleButtons::make('env.DB_CONNECTION') ->label('Database Driver') ->hintIcon('tabler-question-mark') From 0cd20eb4448f6c7c0bc49deb039d3afe0b9c7a82 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 27 Sep 2024 16:50:18 -0400 Subject: [PATCH 25/27] =?UTF-8?q?We=20don=E2=80=99t=20do=20this=20yet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/docker/entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/docker/entrypoint.sh b/.github/docker/entrypoint.sh index 8e545161f..ee78a2300 100644 --- a/.github/docker/entrypoint.sh +++ b/.github/docker/entrypoint.sh @@ -51,5 +51,4 @@ fi chown -R www-data:www-data . /pelican-data/.env /pelican-data/database -echo -e "Starting supervisord." exec "$@" From 967d02612d83d907795a1bd21bf44f9d96cf2b4e Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 27 Sep 2024 16:50:34 -0400 Subject: [PATCH 26/27] Add cron and queue --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f41bc9bdd..f11456acd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,7 +39,11 @@ RUN composer install --no-dev --optimize-autoloader RUN chmod -R 755 /var/www/html/storage \ && chmod -R 755 /var/www/html/bootstrap/cache -#echo "* * * * * /usr/local/bin/php /build/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root +# Add scheduler to cron +RUN echo "* * * * * php /var/www/html/artisan schedule:run >> /dev/null 2>&1" | crontab -u www-data - + +# Create new service for the queue +RUN php artisan p:environment:queue-service --service-name=pelican-queue --user=www-data --group=www-data --overwrite HEALTHCHECK --interval=5m --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost/up || exit 1 From 6117282909f59c16eab8154bf0a5d26f8f7dfccb Mon Sep 17 00:00:00 2001 From: "Michael (Parker) Parker" Date: Fri, 27 Sep 2024 17:36:45 -0400 Subject: [PATCH 27/27] update to use supervisord Update the dockerfile to use supervisord Update supervisord config to use start caddy unless configured not to. Updated entrypoint to handle caddy skip for supervisord. --- .github/docker/entrypoint.sh | 6 +++++- .github/docker/supervisord.conf | 12 ++++++------ Dockerfile | 10 ++++------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/docker/entrypoint.sh b/.github/docker/entrypoint.sh index ee78a2300..14f779e57 100644 --- a/.github/docker/entrypoint.sh +++ b/.github/docker/entrypoint.sh @@ -42,13 +42,17 @@ php artisan migrate --force echo -e "Starting cron jobs." crond -L /var/log/crond -l 5 +export SUPERVISORD_CADDY=false + +## disable caddy if SKIP_CADDY is set if [[ -z $SKIP_CADDY ]]; then echo "Starting PHP-FPM and Caddy" - caddy run --config /etc/caddy/Caddyfile --adapter caddyfile & + export SUPERVISORD_CADDY=true else echo "Starting PHP-FPM only" fi chown -R www-data:www-data . /pelican-data/.env /pelican-data/database +echo "Starting Supervisord" exec "$@" diff --git a/.github/docker/supervisord.conf b/.github/docker/supervisord.conf index da6823aeb..4d6b745c8 100644 --- a/.github/docker/supervisord.conf +++ b/.github/docker/supervisord.conf @@ -25,15 +25,15 @@ autostart=true autorestart=true [program:queue-worker] -command=/usr/local/bin/php /app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 -user=nginx +command=/usr/local/bin/php /var/www/html/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 +user=www-data autostart=true autorestart=true -[program:nginx] -command=/usr/sbin/nginx -g 'daemon off;' -autostart=true -autorestart=true +[program:caddy] +command=caddy run --config /etc/caddy/Caddyfile --adapter caddyfile +autostart=%(ENV_SUPERVISORD_CADDY)s +autorestart=%(ENV_SUPERVISORD_CADDY)s priority=10 stdout_events_enabled=true stderr_events_enabled=true \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f11456acd..8c99bcc25 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,8 +42,9 @@ RUN chmod -R 755 /var/www/html/storage \ # Add scheduler to cron RUN echo "* * * * * php /var/www/html/artisan schedule:run >> /dev/null 2>&1" | crontab -u www-data - -# Create new service for the queue -RUN php artisan p:environment:queue-service --service-name=pelican-queue --user=www-data --group=www-data --overwrite +## supervisord config and log dir +RUN cp .github/docker/supervisord.conf /etc/supervisord.conf && \ + mkdir /var/log/supervisord/ HEALTHCHECK --interval=5m --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost/up || exit 1 @@ -53,8 +54,5 @@ EXPOSE 443 VOLUME /pelican-data -# Start PHP-FPM -CMD ["sh", "-c", "php-fpm"] - ENTRYPOINT [ "/bin/ash", ".github/docker/entrypoint.sh" ] -# CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ] +CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ]