How to deploy a Laravel for Go app on Cloider App Engine
Deploy a Laravel for Go app with PostgreSQL on Cloider App Engine three ways: from the dashboard with a Dockerfile and a GitHub repository, with the cloider CLI, or with one prompt to an AI coding agent, with a screenshot of every step.

On this page
Key takeaways
- A Dockerfile builds the Vite frontend and a static Go binary, and ships a small Debian runtime on port 8080.
- bootstrap/app.go trusts Cloider's proxy, so generated URLs use https.
- The app reaches PostgreSQL on the database's private host with sslmode=require.
- APP_KEY and DATABASE_URL are locked secrets, never shown in the dashboard again.
- Run ./app migrate --force once, from the app Terminal or cloider app exec.
- With the CLI it is cloider login, then cloider deploy.
Laravel for Go brings Laravel's routing, validation, models, migrations, queues and Inertia frontends to Go. It is built on Go's standard net/http and compiles your app into a single binary in seconds. In this guide you deploy a real Laravel for Go app with a PostgreSQL database to Cloider App Engine (Apps in the dashboard), three ways:
From the dashboard: dockerize the app, create the database, connect the GitHub repository, then add the environment variables and secrets.
With the cloider CLI: install it,
cloider login,cloider deploy.With an AI coding agent: one prompt, "using cloider cli deploy this app".
Options 1 and 2 show every step with a screenshot of what you will see. Your app ends up on a free subdomain with HTTPS, <subdomain>.cloider.app, and the code is on GitHub at mareimorsy/laravel-go-blog. Working in Rust instead? The same app built with Laravel for Rust has its own guide.
What you are deploying
The app is the Laravel for Go starter (laravel new laravel-go-blog --go) with a small blog on top: a list of posts, and pages to write, edit and delete them. It uses an Inertia + React + TypeScript + Tailwind frontend, keeps its posts, sessions, cache and jobs in PostgreSQL, and reads its configuration from environment variables.
Variable | Value on Cloider | Secret |
|---|---|---|
APP_ENV | production | No |
APP_DEBUG | false | No |
APP_URL | https://<subdomain>.cloider.app | No |
APP_KEY | base64: followed by 32 random bytes in base64 | Yes |
DATABASE_URL | postgres://USER:PASSWORD@HOST:PORT/DB?sslmode=require | Yes |
Clone it to follow along:
git clone https://github.com/mareimorsy/laravel-go-blog.git
cd laravel-go-blogYou also need a Cloider account. New accounts get a welcome credit, which covers everything in this guide many times over.
Option 1: deploy from the Cloider dashboard
Step 1: Dockerize the app
Cloider builds an app with buildpacks when it has no Dockerfile, and with your Dockerfile when it has one. A Laravel for Go app needs both Node.js (for the frontend) and Go 1.27 (for the server) at build time, so a Dockerfile is the clearest way to build it.
Laravel for Go compiles your application into one binary, with its migrations, seeders and views built in. At runtime it still reads two folders next to it: public/ (the Vite build) and storage/. The Dockerfile in the repository builds both in three stages:
assets:
npm ciandnpm run buildwrite the Inertia + React frontend topublic/build.server:
go mod download, thenCGO_ENABLED=0 go buildcompiles a static binary. The cache mounts keep the Go module cache and the build cache between builds, so a rebuild only compiles what changed.runtime: a slim Debian image with the binary,
public/and a writablestorage/, running as a non-rootappuser.
# syntax=docker/dockerfile:1
FROM node:24-slim AS assets
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY vite.config.ts tsconfig.json ./
COPY resources ./resources
COPY public ./public
RUN npm run build
FROM golang:1.27-trixie AS server
WORKDIR /app
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /usr/local/bin/app .
FROM debian:trixie-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --system --no-create-home app
WORKDIR /app
COPY --from=server /usr/local/bin/app ./app
COPY --from=assets /app/public ./public
RUN mkdir -p storage/app storage/framework storage/logs && chown -R app:app storage
ENV SERVER_HOST=0.0.0.0 \
SERVER_PORT=8080
USER app
EXPOSE 8080
CMD ["./app"]
Two settings matter on any platform. The server listens on 127.0.0.1:8000 by default, which nothing outside the container can reach, so the image sets SERVER_HOST=0.0.0.0 and SERVER_PORT=8080. And Cloider terminates HTTPS in front of your app, so bootstrap/app.go trusts the proxy, which makes the URLs the app generates start with https://:
Middleware: func(m *laravel.Middleware, cfg *config.Config) {
// Cloider's load balancer terminates HTTPS, and apps are only reachable through it...
m.Proxies = []string{"*"}
// ...
},The framework also answers GET /up with a 200 once it has started, which is what Cloider and Kubernetes use as the health check.
Step 2: Create the PostgreSQL database
Open Databases in the sidebar and click Create Database. Name it laravel-go, set the user to laravel, and pick PostgreSQL v18 as the engine.

