Smart Enviro Backend ships with a production-readyDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/GaelCeballos/Smart_Enviro_Backend/llms.txt
Use this file to discover all available pages before exploring further.
Dockerfile based on the official php:8.4-apache image. The build installs all system-level dependencies, compiles the PHP extensions required by Laravel (pdo_mysql, mbstring, exif, pcntl, bcmath, gd), enables Apache’s mod_rewrite module for clean URL routing, and sets the Apache document root to Laravel’s public/ directory. Composer dependencies are installed without dev packages using --no-dev --optimize-autoloader, and storage directories are pre-configured with the correct www-data ownership and 775 permissions.
Environment Variables
Configure your.env (or equivalent secrets manager) with the following variables before starting any container.
App
| Variable | Default | Description |
|---|---|---|
APP_NAME | Laravel | Human-readable application name. |
APP_ENV | local | Set to production in live deployments. |
APP_KEY | (empty) | Base-64 encryption key — generate with artisan key:generate. |
APP_DEBUG | true | Set to false in production to suppress stack traces. |
APP_URL | http://localhost | Publicly accessible base URL of the API. |
Database
| Variable | Default | Description |
|---|---|---|
DB_CONNECTION | sqlite | Set to mysql when using the MySQL container. |
DB_HOST | 127.0.0.1 | Hostname of the MySQL service (e.g. mysql inside Sail). |
DB_PORT | 3306 | MySQL port. |
DB_DATABASE | laravel | Name of the target database. |
DB_USERNAME | root | MySQL user. |
DB_PASSWORD | (empty) | MySQL password. |
Redis
| Variable | Default | Description |
|---|---|---|
REDIS_CLIENT | phpredis | PHP Redis driver — phpredis or predis. |
REDIS_HOST | 127.0.0.1 | Hostname of the Redis service (e.g. redis inside Sail). |
REDIS_PASSWORD | null | Redis AUTH password; null disables authentication. |
REDIS_PORT | 6379 | Redis port. |
Cache / Queue / Session
| Variable | Default | Description |
|---|---|---|
CACHE_STORE | database | Cache backend — switch to redis for better performance. |
QUEUE_CONNECTION | database | Queue driver — switch to redis for a dedicated queue. |
SESSION_DRIVER | database | Session storage backend. |
| Variable | Default | Description |
|---|---|---|
MAIL_MAILER | log | Mail transport — log writes to Laravel logs, use smtp in production. |
MAIL_HOST | 127.0.0.1 | SMTP server hostname. |
MAIL_PORT | 2525 | SMTP port. |
MAIL_USERNAME | null | SMTP authentication username. |
MAIL_PASSWORD | null | SMTP authentication password. |
Laravel Sail (Development)
Laravel Sail orchestrates the app, MySQL 8.4, and Redis Alpine containers via Docker Compose. It is the recommended workflow for local development and staging environments.Configure environment variables
Copy At minimum, set
.env.example to .env and update the database and Redis credentials:DB_CONNECTION=mysql and uncomment and fill in DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, and DB_PASSWORD.Start all services
| Service | Environment variable | Default port |
|---|---|---|
| Laravel app | APP_PORT | 80 |
| MySQL 8.4 | FORWARD_DB_PORT | 3306 |
| Redis Alpine | FORWARD_REDIS_PORT | 6379 |
.env before running sail up.Production Docker Build
Use the includedDockerfile to build a self-contained image suitable for any container platform (Docker Engine, ECS, Cloud Run, Fly.io, etc.).
Build the image:
The In orchestrated environments (Kubernetes, ECS) this is best handled as an init container or a one-off task before the main container starts receiving traffic.
Dockerfile does not run artisan migrate automatically. After starting the container, run migrations against your target database:Post-Deploy Checklist
Set production environment flags
Ensure the following values are set in your production
.env or secrets manager:APP_DEBUG=false prevents sensitive stack traces and configuration details from leaking in API error responses.Run database migrations
--force flag is required to bypass the interactive prompt that Laravel shows when running migrations in production.Set storage permissions
The
Dockerfile pre-sets permissions for storage/ and bootstrap/cache/, but if you mount a volume over these directories in production you may need to re-apply: