Local Deployment¶
Deploy to cloud infrastructure from your local machine.
Prerequisites¶
- OmniDeploy installed
- Cloud credentials configured
- Container image built and pushed to a registry
Workflow¶
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Build & │ ──► │ Push to │ ──► │ Deploy │
│ Test │ │ Registry │ │ with │
│ Locally │ │ (GHCR,ECR) │ │ omnideploy │
└─────────────┘ └─────────────┘ └─────────────┘
Step 1: Build Container Image¶
# Build image
docker build -t my-app:latest .
# Tag for registry
docker tag my-app:latest ghcr.io/myorg/my-app:latest
# Or with version
docker tag my-app:latest ghcr.io/myorg/my-app:v1.0.0
Step 2: Push to Registry¶
# Login to ECR
aws ecr get-login-password --region us-east-1 | \
docker login --username AWS --password-stdin 123456789.dkr.ecr.us-east-1.amazonaws.com
# Create repository (first time)
aws ecr create-repository --repository-name my-app
# Tag and push
docker tag my-app:latest 123456789.dkr.ecr.us-east-1.amazonaws.com/my-app:latest
docker push 123456789.dkr.ecr.us-east-1.amazonaws.com/my-app:latest
Step 3: Configure Deployment¶
Create deploy.yaml:
name: my-app
region: us-east-1
container:
image: ghcr.io/myorg/my-app:latest
ports:
- container_port: 8080
protocol: HTTP
health_check:
path: /health
interval: 30s
service:
replicas: 1
public: true
resources:
size: small
environment:
LOG_LEVEL: info
Step 4: Set Cloud Credentials¶
Step 5: Preview Changes¶
Always preview before deploying:
Output:
Previewing deployment to lightsail using pulumi...
Changes:
+ aws:lightsail:ContainerService my-app
+ aws:lightsail:ContainerServiceDeploymentVersion my-app-deployment
Changes: 2 create, 0 update, 0 delete
Step 6: Deploy¶
# Deploy with confirmation prompt
omnideploy up --config deploy.yaml
# Deploy with auto-approve
omnideploy up --config deploy.yaml --yes
# Deploy to named stack
omnideploy up --config deploy.yaml --stack production
Step 7: Verify Deployment¶
The output includes the service URL:
Outputs:
service_name: "my-app"
state : "RUNNING"
url : "https://my-app.abc123.us-east-1.cs.amazonlightsail.com"
Test the endpoint:
Updating Deployments¶
To update a running deployment:
-
Build and push a new image:
-
Update
deploy.yamlwith new image tag: -
Deploy the update:
Managing Secrets¶
Option 1: Environment Variables¶
Pass secrets via environment when deploying:
Reference in config:
Option 2: Pulumi Config¶
Store secrets in Pulumi config:
Option 3: AWS Secrets Manager¶
Reference secrets from AWS:
Multi-Environment Deployments¶
Create separate configs or use stacks:
Option A: Separate Config Files¶
# deploy.staging.yaml
omnideploy up --config deploy.staging.yaml --stack staging
# deploy.prod.yaml
omnideploy up --config deploy.prod.yaml --stack production
Option B: Same Config, Different Stacks¶
# Staging (smaller resources)
REPLICAS=1 SIZE=micro omnideploy up --config deploy.yaml --stack staging
# Production (larger resources)
REPLICAS=3 SIZE=medium omnideploy up --config deploy.yaml --stack production
Troubleshooting¶
View Pulumi State¶
View Deployment Logs¶
For LightSail:
Force Refresh State¶
Destroy and Recreate¶
Next Steps¶
- GitHub Actions - Automate deployments with CI/CD
- Continuous Deployment - Set up automatic deployments