-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.ps1
More file actions
55 lines (50 loc) · 1.53 KB
/
Copy pathrun.ps1
File metadata and controls
55 lines (50 loc) · 1.53 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
# Comandi:
# up Build+push Lambda, terraform apply, sync frontend
# down terraform destroy (S3 e ECR restano)
# az-down Simula down prima AZ (Lambda solo nell'altra)
# az-up Ripristina Lambda su entrambe le AZ
# rds-main-down Reboot RDS main (1-2 min down, replica resta up; test letture)
# rds-main-up Riaccende RDS main (solo se era stato fermato con stop)
#
# Esempi:
# .\run.ps1 up
# .\run.ps1 az-down
# .\run.ps1 az-up
# .\run.ps1 rds-main-down
# .\run.ps1 rds-main-up
$ErrorActionPreference = "Stop"
$cmd = $args[0]
$scriptDir = Join-Path $PSScriptRoot "scripts"
$terraformDir = Join-Path $PSScriptRoot "terraform"
function Show-Help {
Write-Host "Uso: .\run.ps1 <comando> [argomenti]"
Write-Host ""
Write-Host "Comandi:"
Write-Host " up Build+push Lambda, terraform apply, sync frontend"
Write-Host " az-down Simula down prima AZ (Lambda)"
Write-Host " az-up Ripristina Lambda su entrambe le AZ"
Write-Host " rds-main-down Reboot RDS main (replica resta up, test letture)"
}
if (-not $cmd) {
Show-Help
exit 1
}
switch ($cmd.ToLower()) {
"az-down" {
& (Join-Path $scriptDir "az-down.ps1")
}
"az-up" {
& (Join-Path $scriptDir "az-up.ps1")
}
"rds-main-down" {
& (Join-Path $scriptDir "rds-main-down.ps1")
}
"rds-main-up" {
& (Join-Path $scriptDir "rds-main-up.ps1")
}
default {
Write-Host "Comando sconosciuto: $cmd"
Show-Help
exit 1
}
}