Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,30 @@ depends = ["env:setup"]
run = "./scripts/test-services.sh --max-retries 5 --retry-delay 10"

# =============================================================================
# aws: AWS tasks
# aws: AWS deployment tasks
#
# Deployment modes are controlled via the DEPLOY_MODE environment variable:
# - local: Build containers from local Dockerfiles (DEPLOY_MODE=local)
# - release: Pull prebuilt images from GHCR tagged "latest" (DEPLOY_MODE=release)
# - (unset): Falls back to COMMIT_SHA env var, or "latest" if not set
#
# DEPLOY_MODE is NOT stored in .env, so it propagates naturally through
# subprocess calls. CDK's SharedProps reads DEPLOY_MODE and sets the
# appropriate image tag. Services can define their own aws:deploy:local
# and aws:deploy:release tasks that set DEPLOY_MODE and delegate to aws:deploy.
#
# To deploy a specific tagged version from the registry (e.g., a CI-built
# image), set COMMIT_SHA to the desired tag and run aws:deploy directly
# without setting DEPLOY_MODE. For example:
# COMMIT_SHA=abc123 npx cdk deploy (from infra/aws directory)
# =============================================================================

[tasks."aws:deploy:local"]
description = "Deploy to AWS (build containers locally)"
depends = ["env:setup"]
env = { DEPLOY_MODE = "local" }
run = """
echo "=== Deploying Stickerlandia to AWS: $ENV (COMMIT_SHA=$COMMIT_SHA) ==="
echo "=== Deploying Stickerlandia to AWS: $ENV (DEPLOY_MODE=$DEPLOY_MODE) ==="
mise run //shared:aws:deploy
mise run //user-management:aws:deploy
mise run //sticker-award:aws:deploy
Expand All @@ -163,9 +179,9 @@ echo "=== Deployment complete! ==="
[tasks."aws:deploy:release"]
description = "Deploy to AWS using prebuilt GHCR images"
depends = ["env:setup"]
env = { COMMIT_SHA = "latest" }
env = { DEPLOY_MODE = "release" }
run = """
echo "=== Deploying Stickerlandia to AWS: $ENV (COMMIT_SHA=$COMMIT_SHA) ==="
echo "=== Deploying Stickerlandia to AWS: $ENV (DEPLOY_MODE=$DEPLOY_MODE) ==="
mise run //shared:aws:deploy
mise run //user-management:aws:deploy
mise run //sticker-award:aws:deploy
Expand Down
10 changes: 9 additions & 1 deletion shared/lib/shared-constructs/lib/shared-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ export class SharedProps {
enableDatadog: boolean = true
) {
const environment = process.env.ENV || "dev";
const version = process.env.COMMIT_SHA || "latest";
const deployMode = process.env.DEPLOY_MODE;
let version: string;
if (deployMode === "local") {
version = "LOCAL";
} else if (deployMode === "release") {
version = "latest";
} else {
version = process.env.COMMIT_SHA || "latest";
}
const commitSha = process.env.COMMIT_SHA_FULL || "";

this.datadog = {
Expand Down
12 changes: 12 additions & 0 deletions shared/mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ dir = "infra/aws"
depends = ["lib:install", "infra:install"]
run = "npx cdk deploy --require-approval never"

[tasks."aws:deploy:local"]
description = "Deploy shared infrastructure (local mode)"
depends = ["//:env:setup"]
env = { DEPLOY_MODE = "local" }
run = "mise run aws:deploy"

[tasks."aws:deploy:release"]
description = "Deploy shared infrastructure (release mode)"
depends = ["//:env:setup"]
env = { DEPLOY_MODE = "release" }
run = "mise run aws:deploy"

[tasks."aws:down"]
description = "Destroy shared infrastructure on AWS"
dir = "infra/aws"
Expand Down
12 changes: 12 additions & 0 deletions sticker-award/mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ dir = "infra/aws"
depends = ["infra:install", "//shared:aws:deploy"]
run = "npx cdk deploy --require-approval never"

[tasks."aws:deploy:local"]
description = "Deploy to AWS (build container locally)"
depends = ["//:env:setup", "//shared:aws:deploy:local", "//user-management:aws:deploy:local"]
env = { DEPLOY_MODE = "local" }
run = "mise run aws:deploy"

[tasks."aws:deploy:release"]
description = "Deploy to AWS using prebuilt GHCR images"
depends = ["//:env:setup", "//shared:aws:deploy:release", "//user-management:aws:deploy:release"]
env = { DEPLOY_MODE = "release" }
run = "mise run aws:deploy"

[tasks."aws:down"]
description = "Destroy AWS stack"
dir = "infra/aws"
Expand Down
12 changes: 12 additions & 0 deletions sticker-catalogue/mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ dir = "infra/aws"
depends = ["infra:install", "//shared:aws:deploy"]
run = "npx cdk deploy --require-approval never"

[tasks."aws:deploy:local"]
description = "Deploy to AWS (build container locally)"
depends = ["//:env:setup", "//shared:aws:deploy:local", "//user-management:aws:deploy:local"]
env = { DEPLOY_MODE = "local" }
run = "mise run aws:deploy"

[tasks."aws:deploy:release"]
description = "Deploy to AWS using prebuilt GHCR images"
depends = ["//:env:setup", "//shared:aws:deploy:release", "//user-management:aws:deploy:release"]
env = { DEPLOY_MODE = "release" }
run = "mise run aws:deploy"

[tasks."aws:down"]
description = "Destroy AWS stack"
dir = "infra/aws"
Expand Down
12 changes: 12 additions & 0 deletions user-management/mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ dir = "infra/aws"
depends = ["infra:install", "//shared:aws:deploy"]
run = "npx cdk deploy --require-approval never"

[tasks."aws:deploy:local"]
description = "Deploy to AWS (build container locally)"
depends = ["//:env:setup", "//shared:aws:deploy:local"]
env = { DEPLOY_MODE = "local" }
run = "mise run aws:deploy"

[tasks."aws:deploy:release"]
description = "Deploy to AWS using prebuilt GHCR images"
depends = ["//:env:setup", "//shared:aws:deploy:release"]
env = { DEPLOY_MODE = "release" }
run = "mise run aws:deploy"

[tasks."aws:down"]
description = "Destroy AWS stack"
dir = "infra/aws"
Expand Down
12 changes: 12 additions & 0 deletions web-backend/mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ dir = "infra/aws"
depends = ["infra:install", "//shared:aws:deploy"]
run = "npx cdk deploy --require-approval never"

[tasks."aws:deploy:local"]
description = "Deploy to AWS (build container locally)"
depends = ["//:env:setup", "//shared:aws:deploy:local", "//user-management:aws:deploy:local"]
env = { DEPLOY_MODE = "local" }
run = "mise run aws:deploy"

[tasks."aws:deploy:release"]
description = "Deploy to AWS using prebuilt GHCR images"
depends = ["//:env:setup", "//shared:aws:deploy:release", "//user-management:aws:deploy:release"]
env = { DEPLOY_MODE = "release" }
run = "mise run aws:deploy"

[tasks."aws:down"]
description = "Destroy AWS stack"
dir = "infra/aws"
Expand Down
12 changes: 12 additions & 0 deletions web-frontend/mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ dir = "infra/aws"
depends = ["infra:install", "build:local", "//shared:aws:deploy"]
run = "npx cdk deploy --require-approval never"

[tasks."aws:deploy:local"]
description = "Deploy frontend to AWS (local mode)"
depends = ["//:env:setup", "//shared:aws:deploy:local", "//user-management:aws:deploy:local"]
env = { DEPLOY_MODE = "local" }
run = "mise run aws:deploy"

[tasks."aws:deploy:release"]
description = "Deploy frontend to AWS (release mode)"
depends = ["//:env:setup", "//shared:aws:deploy:release", "//user-management:aws:deploy:release"]
env = { DEPLOY_MODE = "release" }
run = "mise run aws:deploy"

[tasks."aws:down"]
description = "Destroy AWS stack"
dir = "infra/aws"
Expand Down
Loading