-
Notifications
You must be signed in to change notification settings - Fork 23
Automated Dev Prod Deployments
This page outlines the procedure for deploying code automatically using environment-specific deployment scripts. These scripts replace the manual deployment process (temp process) and ensure consistent, reliable, and faster deployments to all UnlockEd environments.
- Purpose
- Overview
- Deployment Scripts Location
- Supported Environments
- How It Works
- Quick Start
- Command Line Options
- Validation
- Troubleshooting
- Automate Deployments: Streamline the end-to-end deployment process for all environments.
- Ensure Consistency: Enforce a standardized deployment pattern across Demo and Production systems.
- Increase Speed: Deploy code in minutes rather than hours.
Each environment (Demo, Alaska, Maine, St. Louis, MoCode) has its own script that handles:
- Git Operations – Cloning, branch checkout, merge, and push
- Docker Build & Push – Building backend, frontend, and middleware images to AWS ECR
- Kubernetes Deployment – Restarting deployments and monitoring rollout
- Port Forwarding – Automatically establishing cluster access for production environments
All deployment scripts are located in the UnlockedLabs shell_scripts repository:
📁 GitHub Repository:
https://github.com/UnlockedLabs/shell_scripts/tree/main/deploment_scripts
Each script corresponds to a specific environment:
| Script Name | Environment | Branch | Tag | Type |
|---|---|---|---|---|
deploy-demo.sh |
Demo (Development) | demov2 |
demo |
Development |
deploy-alaska.sh |
Alaska | alaska |
alaska |
Production |
deploy-maine.sh |
Maine | maine |
maine |
Production |
deploy-stlouis.sh |
St. Louis | stlouis |
stlouis |
Production |
deploy-mocode.sh |
MoCode | mocode |
mocode |
Production |
| Environment | Branch | Namespace | Context |
|---|---|---|---|
| Demo (Development) | demov2 |
demo |
stgdmo |
| Alaska | alaska |
default | alaska |
| Maine | maine |
default | maine |
| St. Louis | stlouis |
default | stlouis |
| MoCode | mocode |
default | mocode |
Each script executes the same general pipeline:
- Clone the repository
- Check out the environment-specific branch
- Fetch latest changes and hard reset to
origin/main - Force push updates to the environment branch
Build and push three container images to AWS ECR using docker buildx:
-
Backend →
unlockedv2:<tag> -
Frontend →
frontend:<tag> -
Provider Middleware →
provider_middleware:<tag>
- Switch to the correct kubectl context
- Restart
server,frontend, andprovider-servicedeployments - Wait for rollout completion (up to 10,000 seconds)
- Sets up automated port forwarding via
~/.local/bin/<env>_port_forward.sh - Logs available at
<env>_port_forward.log
./deploy-demo.sh./deploy-alaska.sh
./deploy-maine.sh
./deploy-stlouis.sh
./deploy-mocode.sh| Option | Description |
|---|---|
--workdir <path> |
Custom working directory (default: /tmp) |
--skip-git |
Skip Git operations |
--skip-build |
Skip Docker build & push |
--skip-deploy |
Skip Kubernetes rollout |
--dry-run |
Show planned actions without executing |
-h, --help |
Display help message |
Example:
./deploy-alaska.sh --skip-build --dry-runAfter a successful deployment:
-
Check Kubernetes Status:
kubectl get pods kubectl get deployments
-
Verify Application Health:
- Test production endpoints
- Confirm new image tags are running
-
Monitor Logs:
kubectl logs -f deployment/server kubectl logs -f deployment/frontend kubectl logs -f deployment/provider-service
| Issue | Resolution |
|---|---|
| Missing AWS Credentials | Run aws configure
|
| Missing Docker Buildx | Run docker buildx install
|
| Kubernetes Context Missing | Run kubectl config get-contexts and verify |
| Port Forwarding Conflicts | Kill process with `lsof -t -i :6443 |
rm -rf /tmp/*-deploy-*