# Deployment ## Requirements - PHP 8.3 with cURL, mbstring, PDO for the selected database, and ZIP extensions. - Composer 2, Node.js 22, npm, and a supported SQLite or MySQL database for a manual install. - HTTPS termination, persistent private storage, scheduled commands, and a queue worker for a public deployment. - Outbound network access restricted to the services the operator intends to connect. The included container image installs PHP 8.3, cURL, mbstring, PDO MySQL, ZIP, and Poppler utilities. Docker Compose starts MySQL 8.4, the web process, a database queue worker, and the scheduler. Its web port is bound to loopback by default. Put a TLS reverse proxy in front and expose only that proxy to the internet. ## First launch with Docker Compose 1. Install Docker Engine and the Compose plugin on the target host. 2. Copy `.env.example` to `.env`. 3. Set a unique `APP_KEY`, strong database and root passwords, the public HTTPS `APP_URL`, and `SESSION_SECURE_COOKIE=true`. 4. Keep `.env` private and outside source control. Do not reuse credentials across installations. 5. Run `docker compose up --build -d` from the application directory. 6. Route the TLS proxy to `127.0.0.1:8088` and configure its forwarded-protocol headers. 7. Open `/install`, select the configured database, and create the first owner. 8. Confirm sign-in, then restrict access to `/install` at the edge if desired. The app redirects away after setup is complete. Compose runs migrations when the web container starts. The worker and scheduler wait for the database to be ready. Check `docker compose ps` and the container logs when a service does not become healthy. ## Manual installation 1. Create a dedicated database and database account with schema and data permissions limited to that database. 2. Install PHP dependencies with `composer install --no-dev --prefer-dist --optimize-autoloader`. 3. Install frontend dependencies with `npm ci`, then run `npm run build`. 4. Copy `.env.example` to `.env`, set `APP_ENV=production`, `APP_DEBUG=false`, `APP_URL`, a unique key, database settings, and secure-cookie settings. 5. Run `php artisan key:generate` once, then `php artisan migrate --force`. 6. Point the web server document root at `public/`; deny access to `.env`, source files, storage, and vendor directories. 7. Make `storage` and `bootstrap/cache` writable by the application process. Keep uploaded files on private storage. 8. Start a supervised queue worker: `php artisan queue:work database --sleep=2 --tries=2 --timeout=75`. 9. Schedule `php artisan schedule:run` once per minute. 10. Open `/install` and finish owner setup. Do not use Laravel's development server for public traffic. Use a maintained web server and PHP process manager, TLS, a dedicated unprivileged operating-system account, and a firewall that blocks unneeded inbound and outbound traffic. ## Environment settings | Setting | Purpose | | --- | --- | | `APP_KEY` | Encrypts application secrets. Keep it private and back it up securely. Changing it can make saved credentials unreadable. | | `APP_URL` | Canonical public URL, including `https://`. | | `APP_DEBUG` | Must be `false` in public deployments. | | `DB_CONNECTION`, `DB_HOST`, `DB_PORT`, `DB_DATABASE`, `DB_USERNAME`, `DB_PASSWORD` | Database driver and credentials. | | `SESSION_SECURE_COOKIE` | Set to `true` when public traffic uses HTTPS. | | `QUEUE_CONNECTION` | Defaults to the database queue. The included worker expects this configuration. | | `MAIL_*` | Platform mail configuration used by password recovery and system mail. Company support mail is configured separately in the workspace. | | `STRIPE_SECRET`, `STRIPE_WEBHOOK_SECRET` | Optional Stripe billing credentials. | | `PLATFORM_ADMIN_EMAILS` | Comma-separated operator account email addresses. | | `PLATFORM_MODEL_PROVIDERS` | Operator-side provider credentials and model pricing in JSON form. Keep it out of public files and logs. | | `PLATFORM_MODEL_CREDITS_PER_USD` | Credit conversion rate for operator-paid model usage. | | `LICENSE_ENFORCE` | Keep `true` for buyer installations. Set `false` only for an operator-controlled deployment. | | `LICENSE_CHANNEL` | `envato` or `codester`; choose the channel used for this release. | | `ENVATO_ITEM_ID` | Required for Envato activation; the numeric item ID for this product. The buyer enters the purchase code and personal token on the activation page. | | `LICENSE_SERVER_URL`, `LICENSE_SERVER_PUBLIC_KEY` | Required for Codester/direct activation. Replace the example HTTPS URL and configure the Base64 Ed25519 public key matching the buyer's verification service. | ### Provider credential setup Company owners using their own provider accounts add credentials in workspace settings, validate the connection, and choose from discovered models. The application encrypts these credentials in the database. Keep the application key backed up because saved credentials depend on it. For operator-funded access, set `PLATFORM_MODEL_PROVIDERS` as a JSON object keyed by provider name. Each provider entry needs `api_key` and a `models` object. Each enabled model must use the exact discovered model ID and include `input_cost_per_million` and `output_cost_per_million`, in USD. An optional `base_url` is available for compatible endpoints. For example: ```dotenv PLATFORM_MODEL_PROVIDERS='{"openai":{"api_key":"replace-with-secret","models":{"model-id-from-provider":{"input_cost_per_million":1.0,"output_cost_per_million":4.0}}}}' ``` Replace the example provider and model values with IDs returned by that provider account. Only discovered chat models with the required instruction support and configured rates are made available for credit usage. Restart the application after changing environment settings and clear Laravel's cached configuration when applicable. Keep provider credentials and rates aligned with current provider pricing; credit estimates may differ from the provider invoice. The application does not create external accounts or provision secrets for you. See [Connections](INTEGRATIONS.md) for supported company connections and provider behavior, and [Licensing and activation](LICENSE-ACTIVATION.md) for buyer activation steps. ## Storage, backups, and recovery Uploaded documents and attachments use the configured private local disk. Store `storage/app/private` on persistent private storage and include it with the database in encrypted, access-controlled backups. Test restoration to a separate environment before relying on a backup. Do not serve private upload paths directly from the web root. Keep independent copies of the application key and database backup. Restrict backup access and retention. A database-only restore can leave document records without their files; a file-only restore can leave unreferenced files. ## Domain and TLS Custom-domain verification publishes a DNS TXT challenge. After verification, route the domain to the deployment and install a valid TLS certificate at the edge before activating it in platform settings. The app can redirect HTTP requests on an activated host to HTTPS; it does not change DNS or issue certificates. ## Operations Monitor web, worker, scheduler, database, disk, and outbound request health. Queue delivery and scheduled workflows stop when their worker or scheduler is stopped. Set log rotation and alert on repeated job failures. Keep PHP, Composer packages, Node packages, database images, and the host operating system patched.