Skip to main content
The Laravel Go quickstart 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.

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 to compile your frontend assets, then your application:
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.

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 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:
You may run commands from your environment’s Commands tab, or use them in your deploy commands and background processes.

Run migrations

New environments include a commented-out deploy command that runs your migrations:
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. To use Laravel MySQL 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, 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. 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. 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, Cloud wakes it to run scheduled tasks.

Other resources

  • Object storage: When you attach a bucket, 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 cluster, Cloud sets BROADCAST_CONNECTION=reverb and the REVERB_* variables your application needs.
  • Email: When you attach email, 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 with their levels. Set LOG_LEVEL to change which levels Laravel Go records. It defaults to info. Issues doesn’t capture errors from Laravel Go applications yet. Errors your application reports appear in your logs.