Initial commit

This commit is contained in:
boboko
2026-07-03 13:46:54 +00:00
commit cbad03bf8f
125 changed files with 20420 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
#!/bin/sh
set -e
# In development, install Composer deps if vendor is not present
if [ "$APP_ENV" != "production" ] && [ ! -f vendor/autoload.php ]; then
echo "[entrypoint] Installing Composer dependencies..."
git config --global --add safe.directory /var/www/html 2>/dev/null || true
composer install --no-interaction --prefer-dist
fi
# In development, the app dir is bind-mounted from a fresh checkout, so package
# assets (which the Dockerfile publishes at build time in production) need to be
# generated here instead. Cheap and idempotent, safe to repeat on every boot.
if [ "$APP_ENV" != "production" ]; then
php artisan vendor:publish --tag=core-assets --force --ansi --quiet
php artisan vendor:publish --tag=public --force --ansi --quiet
php artisan filament:assets --ansi --quiet
fi
# Everything below runs on every boot of app/queue/scheduler, possibly concurrently,
# so it must be idempotent and safe to run from multiple containers at once.
# Migrations, package publishing, and config/route/view caching are deploy-time
# concerns handled once via Envoy, not here.
mkdir -p storage/app/public storage/framework/cache storage/framework/sessions storage/framework/views storage/logs bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cache
php artisan storage:link --quiet 2>/dev/null || true
exec "$@"
+48
View File
@@ -0,0 +1,48 @@
server {
listen 80;
server_name _;
root /var/www/html/public;
index index.php;
client_max_body_size 100M;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
resolver 127.0.0.11 valid=5s;
set $upstream app:9000;
fastcgi_pass $upstream;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_read_timeout 300;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
location /stoic/ {
proxy_pass http://stoic:2727/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cookie_path / /stoic/;
}
location ~ /\.(?!well-known).* {
deny all;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
}
+110
View File
@@ -0,0 +1,110 @@
fastcgi_cache_path /tmp/fcgi_cache levels=1:2 keys_zone=app_cache:10m max_size=256m inactive=10m use_temp_path=off;
upstream php_fpm {
server app:9000;
keepalive 16;
}
server {
listen 80;
server_name _;
root /var/www/html/public;
index index.php;
client_max_body_size 100M;
charset utf-8;
open_file_cache max=5000 inactive=30s;
open_file_cache_valid 60s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
# --- FastCGI cache bypass rules ---
set $skip_cache 0;
if ($request_method = POST) { set $skip_cache 1; }
if ($request_uri ~* "^/(boboko|up)") { set $skip_cache 1; }
if ($query_string) { set $skip_cache 1; }
# Vite build assets — content-hashed filenames, safe to cache forever
location /build/ {
add_header Cache-Control "public, max-age=31536000, immutable";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
try_files $uri =404;
}
location /static/ {
add_header Cache-Control "public, max-age=31536000, immutable";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
try_files $uri =404;
}
location /packages/ {
add_header Cache-Control "public, max-age=31536000, immutable";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
try_files $uri =404;
}
# User media — served directly from the storage volume (no symlink needed)
location /storage/ {
alias /var/www/html/storage/app/public/;
add_header Cache-Control "public, max-age=31536000, immutable";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
try_files $uri =404;
}
location / {
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass php_fpm;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_read_timeout 300;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_keep_conn on;
fastcgi_cache app_cache;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_valid 200 10m;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
add_header X-Cache-Status $upstream_cache_status;
}
location /stoic/ {
proxy_pass http://stoic:2727/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cookie_path / /stoic/;
}
location ~ /\.(?!well-known).* {
deny all;
}
location = /sitemap.xml {
root /var/www/html/storage/app;
try_files /sitemap.xml =404;
add_header Cache-Control "public, max-age=3600";
add_header Content-Type "application/xml; charset=utf-8";
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
}
+30
View File
@@ -0,0 +1,30 @@
receivers:
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
processors:
batch:
timeout: 5s
send_batch_size: 512
exporters:
otlphttp:
endpoint: ${env:SIGNOZ_ENDPOINT}
compression: gzip
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp]
+7
View File
@@ -0,0 +1,7 @@
[www]
; Static workers: no spawn latency under load.
; Rule of thumb: (available container RAM in MB) / ~60 = max_children
; At 512MB container: 8, at 1GB: 16. Start conservative.
pm = static
pm.max_children = 8
pm.max_requests = 500
+10
View File
@@ -0,0 +1,10 @@
upload_max_filesize = 100M
post_max_size = 100M
memory_limit = 256M
max_execution_time = 60
[opcache]
opcache.enable = 1
opcache.memory_consumption = 128
opcache.validate_timestamps = 1
opcache.revalidate_freq = 0
+14
View File
@@ -0,0 +1,14 @@
upload_max_filesize = 100M
post_max_size = 100M
memory_limit = 256M
max_execution_time = 60
[opcache]
opcache.enable = 1
opcache.memory_consumption = 256
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 20000
opcache.revalidate_freq = 0
opcache.validate_timestamps = 0
opcache.jit = 1255
opcache.jit_buffer_size = 64M
+21
View File
@@ -0,0 +1,21 @@
base_path: /stoic
auth:
mode: session
validate_url: http://app:9000/validate
cookie: laravel_session
content_path: /content
media_path: /media
thumbs_path: /var/www/html/storage/app/public/stoic/
repository_path: /app
presets:
- code: large
mode: resize
width: 1200
- code: medium
mode: resize
width: 800
- code: small
mode: resize
width: 420