-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
63 lines (52 loc) · 2.47 KB
/
justfile
File metadata and controls
63 lines (52 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Azure Container Apps deployment for expense-tracker
# Automatically load .env file and export to subshells
set dotenv-load
set export
# Configuration (override via environment variables)
app_name := env_var_or_default("APP_NAME", "et-app")
resource_group := env_var_or_default("RESOURCE_GROUP", "et-rg")
location := env_var_or_default("LOCATION", "canadacentral")
# Production database connection
prod_db_host := env_var_or_default("PROD_DB_HOST", "")
prod_db_name := env_var_or_default("PROD_DB_NAME", "postgres")
prod_db_user := env_var_or_default("PROD_DB_USER", "")
# PostgreSQL allowed IP addresses (JSON array format, e.g., '["1.2.3.4", "5.6.7.8"]')
postgres_allowed_ips := env_var_or_default("POSTGRES_ALLOWED_IPS", "[]")
# Custom domain configuration (optional)
custom_domain_name := env_var_or_default("CUSTOM_DOMAIN_NAME", "")
custom_domain_certificate_id := env_var_or_default("CUSTOM_DOMAIN_CERTIFICATE_ID", "")
# Default recipe - show available commands
default:
@just --list
# Build Docker image
build:
docker build -t expense-tracker .
# Run Prisma migrations against production database using Azure managed identity
migrate:
npx tsx scripts/migrate.ts
# Import categories from CSV to production database using Azure managed identity
import-categories:
npx tsx scripts/import-categories.ts
# Connect to production PostgreSQL using Azure managed identity
pgconnect:
PGPASSWORD="$(az account get-access-token --resource-type oss-rdbms --query accessToken -o tsv)" \
psql "host={{prod_db_host}} dbname={{prod_db_name}} user={{prod_db_user}} sslmode=require"
# Deploy infrastructure with specified image
# Usage: just deploy <image:tag>
# Example: just deploy ruslany/yoet:abc1234
deploy image:
az deployment group create \
--resource-group {{resource_group}} \
--template-file infra/main.bicep \
--parameters appName='{{app_name}}' \
--parameters location='{{location}}' \
--parameters dockerImage='docker.io/{{image}}' \
--parameters authSecret="$AUTH_SECRET" \
--parameters authGoogleId="$AUTH_GOOGLE_ID" \
--parameters authGoogleSecret="$AUTH_GOOGLE_SECRET" \
--parameters allowedEmails="$ALLOWED_EMAILS" \
--parameters authUrl="$AUTH_URL" \
--parameters postgresAllowedIpAddresses='{{postgres_allowed_ips}}' \
--parameters customDomainName='{{custom_domain_name}}' \
--parameters customDomainCertificateId='{{custom_domain_certificate_id}}' \
--output none