Initial commit - Tabeley Backend

This commit is contained in:
Zaki-Malla
2026-02-17 19:33:49 +03:00
commit 3c885722f3
109 changed files with 14520 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
#!/usr/bin/env sh
set -e
cd /var/www
echo "🚀 Starting Tabeley Production Container..."
# Create .env if not exists
if [ ! -f .env ]; then
cp .env.example .env
fi
# Function to safely update env values
set_env() {
key="$1"
value="$2"
if [ -n "$value" ]; then
if grep -q "^${key}=" .env; then
sed -i "s|^${key}=.*|${key}=${value}|" .env
else
echo "${key}=${value}" >> .env
fi
fi
}
# Inject runtime environment variables
set_env DB_CONNECTION "${DB_CONNECTION}"
set_env DB_HOST "${DB_HOST}"
set_env DB_PORT "${DB_PORT}"
set_env DB_DATABASE "${DB_DATABASE}"
set_env DB_USERNAME "${DB_USERNAME}"
set_env DB_PASSWORD "${DB_PASSWORD}"
set_env DATABASE_URL "${DATABASE_URL}"
set_env APP_ENV "${APP_ENV}"
set_env APP_DEBUG "${APP_DEBUG}"
set_env APP_URL "${APP_URL}"
# Laravel setup
php artisan config:clear || true
if [ -z "$APP_KEY" ]; then
php artisan key:generate --force --no-interaction || true
fi
php artisan storage:link || true
# Run migrations only if enabled
if [ "${RUN_MIGRATIONS}" = "true" ]; then
echo "📦 Running migrations..."
php artisan migrate --force --no-interaction || true
fi
# Cache for production performance
php artisan config:cache || true
php artisan route:cache || true
php artisan view:cache || true
echo "✅ Container ready."
exec "$@"
+26
View File
@@ -0,0 +1,26 @@
server {
listen 80;
server_name _;
root /var/www/html/public;
index index.php index.html;
client_max_body_size 20M;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/public$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /var/www/html/public;
fastcgi_read_timeout 300;
}
location ~* \.(jpg|jpeg|png|gif|css|js|ico|svg|webp)$ {
expires 30d;
access_log off;
}
}