V2
This commit is contained in:
1 parent
3883abbc85
commit
056f95384c
30 files changed
No files matched your search
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Mounted volumes are usually root-owned, so www-data could not write into storage and bootstrap/cache.
|
||||
cd "${APP_ROOT:-/var/www/html}" || exit 0
|
||||
|
||||
for dir in storage bootstrap/cache; do
|
||||
if [ -d "$dir" ] && [ "$(stat -c %U "$dir")" != "www-data" ]; then
|
||||
chown -R www-data:www-data "$dir"
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
for ini in "${PHP_INI_DIR}"/conf.d/*opcache.ini; do
|
||||
if [ "$(echo "$APP_DEBUG" | tr '[:upper:]' '[:lower:]')" = "false" ]; then
|
||||
sed -ri -e "s!opcache.validate_timestamps=.*!opcache.validate_timestamps=${PHP_OPCACHE_VALIDATE_TIMESTAMPS:-1}!g" "$ini"
|
||||
else
|
||||
sed -ri -e 's!opcache.enable=1!opcache.enable=0!g' "$ini"
|
||||
fi
|
||||
done
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# Composer dependencies
|
||||
[ -f composer.json ] || exit 0
|
||||
|
||||
if [ "$init" = "true" ] || [ "$(echo "$APP_DEBUG" | tr '[:upper:]' '[:lower:]')" = "true" ]; then
|
||||
echo "Initial setup nebo debug mód - instalace Composeru s dev závislostmi"
|
||||
composer install --prefer-dist --optimize-autoloader
|
||||
else
|
||||
echo "Produkční instalace - Composer bez dev závislostí"
|
||||
composer install --prefer-dist --no-dev --optimize-autoloader
|
||||
fi
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
# Prepares .env. When /config is mounted, .env is restored from /config/.env and saved there on first creation.
|
||||
cd "${APP_ROOT:-/var/www/html}" || exit 0
|
||||
|
||||
[ -f artisan ] || exit 0
|
||||
|
||||
if [ -d /config ] && [ -f /config/.env ]; then
|
||||
echo "Using existing /config/.env"
|
||||
cp /config/.env .env
|
||||
elif [ ! -f .env ] && [ -f .env.example ]; then
|
||||
echo "Creating .env from example"
|
||||
cp .env.example .env
|
||||
chown "$(stat -c %u:%g .env.example)" .env
|
||||
if [ -d /config ]; then
|
||||
cp .env /config/.env
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# Generates APP_KEY only when none exists yet (env or .env), so an existing key is never rotated.
|
||||
cd "${APP_ROOT:-/var/www/html}" || exit 0
|
||||
|
||||
[ -f artisan ] || exit 0
|
||||
[ -f .env ] || exit 0
|
||||
[ -n "$APP_KEY" ] && exit 0
|
||||
|
||||
if ! grep -Eq '^APP_KEY=.+' .env; then
|
||||
echo "Generating application key"
|
||||
php artisan key:generate --force --no-interaction
|
||||
[ -d /config ] && cp .env /config/.env
|
||||
fi
|
||||
exit 0
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
# Clear Laravel caches
|
||||
[ -f artisan ] || exit 0
|
||||
|
||||
echo "Clearing Laravel caches"
|
||||
php artisan cache:clear
|
||||
php artisan config:clear
|
||||
php artisan route:clear
|
||||
php artisan view:clear
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
# SQLite database initialization
|
||||
if { grep -iq "^DB_CONNECTION=sqlite" .env && [ "$DB_CONNECTION" = "sqlite" ]; } || [ "$DEPLOY_ENV" = "sqlite" ]; then
|
||||
if [ ! -f database/database.sqlite ]; then
|
||||
echo "Creating empty SQLite database"
|
||||
touch database/database.sqlite
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Link storage and seed database if first init
|
||||
[ -f artisan ] || exit 0
|
||||
|
||||
echo "Linking storage directory"
|
||||
php artisan storage:link
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Migrate database
|
||||
[ -f artisan ] || exit 0
|
||||
|
||||
echo "Running database migrations"
|
||||
php artisan migrate --force --no-interaction
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
cat > /etc/supervisor/supervisord.conf <<'EOF'
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/var/log/supervisor/supervisord.log
|
||||
|
||||
[include]
|
||||
files = /etc/supervisor/conf.d/*.conf
|
||||
EOF
|
||||
|
||||
# nodaemon=true keeps supervisord in the foreground, so detach it here
|
||||
supervisord -c /etc/supervisor/supervisord.conf &
|
||||
Reference in new issue
Block a user