Uploads on share.kadenpartner.ch failed with 409 on every chunk after the update to 2.1. The example docker-compose.yml mounts the SQLite volume over all of /app/database. Docker fills a volume from the image only when it is created, so the container kept the 2.0 migrations and never saw the 2.1 one. share_files.uploaded_chunks was never created, so the chunk endpoint read null and answered 409. SQLite takes the unknown "completed_at" in whereNull() as a string, so nothing failed earlier. - The image keeps a copy of its migrations in docker/migrations. On startup the entrypoint adds the ones missing from database/migrations before migrating, so installs with the old mount recover by pulling the new image. - docker-compose.example.yml and docker-compose.yml mount sealshare_database at /app/database/sqlite and set DB_DATABASE to the file in it. An existing volume can be moved there without losing data: its database.sqlite lands at exactly that path. - Tested with a locally built image: a volume created by 2.0.1 with the old mount gets the migration once (not again on restart) and keeps its settings; the same volume moved to the new path keeps its data; a fresh volume with the new layout starts healthy. - README and CHANGELOG (Unreleased) describe the new path and how to switch. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
60 lines
2.2 KiB
Bash
Executable File
60 lines
2.2 KiB
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
cd /app
|
|
|
|
# Auto-generate APP_KEY if not provided
|
|
if [ -z "$APP_KEY" ]; then
|
|
echo "[entrypoint] No APP_KEY set, generating one..."
|
|
APP_KEY=$(php artisan key:generate --show)
|
|
export APP_KEY
|
|
echo "[entrypoint] Generated APP_KEY: $APP_KEY"
|
|
echo "[entrypoint] WARNING: Set this APP_KEY in your docker-compose.yml to persist across restarts!"
|
|
fi
|
|
|
|
# Generate PHP ini from environment variables (with defaults)
|
|
echo "[entrypoint] Configuring PHP settings..."
|
|
cat > /usr/local/etc/php/conf.d/99-uploads.ini <<EOF
|
|
upload_max_filesize = ${PHP_UPLOAD_MAX_FILESIZE:-64M}
|
|
post_max_size = ${PHP_POST_MAX_SIZE:-64M}
|
|
max_execution_time = ${PHP_MAX_EXECUTION_TIME:-300}
|
|
max_input_time = ${PHP_MAX_INPUT_TIME:-300}
|
|
memory_limit = ${PHP_MEMORY_LIMIT:-512M}
|
|
EOF
|
|
|
|
# A docker-compose.yml from before 2.1.1 mounts the SQLite volume over all of /app/database, so the
|
|
# migrations folder is the one the volume was created with: add this image's newer migrations to it.
|
|
for migration in docker/migrations/*.php; do
|
|
if [ ! -e "database/migrations/${migration##*/}" ]; then
|
|
echo "[entrypoint] Adding migration ${migration##*/} to the database volume..."
|
|
mkdir -p database/migrations
|
|
cp "$migration" database/migrations/
|
|
fi
|
|
done
|
|
|
|
echo "[entrypoint] Running database migrations..."
|
|
php artisan migrate --force
|
|
|
|
echo "[entrypoint] Creating storage link..."
|
|
php artisan storage:link --force
|
|
|
|
echo "[entrypoint] Caching configuration..."
|
|
php artisan config:cache
|
|
php artisan route:cache
|
|
php artisan view:cache
|
|
|
|
# Uploads are encrypted in the browser, which browsers only allow over HTTPS: either this container
|
|
# fetches a certificate for SERVER_NAME itself, or a reverse proxy in front terminates TLS.
|
|
if [ "${AUTO_HTTPS:-false}" = "true" ]; then
|
|
if [ -z "$SERVER_NAME" ]; then
|
|
echo "[entrypoint] AUTO_HTTPS=true needs SERVER_NAME, the domain to fetch a certificate for." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "[entrypoint] Starting Octane (FrankenPHP) with automatic HTTPS for $SERVER_NAME..."
|
|
exec php artisan octane:frankenphp --host="$SERVER_NAME" --port=443 --https --http-redirect
|
|
fi
|
|
|
|
echo "[entrypoint] Starting Octane (FrankenPHP) on HTTP..."
|
|
exec php artisan octane:frankenphp --host=0.0.0.0 --port=80
|