Skip to content

Commit

Permalink
Adjust release setup with Caddy, fix database config in setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Kovah committed Oct 17, 2024
1 parent 3140895 commit 1d4cc15
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions resources/docker/dockerfiles/release-multiplatform.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions resources/docker/ssl.Caddyfile
Original file line number Diff line number Diff line change
@@ -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
}
6 changes: 4 additions & 2 deletions resources/views/layouts/setup.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/svg+xml" href="{{ asset('favicon.svg') }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ asset('favicon-32x32.png') }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('favicon-16x16.png') }}">
<link rel="icon" type="image/png" sizes="192x192" href="{{ asset('apple-touch-icon.png') }}">

<meta name="csrf-token" content="{{ csrf_token() }}">

<title>@isset($pageTitle){{$pageTitle}} - @endisset{{ config('app.name', 'LinkAce') }}</title>

<link href="{{ mix('assets/dist/css/app.css') }}" rel="stylesheet">

@include('layouts.partials.favicon')
</head>
<body class="setup">
<div id="app">
Expand Down
18 changes: 14 additions & 4 deletions resources/views/setup/database.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,18 @@
</label>
<select name="connection" id="connection"
class="form-select{{ $errors->has('connection') ? ' is-invalid' : '' }}">
<option value="mysql" @selected(old('connection') === 'mysql')>MySQL / MariaDB</option>
<option value="sqlite" @selected(old('connection') === 'sqlite')>SQLite</option>
<option value="pgsql" @selected(old('connection') === 'pgsql')>PostgreSQL</option>
<option
value="sqlite" @selected(old('connection', config('database.default')) === 'sqlite')>
SQLite
</option>
<option
value="mysql" @selected(old('connection', config('database.default')) === 'mysql')>
MySQL / MariaDB
</option>
<option
value="pgsql" @selected(old('connection', config('database.default')) === 'pgsql')>
PostgreSQL
</option>
</select>
@if ($errors->has('connection'))
<p class="invalid-feedback" role="alert">
Expand All @@ -41,7 +50,8 @@ class="form-select{{ $errors->has('connection') ? ' is-invalid' : '' }}">
</label>
<input type="text" name="db_path" id="db_path" required
class="form-control{{ $errors->has('db_path') ? ' is-invalid' : '' }}"
placeholder="localhost" value="{{ old('db_path') ?: database_path('database.sqlite') }}">
placeholder="localhost"
value="{{ old('db_path') ?: database_path('database.sqlite') }}">
@if ($errors->has('db_path'))
<p class="invalid-feedback" role="alert">
{{ $errors->first('db_path') }}
Expand Down

0 comments on commit 1d4cc15

Please sign in to comment.