Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AlexanderDamont1/Stratus/llms.txt

Use this file to discover all available pages before exploring further.

This guide covers deploying Stratus to a production server running Apache or Nginx. Follow the steps in order for a clean first-time deployment.

Pre-deployment checklist

Before going live, verify the following .env values:
APP_ENV=production
APP_DEBUG=false
APP_KEY=base64:...
APP_URL=https://yourdomain.com
Leaving APP_DEBUG=true in production exposes stack traces, environment variables, and internal file paths to end users.
Also confirm:
  • DB_* variables point to your production database.
  • MAIL_* variables are set to a real SMTP provider.
  • SESSION_DRIVER=database (recommended for all production deployments).
  • QUEUE_CONNECTION=database if you need background job processing.

First-time setup

1

Install dependencies and build assets

The setup script handles the full first-time installation:
composer run setup
This runs the following commands in sequence:
composer install
cp .env.example .env   # only if .env does not already exist
php artisan key:generate
php artisan migrate --force
npm install
npm run build
2

Set file permissions

The web server process must be able to write to storage/ and bootstrap/cache/:
chmod -R 775 storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
Replace www-data with the user your web server runs as (e.g. nginx, apache, or caddy).
3

Configure your web server

Point your web server’s document root to the public/ directory. See the web server configuration section below.
4

Start the queue worker

If you are using QUEUE_CONNECTION=database, start a supervised queue worker. See Queue worker in production.

Subsequent deployments

For updates after the initial install:
# Pull the latest code
git pull origin main

# Install/update PHP dependencies
composer install --no-dev --optimize-autoloader

# Run any new migrations
php artisan migrate --force

# Rebuild frontend assets
npm ci
npm run build

# Clear and re-cache configuration
php artisan config:cache
php artisan route:cache
php artisan view:cache

# Restart the queue worker
php artisan queue:restart

Web server configuration

The public/ directory is the only directory that should be publicly accessible. All application code, configuration, and the .env file sit above the document root.
server {
    listen 80;
    server_name yourdomain.com;
    root /var/www/stratus/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";

    index index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    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;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_hide_header X-Powered-By;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

Queue worker in production

When QUEUE_CONNECTION=database, jobs are stored in the jobs table and must be processed by a long-running worker. Use a process supervisor such as Supervisor to keep the worker running and restart it automatically. Example Supervisor configuration (/etc/supervisor/conf.d/stratus-worker.conf):
[program:stratus-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/stratus/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/stratus/storage/logs/worker.log
stopwaitsecs=3600
Activate the configuration:
supervisorctl reread
supervisorctl update
supervisorctl start stratus-worker:*
After deploying new code, tell the running worker to exit gracefully so Supervisor restarts it with the updated code:
php artisan queue:restart
If you set QUEUE_CONNECTION=sync, jobs run synchronously in the web request and no worker is needed. This is acceptable for low-traffic deployments but will slow down HTTP responses when jobs are heavy.

Cache configuration for production

CACHE_DRIVER=file
The file driver works out of the box. For better performance under load, switch to redis:
CACHE_DRIVER=redis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
Cache application configuration, routes, and views to reduce I/O on each request:
php artisan config:cache
php artisan route:cache
php artisan view:cache
To clear all caches:
php artisan optimize:clear

Session driver recommendation

Use SESSION_DRIVER=database in production. It is the most reliable option for both single-server and load-balanced multi-server deployments because session data is stored centrally in the database rather than on local disk. For very high-traffic deployments, Redis is a faster alternative:
SESSION_DRIVER=redis

Environment variables security

The .env file must not be web-accessible. If your document root is correctly set to public/, the file is already out of reach. Verify with:
curl -I https://yourdomain.com/.env
# Should return 404 or 403, never 200
In containerised or managed hosting environments (Docker, Kubernetes, Heroku, Forge), you can inject environment variables directly into the process rather than using a .env file. Laravel reads from the OS environment first. Cache configuration after setting them:
php artisan config:cache
If APP_KEY is ever compromised, generate a new one:
php artisan key:generate
This will invalidate all existing encrypted values, including sessions and cookies, logging all users out.

Build docs developers (and LLMs) love