> ## Documentation Index
> Fetch the complete documentation index at: https://cloud.laravel.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Laravel Go deploy guide

> Configure your Laravel Go application for production on Laravel Cloud.

The [Laravel Go quickstart](https://cloud.laravel.com/docs/quickstart.md#laravel-go) walks you through your first deployment to Laravel Cloud. Once your application is up and running, this guide helps you get it ready for production. We'll cover how Cloud builds and runs your application, and how to connect databases, caches, queues, and the other resources your application uses.

Laravel Go is the Go implementation of the Laravel framework. Cloud recognizes Laravel Go applications and configures them for you, so you don't need the port, shutdown, or proxy code described in the [Go deploy guide](https://cloud.laravel.com/docs/deploy-guides/go.md).

## Build your application

### Detection

Cloud detects a Laravel Go application when the `go.mod` file at the root of your repository requires `go.laravel.com`. Cloud reads your Go version from the `go` directive in that file. Laravel Go requires Go 1.27 or later.

### Build commands

Cloud pre-fills your environment's [build commands](https://cloud.laravel.com/docs/environments.md#build-commands) to compile your frontend assets, then your application:

```sh theme={"theme":{"light":"min-light","dark":"material-theme-palenight"}}
npm ci --audit false
npm run build

CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o app .
```

The `go build` command compiles your application into a single binary named `app`. Cloud sets `CGO_ENABLED=1` instead when it detects that your application needs cgo. If you change the output path or binary name, update your start command and deploy commands to match.

Because you compile in your build commands, there's nothing left to compile at runtime. Your application starts quickly when a new instance boots or when your environment wakes up after [scaling to zero](https://cloud.laravel.com/docs/compute.md#scale-to-zero).

## Run your application

Cloud sets your environment's start command to `./app`. Running the binary without arguments serves your application.

On Cloud, Laravel Go listens on the IPv6 wildcard address and the port Cloud provides through the `PORT` environment variable, and it trusts Cloud's proxies, so there is nothing to configure. When Cloud stops an instance, the server stops accepting new connections and waits up to 20 seconds for running requests to finish. To change that wait, set the `SERVER_SHUTDOWN_TIMEOUT` environment variable.

### Application key

Cloud generates an `APP_KEY` for each environment when you create it, and sets `APP_ENV=production`, `APP_DEBUG=false`, and `APP_URL` on every deployment. Keep each environment's key secret, and don't copy your local `.env` file's key to Cloud.

### Health checks

New Laravel Go applications serve a health route at `/up`, set by `Health: "/up"` in `bootstrap/app.go`. The route responds before any middleware runs. Point your environment's startup and readiness [health checks](https://cloud.laravel.com/docs/health-checks.md) at `/up` so a deployment goes live only once your application can serve requests.

## Run commands

Laravel Go compiles its console commands into your application's binary, so there is no `artisan` file. Run a command by passing it to your binary:

```sh theme={"theme":{"light":"min-light","dark":"material-theme-palenight"}}
./app migrate:status
```

You may run commands from your environment's [**Commands** tab](https://cloud.laravel.com/docs/environments.md#commands), or use them in your deploy commands and [background processes](https://cloud.laravel.com/docs/workers.md).

### Run migrations

New environments include a commented-out [deploy command](https://cloud.laravel.com/docs/environments.md#deploy-commands) that runs your migrations:

```sh theme={"theme":{"light":"min-light","dark":"material-theme-palenight"}}
# ./app migrate --force
```

When you attach a database, Cloud uncomments this command so your migrations run on every deployment. If you have changed your deploy commands, add the command yourself. The `--force` option skips the confirmation that Laravel Go asks for in production.

## Databases and caches

When you attach a database, Cloud sets the `DATABASE_URL` environment variable. Laravel Go compiles only the database driver your application registers in `bootstrap/app.go`. New applications register the Postgres driver, so they're ready for [Serverless Postgres](https://cloud.laravel.com/docs/resources/databases/postgres.md). To use [Laravel MySQL](https://cloud.laravel.com/docs/resources/databases/laravel-mysql.md) instead, replace `postgres.Driver` with `mysql.Driver` in `bootstrap/app.go`, then run `go mod tidy`.

When you attach a cache, such as [Laravel Valkey](https://cloud.laravel.com/docs/resources/caches/valkey.md), Cloud sets `REDIS_URL` and `CACHE_STORE=redis`. Without a cache, Laravel Go stores cached values in each instance's memory, so instances don't share them. If your application runs on more than one instance, attach a cache or set `CACHE_STORE` to another shared store, such as `database`.

## Queues

Laravel Go supports [managed queues](https://cloud.laravel.com/docs/queues.md). When you attach a managed queue, Cloud sets `QUEUE_CONNECTION=cloud` and the queue's configuration for you. Failed jobs appear in the Cloud dashboard, where you may retry them.

To process jobs on your own compute instead, add a queue worker to your App cluster or a [worker cluster](https://cloud.laravel.com/docs/workers.md). Cloud runs your binary's `queue:work` command, such as `./app queue:work database`. Without a managed queue, Laravel Go uses its `database` queue connection when your environment has a database.

## Task scheduling

To run your application's scheduled tasks, click your environment's App cluster or a worker cluster on the infrastructure canvas and enable the **Scheduler** toggle. Then, save and redeploy. Cloud runs `./app schedule:work`, which runs your due tasks every minute. When your environment [scales to zero](https://cloud.laravel.com/docs/compute.md#scale-to-zero), Cloud wakes it to run scheduled tasks.

## Other resources

* **Object storage:** When you attach a [bucket](https://cloud.laravel.com/docs/resources/object-storage.md), Cloud sets `LARAVEL_CLOUD_DISK_CONFIG`, and Laravel Go adds a disk for each bucket. Cloud also sets `FILESYSTEM_DISK` to your default bucket.
* **WebSockets:** When you attach a [Laravel Reverb](https://cloud.laravel.com/docs/resources/websockets.md) cluster, Cloud sets `BROADCAST_CONNECTION=reverb` and the `REVERB_*` variables your application needs.
* **Email:** When you attach [email](https://cloud.laravel.com/docs/resources/email.md), Cloud sets `MAIL_MAILER=resend` and the Resend variables.
* **Inertia SSR:** When editing your App cluster, toggle on the **Use Inertia SSR** option, then save and redeploy. Cloud runs the SSR server alongside your application and sets `INERTIA_SSR=true`.

## Logging

Cloud sets `LOG_CHANNEL=laravel-cloud-socket`, so your application's logs, scheduled command output, and reported errors stream to your environment's [logs](https://cloud.laravel.com/docs/logs.md) with their levels. Set `LOG_LEVEL` to change which levels Laravel Go records. It defaults to `info`.

[Issues](https://cloud.laravel.com/docs/issues.md) doesn't capture errors from Laravel Go applications yet. Errors your application reports appear in your logs.