Leave Trusted sources on Allow Everything and SSL Mode on, and keep the Hobby plan, which is plenty for this app. Then click Create database.

The database shows Creating for a minute or two, then Ready.

Click it to see its connection details. Your app runs on Cloider, so it connects through the private host (...db.cloider.internal), which stays inside Cloider's network. Open the Private tab under Quick Connect and copy the DSN with the copy button, which fills in the password.


Step 3: Connect the GitHub repository (or upload the code)
Open Apps and click Create App. You can import a Git repository from GitHub, GitLab or Bitbucket, deploy a Docker image you already built, or drag and drop the project folder or a zip file to upload it.

Click GitHub. The first time, GitHub asks you to install the Cloider Apps GitHub App and choose the repositories it may read. Pick laravel-go-blog, and keep the main branch. Every push to that branch deploys a new version.

Click Import. Cloider reads the repository and fills in the form: the app name, the type (Web service) and port 8080. Then pick a free subdomain: the app is served on <subdomain>.cloider.app.

If you would rather not connect Git, the upload area does the same with a folder or a zip of the project. Leave out node_modules/ and the compiled app binary: the Dockerfile builds them anyway.
Step 4: Add the environment variables and secrets
Under Environment variables, click Add variable for each plain setting. Set APP_URL to https://<subdomain>.cloider.app, with the subdomain you picked:

Then add the two secrets, and click the lock icon next to each so its value is never shown in the dashboard again:
DATABASE_URL: the private DSN from step 2, with the password in it, in the formpostgres://laravel:PASSWORD@<host>.db.cloider.internal:<port>/laravel-go?sslmode=require.APP_KEY: the key that encrypts sessions and cookies. Make one with the command below (or./app key:generate --show), and keep it the same across deploys.
echo "base64:$(openssl rand -base64 32)"
Open Advanced settings and set the Health check path to /up. A new version then only goes live once it answers there, and a replica that stops answering is restarted.

Click Create App. Cloider starts a build machine, builds the image from your Dockerfile and streams the output: first the Vite build, then go build.

Go compiles quickly, so the whole first build took 3m 6s here, most of it starting the build machine and pulling the base images. Later builds reuse the build cache.

Step 5: Run the migrations
The app is up, but the database is still empty, so /posts answers with a 500 (relation "posts" does not exist in the logs). Open the app's Terminal tab, which gives you a shell in a running replica, and run the migrations once:
./app migrate --force
Run them the same way after any deploy that adds a migration. Laravel for Go holds a database lock while it migrates, so even if two replicas run migrate at the same moment, each migration runs once.
Step 6: Open the app
Open https://<subdomain>.cloider.app, click New post and publish one. It goes through the app, into PostgreSQL and back:


From now on, git push to main is a deploy: Cloider builds the new commit and switches to it once its health check passes.
Option 2: deploy with the cloider CLI
The same deployment from your terminal, in three commands plus the database.
Step 1: Install the CLI
curl -fsSL https://cloider.com/install.sh | sh
On Windows, run irm https://cloider.com/install.ps1 | iex in PowerShell instead.
Step 2: cloider login
cloider loginThe CLI opens your browser on Cloider, where you pick the account and whether the CLI may make changes:



