Deploy a Go App
Deploy any Go HTTP server to Eyevinn Open Source Cloud using the My Apps Go runtime. No Dockerfile needed — OSC detects your project layout, builds a static binary, and runs it for you.
Overview
The Go runtime in My Apps supports standard Go project layouts out of the box. Push your repository to any HTTPS git host and OSC handles the rest: it builds your binary with go build, injects environment variables, and exposes a public HTTPS URL.
This is part of the My Apps feature — private deployment for code you own, without open sourcing it.
Prerequisites
- An Eyevinn Open Source Cloud account
- A Go HTTP server in a git repository (public or private) on any HTTPS git host
Requirements for Your Go App
Your application must:
- Listen on the port specified by the
PORTenvironment variable (default8080if unset) - Be a standard Go module (have a
go.modfile)
Example:
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
http.ListenAndServe(":"+port, nil)
Supported Project Layouts
OSC auto-detects your entry point using the following strategy (in order):
OSC_BUILD_CMDenvironment variable — use this to override the entire build commandcmd/server/main.go— standard Go project layout with a dedicated server commandcmd/*/main.go— any singlemain.goundercmd/(auto-detected if exactly one match)main.goin the repository root — simple single-file layout
If none of these match, set OSC_BUILD_CMD to specify an explicit build command.
Deploy via the Web Console
- Go to My Apps in the OSC dashboard
- Click Add application
- Choose I have a git repository and enter your HTTPS git URL, or choose I need a git repository to have OSC provision one for you
- Select Go as the runtime
- Enter a unique application name (alphanumeric only, e.g.
mygoapp) - For private repositories, provide a git access token
- Click Deploy
OSC builds your application and assigns it a public HTTPS URL:
https://<appname>.auto.prod.osaas.io
Monorepo support
If your Go server lives in a subdirectory (e.g. services/api), enter the subdirectory path in the Sub Path field. The build runs from that directory instead of the repository root.
Deploy via MCP or AI Agent
If you have the OSC MCP server configured in your AI tool (Claude Desktop, Claude Code, Cursor, etc.), you can deploy with a natural language prompt:
"Deploy my Go app from https://github.com/myorg/myapp as a Go app named mygoapp"
For monorepo layouts:
"Deploy the Go app at path services/api from https://github.com/myorg/monorepo as a Go app named myapi"
Environment Variables and Configuration
Using the Parameter Store
The recommended way to supply environment variables to your app is via a Parameter Store (config service). Values are injected at startup — no secrets committed to your repository.
- Create a parameter store in the OSC dashboard
- Add key-value pairs (e.g.
DATABASE_URL,API_KEY) - Bind the parameter store to your app via the Config button on the My Apps dashboard, or ask your AI agent: "Bind the parameter store called myconfig to my app called mygoapp"
Build-time Variables
These environment variables control how OSC builds your application:
| Variable | Description | Default |
|---|---|---|
OSC_BUILD_CMD |
Override the entire build command | Auto-detected |
OSC_ENTRY |
Override the path to the compiled binary | /app/server |
CGO_ENABLED |
Enable or disable CGO | 0 (disabled) |
CGO is disabled by default so OSC produces fully static binaries that run cleanly in the Alpine-based runtime container. Set CGO_ENABLED=1 via the parameter store only if your code requires CGO (e.g. SQLite via mattn/go-sqlite3).
Build Auto-Detection Strategy
OSC determines how to build your app in this order:
- If
OSC_BUILD_CMDis set — run that command exactly - If
cmd/server/main.goexists —go build -o /app/server ./cmd/server - If exactly one
cmd/*/main.goexists —go build -o /app/server ./cmd/<name> - If
main.goexists in the root —go build -o /app/server . - Otherwise —
go build -o /app/server ./...
Troubleshooting
App not starting
Check that your application listens on $PORT. OSC routes traffic to the port defined by this variable. A hardcoded port (e.g. :3000) will cause the health check to fail and the app to appear unavailable.
// Correct
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
log.Fatal(http.ListenAndServe(":"+port, nil))
Build failed
Check the build logs via the AI agent ("Show me the logs for my app called mygoapp") or the get-my-app-logs MCP tool.
If OSC cannot find your entry point, set OSC_BUILD_CMD in your parameter store:
OSC_BUILD_CMD=go build -o /app/server ./cmd/myserver
CGO errors
CGO is disabled by default. If your dependencies require CGO (e.g. SQLite bindings), add CGO_ENABLED=1 to your parameter store. Note that CGO builds may take longer and require compatible system libraries to be present.
App works locally but fails on OSC
Ensure your app does not depend on local files or development-only configuration. All runtime configuration should come from environment variables, ideally via the parameter store.
Related Resources
- Deploy or Publish Your Application — Overview of all deployment paths
- Managing Custom Apps — Restart, rebuild, HA, and custom domains
- Parameter Store — Managing environment variables
- AI-Assisted App Management — Deploying and managing apps with natural language