Deployment

Guidelines for deploying applications powered by an5 ORM across cloud providers and containerized environments.

Active Context: Deploying Golang application with Mysql database.

Production Checklist

Before going live:

  • Set DATABASE_URL securely via cloud environment secrets manager.
  • Configure connection pooling limits appropriate for your container concurrency.
  • Enable TLS/SSL connection encryption (sslmode=require, encrypt=true).
  • Run automated health check before accepting traffic.
  • Verify automated database backup and disaster recovery schedules.

Environment Configuration

Production Connection String

Set DATABASE_URL according to your target cloud database provider:

# Production DATABASE_URL (Active: Mysql)
DATABASE_URL=mysql://admin:StrongPassword@db.us-east-2.rds.amazonaws.com:3306/prod_db?ssl={"rejectUnauthorized":true}

# Application environment
NODE_ENV=production
LOG_LEVEL=warn

Runtime Initialization

package main

import (
    "os"
    "github.com/an5ORM/an5Adapters/golang"
)

func main() {
    adapter, err := an5adapters.NewAn5Adapter(os.Getenv("DATABASE_URL"))
    if err != nil {
        panic(err)
    }
    defer adapter.Close()
}

Container Deployment (Docker)

Multi-stage Dockerfile tailored for your stack:


FROM golang:1.22-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/server .

FROM alpine:latest
WORKDIR /app
COPY --from=builder /app/server .
EXPOSE 8080
CMD ["./server"]


Next Steps