Step 3: Create the database
cloider db create go-blog-db --engine postgresql --wait
Build the connection string for the private host, and a new app key, into shell variables. Nothing secret is printed:
DB=$(cloider db get go-blog-db -o json)
export DATABASE_URL="postgres://$(jq -r .database_user <<<$DB):$(cloider db password go-blog-db)@$(jq -r .private_host <<<$DB):$(jq -r .database_port <<<$DB)/$(jq -r .database_name <<<$DB)?sslmode=require"
export APP_KEY="base64:$(openssl rand -base64 32)"Step 4: cloider deploy
From the project folder, deploy it, with a free subdomain of your choice in place of <subdomain>. The first deploy creates the app, and later ones from the same folder update it:
cloider deploy --name laravel-go-cli --subdomain <subdomain> \
--env APP_ENV=production --env APP_DEBUG=false \
--env APP_URL=https://<subdomain>.cloider.app \
--secret-env APP_KEY="$APP_KEY" --secret-env DATABASE_URL="$DATABASE_URL"The CLI zips the folder (leaving out what .gitignore lists), creates the app, links the folder to it in .cloider/app.json, and streams the build:


Then run the migrations in the app's container with cloider app exec:
cloider app exec laravel-go-cli -- ./app migrate --force
To deploy a new version later, run cloider deploy again in the same folder.
Option 3: let an AI coding agent deploy it
If you work with an AI coding agent such as Claude Code, Cursor or Codex, install and log in to the CLI as in option 2, open the project, and ask:
using cloider cli deploy this appThe first thing cloider --help prints is a note for AI agents pointing them to docs.cloider.com/llms.txt, which holds the deployment strategy agents follow on Cloider:
Start with
cloider whoami, to confirm the account and that the token can make changes.Deploy a web service like this one as an app, and use a managed database instead of running PostgreSQL yourself.
When the project has a GitHub, GitLab or Bitbucket remote, ask you to run
cloider git connectand create the app from the repository, so every push deploys. That is the one step the agent can't finish for you.Use Kubernetes only when you ask for it or the app needs it.
Laravel for Go apps also ship an AGENTS.md and framework skills under .agents/skills/, so the agent finds the build command, ./app migrate --force and the /up route in the project itself. Agents can also drive Cloider through its MCP server, cloider mcp, with the same commands as tools. See AI coding agents in the docs.
Troubleshooting
500 on every page, with
relation "posts" does not existin the logs: the migrations haven't run. Run./app migrate --forcein the app's Terminal, or withcloider app exec.400 Bad Request: in production the app only answers requests for its
APP_URLhost and its subdomains. Check thatAPP_URLmatches the subdomain or domain you open it on.500 with "no application encryption key has been specified":
APP_KEYis missing. Add it as a locked secret.Errors about TLS or SSL when connecting to the database: keep
?sslmode=requireat the end ofDATABASE_URL. SSL is on for new databases.Sessions reset after a deploy:
APP_KEYchanged. Generate it once and keep it as a locked secret.
What it costs
An app is billed for the CPU and memory its replicas use, with a minimum of $2.99 per 30 days while it runs. The Hobby PostgreSQL plan is $3.99 a month. Both are charged by the hour, so trying this out for an afternoon costs cents, and the welcome credit of a new account covers it. Delete the app and the database from their pages when you're done.
Frequently asked questions
Does Cloider support Laravel for Go?
Yes. Cloider builds the app from its Dockerfile, runs it on two or more replicas behind HTTPS, and gives it a managed PostgreSQL database. The guide deploys a real Laravel for Go app this way.
How do I run Laravel for Go migrations on Cloider?
The migrations are compiled into the binary. Run ./app migrate --force once from the app's Terminal tab in the dashboard, or with cloider app exec <app> -- ./app migrate --force.
Which database host should a Cloider app use?
The private host, which ends in .db.cloider.internal. It stays inside Cloider's network. Keep sslmode=require in the connection string.
Why does my Laravel for Go app answer 400 Bad Request?
In production the framework only answers requests for the host in APP_URL and its subdomains. Set APP_URL to the domain you open the app on.
Can I deploy without connecting GitHub?
Yes. Upload the project folder or a zip in the dashboard, or run cloider deploy from the folder.



Comments