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

Requirements for Your Go App

Your application must:

  • Listen on the port specified by the PORT environment variable (default 8080 if unset)
  • Be a standard Go module (have a go.mod file)

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):

  1. OSC_BUILD_CMD environment variable — use this to override the entire build command
  2. cmd/server/main.go — standard Go project layout with a dedicated server command
  3. cmd/*/main.go — any single main.go under cmd/ (auto-detected if exactly one match)
  4. main.go in 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

  1. Go to My Apps in the OSC dashboard
  2. Click Add application
  3. 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
  4. Select Go as the runtime
  5. Enter a unique application name (alphanumeric only, e.g. mygoapp)
  6. For private repositories, provide a git access token
  7. 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.

  1. Create a parameter store in the OSC dashboard
  2. Add key-value pairs (e.g. DATABASE_URL, API_KEY)
  3. 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:

  1. If OSC_BUILD_CMD is set — run that command exactly
  2. If cmd/server/main.go exists — go build -o /app/server ./cmd/server
  3. If exactly one cmd/*/main.go exists — go build -o /app/server ./cmd/<name>
  4. If main.go exists in the root — go build -o /app/server .
  5. 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.