Deployment

This guide covers deploying irgo apps to various platforms: desktop distribution, mobile app stores, and web hosting.

Desktop Distribution

macOS

# Build macOS app bundleirgo build desktop macos

This creates a .app bundle in build/desktop/macos/.

For distribution:

  1. Sign the app with your Apple Developer certificate
  2. Notarize the app with Apple
  3. Create a DMG for distribution
# Sign the appcodesign --deep --force --sign "Developer ID Application: Your Name" MyApp.app# Create DMGhdiutil create -volname "MyApp" -srcfolder MyApp.app -ov -format UDZO MyApp.dmg# Notarizexcrun notarytool submit MyApp.dmg --apple-id you@email.com --team-id TEAMID --password @keychain:AC_PASSWORD

Windows

# Build Windows executableirgo build desktop windows

Creates .exe in build/desktop/windows/.

For distribution, consider:

Linux

# Build Linux binaryirgo build desktop linux

Distribution options:

Mobile App Stores

iOS App Store

  1. Build the iOS framework:
    irgo build ios
  2. Open the Xcode project in ios/
  3. Add the framework to your project
  4. Configure signing with your Apple Developer account
  5. Archive and upload to App Store Connect
Note

Ensure your app meets Apple's App Store Review Guidelines. Apps using WebViews must provide significant native functionality.

Google Play Store

  1. Build the Android AAR:
    irgo build android
  2. Open the Android project in Android Studio
  3. Add the AAR to your project
  4. Configure signing with your keystore
  5. Generate signed APK or App Bundle
  6. Upload to Google Play Console
# Generate signed bundle./gradlew bundleRelease

Web Deployment

Docker

Dockerfile
FROM golang:1.21-alpine AS builderWORKDIR /app# Install templRUN go install github.com/a-h/templ/cmd/templ@latest# Copy and buildCOPY go.mod go.sum ./RUN go mod downloadCOPY . .RUN templ generateRUN CGO_ENABLED=0 go build -o server .# Runtime imageFROM alpine:latestWORKDIR /appCOPY --from=builder /app/server .COPY --from=builder /app/static ./staticEXPOSE 8080CMD ["./server", "serve"]
# Build and rundocker build -t myapp .docker run -p 8080:8080 myapp

Fly.io

fly.toml
app = "myapp"primary_region = "ord"[build]  dockerfile = "Dockerfile"[http_service]  internal_port = 8080  force_https = true[[services]]  internal_port = 8080  protocol = "tcp"  [[services.ports]]    port = 80    handlers = ["http"]  [[services.ports]]    port = 443    handlers = ["tls", "http"]
fly launchfly deploy

Railway

Railway auto-detects Go apps. Just connect your repository and deploy.

# Set start command in Railway dashboard or railway.json{  "build": {    "builder": "DOCKERFILE"  },  "deploy": {    "startCommand": "./server serve"  }}

Traditional VPS

# Build locallyGOOS=linux GOARCH=amd64 go build -o myapp .# Upload to serverscp myapp user@server:/opt/myapp/scp -r static user@server:/opt/myapp/# On server: create systemd servicecat > /etc/systemd/system/myapp.service << EOF[Unit]Description=MyAppAfter=network.target[Service]Type=simpleUser=www-dataWorkingDirectory=/opt/myappExecStart=/opt/myapp/myapp serveRestart=always[Install]WantedBy=multi-user.targetEOF# Enable and startsystemctl enable myappsystemctl start myapp

Environment Configuration

// Use environment variables for configurationport := os.Getenv("PORT")if port == "" {    port = "8080"}dbURL := os.Getenv("DATABASE_URL")apiKey := os.Getenv("API_KEY")

Next Steps