Files
sides/docs/08-CONFIGURATION.md
root 9122deaacd fix: seeder idempotent with firstOrCreate
Use firstOrCreate instead of create so db:seed can run safely
on container restart without duplicate key violation.
2026-05-21 02:31:47 +08:00

3.9 KiB

Configuration Reference

Environment Variables

Application Settings

Variable Default Description
APP_NAME SIDES Application name
APP_ENV local Environment (local/production)
APP_KEY (generated) Encryption key
APP_DEBUG true Show debug errors
APP_URL https://sides.tck.com.my Application URL
APP_LOCALE en Default language
APP_TIMEZONE Asia/Kuala_Lumpur Timezone (set in config/app.php)

Database

Variable Value Description
DB_CONNECTION pgsql Database driver
DB_HOST 192.168.0.211 Database host (external IP)
DB_PORT 5432 PostgreSQL port
DB_DATABASE sides_db Database name (via POSTGRES_DB)
DB_USERNAME tck Database user (via POSTGRES_USER)
DB_PASSWORD projectdev##1 Database password (via POSTGRES_PASSWORD)

Docker-level Database

Variable Value Description
POSTGRES_DB tckdev Docker postgres database name
POSTGRES_USER tck Docker postgres user
POSTGRES_PASSWORD projectdev##1 Docker postgres password

Note: There is a discrepancy — Docker .env creates database tckdev while Laravel .env connects to sides_db on an external host.

Firebase / FCM

Variable Description
FIREBASE_PROJECT_ID sides-b4abb
FIREBASE_CREDENTIALS storage/app/firebase/sides-b4abb-3604a7cf7584.json
FCM_TOPIC_RAINFALL_WARNING rainfall_warning
FCM_TOPIC_RAINFALL_DANGER rainfall_danger
FCM_TOPIC_WATERLEVEL_ALERT waterlevel_alert
FCM_TOPIC_WATERLEVEL_DANGER waterlevel_danger

Mail (SMTP)

Variable Value Description
MAIL_MAILER smtp Mail driver
MAIL_HOST smtp.gmail.com Gmail SMTP
MAIL_PORT 587 SMTP port (TLS)
MAIL_USERNAME sideskupang@gmail.com Gmail account
MAIL_PASSWORD ipmu zifw bpmf fsyp Gmail App Password
MAIL_FROM_ADDRESS sideskupang@gmail.com From address
MAIL_FROM_NAME ${APP_NAME} From name

Session & Cache

Variable Value Description
SESSION_DRIVER database Session storage
SESSION_LIFETIME 120 Session timeout (minutes)
CACHE_STORE database Cache storage
QUEUE_CONNECTION database Queue driver

Docker Compose Configuration

Networks

  • tckdev_net — Custom bridge network for all containers

Volumes

Volume Container Purpose
./src:/var/www/html app, web Laravel application code
./docker/postgres/data:/var/lib/postgres/data postgres PostgreSQL data
./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf web Nginx config
./backup:/var/lib/pgadmin/storage/... pgadmin pgAdmin backup storage

Ports

Host Port Container Port Service
80 80 Nginx (web)
5432 5432 PostgreSQL
5050 80 pgAdmin
6060 8080 Adminer

Nginx Configuration

Located at docker/nginx/default.conf:

  • Root: /var/www/html/public
  • PHP processing via FastCGI to app:9000
  • Security headers: X-Frame-Options, X-XSS-Protection, X-Content-Type-Options
  • Laravel URL rewriting: try_files $uri $uri/ /index.php?$query_string
  • Hidden file access denied (except .well-known)

Laravel Configuration

Middleware Registration

Registered in bootstrap/app.php:

  • adminAdminMiddleware::class (alias)
  • LocalizationMiddleware appended to web middleware group

HTTPS Forcing

AppServiceProvider::boot() calls URL::forceScheme('https') globally, making all generated URLs use HTTPS.

Timezone

Set to Asia/Kuala_Lumpur in config/app.php (UTC+8, Malaysia Time).