# Deploy Laravel

> Deploy a Laravel app on Ownkube in minutes. Push your repo and Ownkube builds and ships it, with a live URL and automatic TLS. Managed Postgres and env vars included.

Deploy a [Laravel](https://laravel.com/) app on Ownkube in minutes. Push your repo and Ownkube builds it and ships it, and you get a live URL with automatic TLS. Managed Postgres, logs, metrics, and one-click rollbacks come built in. No cloud account to start.

## What you'll need

- A [Laravel](https://laravel.com/) app in a GitHub or GitLab repository
- About five minutes

No card required to sign in and look around. Deploying needs a plan: **Personal** is \$5 / month on a prepaid wallet. See [Pricing](/docs/configuration/pricing).

## Deploy it

1. **Connect your repo**

   Sign in at [app.ownkube.io/login](https://app.ownkube.io/login), open [**Settings**](https://app.ownkube.io/dashboard/settings), and connect the GitHub App (or GitLab) so Ownkube can reach your repository. Already have a prebuilt image in a registry? Point Ownkube at it instead. See [Registries](/docs/features/registries).

2. **Create a Web deployment**

   From your [dashboard](https://app.ownkube.io/dashboard), choose **Create deployment**, pick **Web**, and select your Laravel repo. Ownkube builds it and pushes the image to a registry it manages for you.

3. **Set the port**

   Laravel apps commonly serve on port **8000**. Set that as the port so traffic routes to your app. You can change it later in Settings.

4. **Add environment variables**

   Set `APP_KEY`, `APP_ENV=production`, `APP_DEBUG=false`, and your database connection variables. Mark secrets with the **Secret** toggle. See [Environment variables](/docs/guides/environment-variables).

5. **Deploy**

   Click **Create deployment**. The deployment page streams the build, then startup and health checks. When the status goes **healthy**, open the generated hostname on the Overview tab. Your Laravel app is live, with TLS included.

## Run migrations

Run `php artisan migrate` before your app serves traffic. Ownkube's [Jobs](/docs/features/jobs) resource runs a container to completion, so a migration Job is the right place for `artisan migrate` rather than running it at request time or on every container start.

## Notes for Laravel

### Port 8000

Laravel apps commonly serve on port 8000. Set that as the port to match whatever port your app actually listens on.

### APP_KEY and production env

Set `APP_KEY`, `APP_ENV=production`, and `APP_DEBUG=false` before your first deploy. Laravel needs `APP_KEY` to encrypt sessions and cookies.

### Migrations as a Job

Run `php artisan migrate` as a [Job](/docs/features/jobs) before or alongside a deploy, instead of on every container start.

### Postgres now, MySQL coming soon

Ownkube's managed database today is Postgres. Point Laravel's `DB_CONNECTION` at `pgsql`. Managed MySQL is coming soon.

### Bring your own Dockerfile

Want full control of the build? Add a `Dockerfile` to your repo and Ownkube uses it, reading the port from its `EXPOSE` line.

## Add a database

Need a database today? Add a managed Postgres **Database** in one click and Ownkube injects the connection string as `DATABASE_URL` (plus `PGHOST`, `PGUSER`, and friends) into your app. Set `DB_CONNECTION=pgsql` and map the pieces into Laravel's database config. See [Databases](/docs/features/databases).

## Scale and observe

Once you're running, turn on [autoscaling](/docs/features/autoscaling) on CPU and memory, watch [logs and metrics](/docs/features/monitoring) on every deployment, and roll back a bad deploy in one click.

- [Scheduled jobs](/docs/features/jobs)
- [Environment variables](/docs/guides/environment-variables)

---

**Don't see a feature you need?** Email [support@ownkube.io](mailto:support@ownkube.io?subject=Feature%20request). Ownkube is shaped by the teams using it and we ship what our users ask for.
