From 1d4cc15b9b9a0f4f9ca07042340e25685179644f Mon Sep 17 00:00:00 2001 From: Kovah Date: Thu, 17 Oct 2024 16:19:26 +0200 Subject: [PATCH] Adjust release setup with Caddy, fix database config in setup --- .env.example | 6 +++--- docker-compose.production.yml | 6 +++--- .../release-multiplatform.Dockerfile | 5 +++-- resources/docker/ssl.Caddyfile | 12 ++++++++++++ resources/views/layouts/setup.blade.php | 6 ++++-- resources/views/setup/database.blade.php | 18 ++++++++++++++---- 6 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 resources/docker/ssl.Caddyfile diff --git a/.env.example b/.env.example index 504114c3..7e9e7ae6 100644 --- a/.env.example +++ b/.env.example @@ -7,13 +7,13 @@ APP_KEY=someRandomStringWith32Characters ## Configuration of the database connection ## Attention: Those settings are configured during the web setup, please do not modify them now. # Set the database driver (mysql, pgsql, sqlsrv, sqlite) -DB_CONNECTION=mysql +DB_CONNECTION=sqlite +# Set the database name (MySQL, Postgres,...) or path (SQLite) here +DB_DATABASE=/app/database/database.sqlite # Set the host of your database here DB_HOST=127.0.0.1 # Set the port of your database here DB_PORT=3306 -# Set the database name here -DB_DATABASE=linkace # Set both username and password of the user accessing the database DB_USERNAME=linkace # Wrap your password into quotes (") if it contains special characters diff --git a/docker-compose.production.yml b/docker-compose.production.yml index 8ca2f6d0..0742b96e 100644 --- a/docker-compose.production.yml +++ b/docker-compose.production.yml @@ -13,9 +13,9 @@ services: volumes: - ./.env:/app/.env - ./backups:/app/storage/app/backups - # Remove the hash of the following line if you want to use HTTPS for this container - #- ./Caddyfile:/etc/caddy/Caddyfile:ro - #- ./caddy-data:/data/caddy + # Remove the hash of the following lines if you want to use HTTPS for this container + #- ./caddy-data:/home/www-data/.local/share/caddy + #- ./ssl.Caddyfile:/etc/caddy/Caddyfile # --- Database db: diff --git a/resources/docker/dockerfiles/release-multiplatform.Dockerfile b/resources/docker/dockerfiles/release-multiplatform.Dockerfile index 5d7c4fea..9b81e415 100644 --- a/resources/docker/dockerfiles/release-multiplatform.Dockerfile +++ b/resources/docker/dockerfiles/release-multiplatform.Dockerfile @@ -20,7 +20,7 @@ COPY ./routes /app/routes COPY ./tests /app/tests COPY ["./artisan", "./composer.json", "./composer.lock", "/app/"] -COPY ./.env.example /app/.env +#COPY ./.env.example /app/.env # Install dependencies using Composer RUN composer install -n --prefer-dist --no-dev @@ -65,7 +65,6 @@ COPY --chown=www-data:www-data ./routes /app/routes COPY --chown=www-data:www-data ./storage /app/storage COPY --chown=www-data:www-data ["./artisan", "./composer.json", "./composer.lock", "./README.md", "./LICENSE.md", "./package.json", "/app/"] -COPY --chown=www-data:www-data ./.env.example /app/.env # Copy files from the composer build COPY --from=builder --chown=www-data:www-data /app/vendor /app/vendor @@ -85,6 +84,8 @@ RUN touch ./database/database.sqlite \ && chmod +w ./database/database.sqlite \ && chmod +r ./database +COPY --chown=www-data:www-data ./.env.example /app/.env + # Configure Supervisor for PHP + Caddy ENV PORT=80 ENV CADDY_PHP_HOST=localhost diff --git a/resources/docker/ssl.Caddyfile b/resources/docker/ssl.Caddyfile new file mode 100644 index 00000000..fe68b2e5 --- /dev/null +++ b/resources/docker/ssl.Caddyfile @@ -0,0 +1,12 @@ +{ + servers { + trusted_proxies static private_ranges + } +} + +{$LINKACE_DOMAIN} { + root * /app/public + encode zstd gzip + php_fastcgi {$CADDY_PHP_HOST:php}:9000 + file_server +} diff --git a/resources/views/layouts/setup.blade.php b/resources/views/layouts/setup.blade.php index 5de2c65a..e3d4baf3 100644 --- a/resources/views/layouts/setup.blade.php +++ b/resources/views/layouts/setup.blade.php @@ -4,14 +4,16 @@ + + + + @isset($pageTitle){{$pageTitle}} - @endisset{{ config('app.name', 'LinkAce') }} - - @include('layouts.partials.favicon')
diff --git a/resources/views/setup/database.blade.php b/resources/views/setup/database.blade.php index 78ced4eb..385a6036 100644 --- a/resources/views/setup/database.blade.php +++ b/resources/views/setup/database.blade.php @@ -24,9 +24,18 @@ @if ($errors->has('connection'))