@cubocicloide/stack-react-fastapi 13.4.2 → 13.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2654 -329
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/templates/azure-aca/backend/Dockerfile.prod.hbs +29 -0
- package/templates/azure-aca/docs/docs/deploy.md.hbs +127 -0
- package/templates/azure-aca/frontend/Dockerfile.prod +36 -0
- package/templates/azure-aca/frontend/nginx.conf.template +47 -0
- package/templates/azure-aca/iac/README.md.hbs +286 -0
- package/templates/azure-aca/iac/_gitignore +19 -0
- package/templates/azure-aca/iac/runner/Dockerfile +51 -0
- package/templates/azure-aca/iac/terraform/bootstrap/main.tf.hbs +123 -0
- package/templates/azure-aca/iac/terraform/bootstrap/outputs.tf +24 -0
- package/templates/azure-aca/iac/terraform/bootstrap/variables.tf.hbs +23 -0
- package/templates/azure-aca/iac/terraform/environments/dev/backend.hcl.hbs +25 -0
- package/templates/azure-aca/iac/terraform/environments/dev/terraform.tfvars.hbs +69 -0
- package/templates/azure-aca/iac/terraform/main.tf.hbs +593 -0
- package/templates/azure-aca/iac/terraform/outputs.tf.hbs +72 -0
- package/templates/azure-aca/iac/terraform/providers.tf +16 -0
- package/templates/azure-aca/iac/terraform/variables.tf.hbs +200 -0
- package/templates/azure-aca/iac/terraform/versions.tf +21 -0
- package/templates/azure-aks/backend/Dockerfile.prod.hbs +29 -0
- package/templates/azure-aks/docs/docs/deploy.md.hbs +273 -0
- package/templates/azure-aks/frontend/Dockerfile.prod +32 -0
- package/templates/azure-aks/frontend/nginx.conf +20 -0
- package/templates/azure-aks/iac/README.md.hbs +472 -0
- package/templates/azure-aks/iac/_gitignore +29 -0
- package/templates/azure-aks/iac/helm/app/.helmignore +7 -0
- package/templates/azure-aks/iac/helm/app/Chart.yaml.hbs +6 -0
- package/templates/azure-aks/iac/helm/app/templates/NOTES.txt +32 -0
- package/templates/azure-aks/iac/helm/app/templates/backend-deployment.yaml +44 -0
- package/templates/azure-aks/iac/helm/app/templates/backend-service.yaml +16 -0
- package/templates/azure-aks/iac/helm/app/templates/celery-beat-deployment.yaml +34 -0
- package/templates/azure-aks/iac/helm/app/templates/celery-worker-deployment.yaml +31 -0
- package/templates/azure-aks/iac/helm/app/templates/configmap.yaml +15 -0
- package/templates/azure-aks/iac/helm/app/templates/flower-deployment.yaml +28 -0
- package/templates/azure-aks/iac/helm/app/templates/flower-service.yaml +19 -0
- package/templates/azure-aks/iac/helm/app/templates/frontend-deployment.yaml +34 -0
- package/templates/azure-aks/iac/helm/app/templates/frontend-service.yaml +16 -0
- package/templates/azure-aks/iac/helm/app/templates/helpers.tpl +90 -0
- package/templates/azure-aks/iac/helm/app/templates/hpa.yaml +23 -0
- package/templates/azure-aks/iac/helm/app/templates/ingress.yaml +35 -0
- package/templates/azure-aks/iac/helm/app/templates/migration-job.yaml +38 -0
- package/templates/azure-aks/iac/helm/app/templates/redis-deployment.yaml +33 -0
- package/templates/azure-aks/iac/helm/app/templates/redis-service.yaml +18 -0
- package/templates/azure-aks/iac/helm/app/templates/secret.yaml +17 -0
- package/templates/azure-aks/iac/helm/app/templates/serviceaccount.yaml +12 -0
- package/templates/azure-aks/iac/helm/app/values-dev.yaml.hbs +36 -0
- package/templates/azure-aks/iac/helm/app/values.yaml.hbs +147 -0
- package/templates/azure-aks/iac/runner/Dockerfile +61 -0
- package/templates/azure-aks/iac/terraform/bootstrap/main.tf.hbs +123 -0
- package/templates/azure-aks/iac/terraform/bootstrap/outputs.tf +24 -0
- package/templates/azure-aks/iac/terraform/bootstrap/variables.tf.hbs +23 -0
- package/templates/azure-aks/iac/terraform/environments/dev/backend.hcl.hbs +25 -0
- package/templates/azure-aks/iac/terraform/environments/dev/terraform.tfvars.hbs +65 -0
- package/templates/azure-aks/iac/terraform/main.tf.hbs +307 -0
- package/templates/azure-aks/iac/terraform/outputs.tf.hbs +57 -0
- package/templates/azure-aks/iac/terraform/providers.tf +35 -0
- package/templates/azure-aks/iac/terraform/variables.tf.hbs +157 -0
- package/templates/azure-aks/iac/terraform/versions.tf +29 -0
- package/templates/base/CLAUDE.md.hbs +7 -7
- package/templates/base/backend/pyproject.toml.hbs +1 -1
- package/templates/base/docs/docs/dude.md.hbs +1 -1
- package/templates/base/docs/docs/index.md.hbs +1 -1
- package/templates/base/docs/mkdocs.yml.hbs +1 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Bootstrap — creates the project-wide shared resources: the Azure Storage
|
|
2
|
+
# account + blob container that hold Terraform remote state for every
|
|
3
|
+
# environment, and the container registry the app images are pushed to. These
|
|
4
|
+
# are SHARED across all environments (one image, promoted dev → staging → prod by
|
|
5
|
+
# tag), so they have a single owner here rather than being recreated by each
|
|
6
|
+
# per-env config — which would otherwise collide and let one env's `destroy`
|
|
7
|
+
# delete another env's registry. Run ONCE per project, with LOCAL state (this
|
|
8
|
+
# config has no remote backend on purpose).
|
|
9
|
+
#
|
|
10
|
+
# There is no lock table to create: the azurerm backend locks state with a blob
|
|
11
|
+
# lease, which the storage account below provides for free.
|
|
12
|
+
#
|
|
13
|
+
# dude iac bootstrap --state-prefix <your-org> --location northeurope --env dev --yes
|
|
14
|
+
|
|
15
|
+
terraform {
|
|
16
|
+
required_version = ">= 1.6.0"
|
|
17
|
+
required_providers {
|
|
18
|
+
azurerm = {
|
|
19
|
+
source = "hashicorp/azurerm"
|
|
20
|
+
version = "~> 4.14"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
provider "azurerm" {
|
|
26
|
+
features {
|
|
27
|
+
resource_group {
|
|
28
|
+
# The state container and the registry both live in this group, and
|
|
29
|
+
# `dude iac destroy` only reaches here once no environment still uses
|
|
30
|
+
# them — so refusing to delete a non-empty group would just block the
|
|
31
|
+
# teardown it has already decided is safe.
|
|
32
|
+
prevent_deletion_if_contains_resources = false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# Left to ARM_SUBSCRIPTION_ID, which `dude iac` sets from the environment's
|
|
37
|
+
# `subscription_id` (or your `az` default). Pinning it here instead would mean
|
|
38
|
+
# every project hard-codes one subscription into a committed file.
|
|
39
|
+
subscription_id = var.subscription_id != "" ? var.subscription_id : null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# Storage account and registry names are globally unique across Azure and accept
|
|
43
|
+
# only lowercase letters and digits — no hyphens, 24 chars max for the storage
|
|
44
|
+
# account. Hence the strip-and-truncate rather than a plain interpolation.
|
|
45
|
+
locals {
|
|
46
|
+
slug = lower(replace("${var.state_prefix}${var.project_name}", "/[^a-zA-Z0-9]/", ""))
|
|
47
|
+
storage_account = substr("${local.slug}tfstate", 0, 24)
|
|
48
|
+
registry_name = substr("${local.slug}acr", 0, 50)
|
|
49
|
+
resource_group = "${var.project_name}-shared-rg"
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
resource "azurerm_resource_group" "shared" {
|
|
53
|
+
name = local.resource_group
|
|
54
|
+
location = var.location
|
|
55
|
+
|
|
56
|
+
tags = {
|
|
57
|
+
Project = var.project_name
|
|
58
|
+
ManagedBy = "terraform"
|
|
59
|
+
Scope = "shared"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
resource "azurerm_storage_account" "state" {
|
|
64
|
+
name = local.storage_account
|
|
65
|
+
resource_group_name = azurerm_resource_group.shared.name
|
|
66
|
+
location = azurerm_resource_group.shared.location
|
|
67
|
+
account_tier = "Standard"
|
|
68
|
+
account_replication_type = "LRS"
|
|
69
|
+
|
|
70
|
+
# Terraform state records every attribute of every resource — including the
|
|
71
|
+
# generated database password — so it is never reachable anonymously and never
|
|
72
|
+
# over plaintext HTTP.
|
|
73
|
+
https_traffic_only_enabled = true
|
|
74
|
+
min_tls_version = "TLS1_2"
|
|
75
|
+
allow_nested_items_to_be_public = false
|
|
76
|
+
shared_access_key_enabled = true
|
|
77
|
+
|
|
78
|
+
blob_properties {
|
|
79
|
+
# Versioning is what makes a corrupted or truncated state recoverable; 30
|
|
80
|
+
# days of retention is enough to notice and roll back.
|
|
81
|
+
versioning_enabled = true
|
|
82
|
+
delete_retention_policy {
|
|
83
|
+
days = 30
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
tags = {
|
|
88
|
+
Project = var.project_name
|
|
89
|
+
ManagedBy = "terraform"
|
|
90
|
+
Scope = "shared"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
resource "azurerm_storage_container" "state" {
|
|
95
|
+
name = "tfstate"
|
|
96
|
+
storage_account_id = azurerm_storage_account.state.id
|
|
97
|
+
container_access_type = "private"
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
# Shared container registry — one per project, used by every environment. Per-env
|
|
101
|
+
# Terraform reads it by name via a data source; it is created/destroyed only
|
|
102
|
+
# here, with the rest of the shared bootstrap.
|
|
103
|
+
resource "azurerm_container_registry" "shared" {
|
|
104
|
+
name = local.registry_name
|
|
105
|
+
resource_group_name = azurerm_resource_group.shared.name
|
|
106
|
+
location = azurerm_resource_group.shared.location
|
|
107
|
+
|
|
108
|
+
# Basic is enough for a registry that one project pushes to: the features Standard
|
|
109
|
+
# and Premium add (geo-replication, larger included storage, tag immutability,
|
|
110
|
+
# private endpoints) cost real money and none of them is on this path.
|
|
111
|
+
sku = "Basic"
|
|
112
|
+
|
|
113
|
+
# Image pulls authenticate as the cluster's managed identity (an AcrPull role
|
|
114
|
+
# assignment in the per-env config), so the registry never needs the shared
|
|
115
|
+
# admin username/password that would otherwise end up in a Kubernetes secret.
|
|
116
|
+
admin_enabled = false
|
|
117
|
+
|
|
118
|
+
tags = {
|
|
119
|
+
Project = var.project_name
|
|
120
|
+
ManagedBy = "terraform"
|
|
121
|
+
Scope = "shared"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
output "resource_group_name" {
|
|
2
|
+
description = "Set this as `resource_group_name` in every environment's backend.hcl."
|
|
3
|
+
value = azurerm_resource_group.shared.name
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
output "storage_account_name" {
|
|
7
|
+
description = "Set this as `storage_account_name` in every environment's backend.hcl."
|
|
8
|
+
value = azurerm_storage_account.state.name
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
output "container_name" {
|
|
12
|
+
description = "Set this as `container_name` in every environment's backend.hcl."
|
|
13
|
+
value = azurerm_storage_container.state.name
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
output "acr_name" {
|
|
17
|
+
description = "Shared container registry name — set as `acr_name` in each environment's terraform.tfvars."
|
|
18
|
+
value = azurerm_container_registry.shared.name
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
output "acr_login_server" {
|
|
22
|
+
description = "Shared container registry login server (the image registry host)."
|
|
23
|
+
value = azurerm_container_registry.shared.login_server
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
variable "project_name" {
|
|
2
|
+
description = "Project slug — used to name the shared resource group."
|
|
3
|
+
type = string
|
|
4
|
+
default = "{{projectName}}"
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
variable "location" {
|
|
8
|
+
description = "Azure region for the shared state storage account + container registry. See the note on `location` in the per-environment variables: some regions are closed to new subscriptions."
|
|
9
|
+
type = string
|
|
10
|
+
default = "northeurope"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
variable "state_prefix" {
|
|
14
|
+
description = "Prefix making the storage account and registry names globally unique (e.g. your org slug). Lowercase letters/digits only."
|
|
15
|
+
type = string
|
|
16
|
+
default = "changeme"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
variable "subscription_id" {
|
|
20
|
+
description = "Azure subscription to create the shared resources in. Empty = whatever ARM_SUBSCRIPTION_ID / your az default resolves to."
|
|
21
|
+
type = string
|
|
22
|
+
default = ""
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Remote state for the `dev` environment.
|
|
2
|
+
# These resources are created once by `iac/terraform/bootstrap` — run
|
|
3
|
+
# `dude iac bootstrap` and it fills in the two CHANGE-ME values below for you.
|
|
4
|
+
# The same backend works locally and from CI/CD.
|
|
5
|
+
#
|
|
6
|
+
# Each environment uses a distinct `key`, so adding `staging`/`prod` is just a
|
|
7
|
+
# new folder with its own backend.hcl + terraform.tfvars.
|
|
8
|
+
#
|
|
9
|
+
# There is no lock table: the azurerm backend takes a lease on the state blob,
|
|
10
|
+
# which is the lock.
|
|
11
|
+
|
|
12
|
+
resource_group_name = "CHANGE-ME-{{projectName}}-shared-rg"
|
|
13
|
+
storage_account_name = "CHANGE-ME"
|
|
14
|
+
container_name = "tfstate"
|
|
15
|
+
key = "{{projectName}}/dev/terraform.tfstate"
|
|
16
|
+
|
|
17
|
+
# Terraform reaches the state blob with the storage account's access key, which
|
|
18
|
+
# it looks up through ARM using the subscription `dude iac` exports for the
|
|
19
|
+
# environment. That works for anyone with Contributor on the subscription.
|
|
20
|
+
#
|
|
21
|
+
# Setting `use_azuread_auth = true` instead authenticates as the signed-in user,
|
|
22
|
+
# which is tighter — but is NOT a drop-in: being Owner of the subscription grants
|
|
23
|
+
# control-plane rights only, so every person and pipeline would also need the
|
|
24
|
+
# data-plane role "Storage Blob Data Contributor" on the storage account, or
|
|
25
|
+
# `terraform init` fails with AuthorizationPermissionMismatch.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# dev environment — small, cost-conscious defaults.
|
|
2
|
+
# Copy this folder to add a new environment (`dude iac new-env --env prod`) and
|
|
3
|
+
# bump the sizing / durability knobs there.
|
|
4
|
+
|
|
5
|
+
environment = "dev"
|
|
6
|
+
|
|
7
|
+
# Several popular regions — West Europe notably — are capacity-closed to NEW
|
|
8
|
+
# subscriptions and reject resource creation with "RequestDisallowedByAzure: the
|
|
9
|
+
# selected region is currently not accepting new customers". North Europe is the
|
|
10
|
+
# default because it is reliably open. Before switching, create something cheap
|
|
11
|
+
# there first, or check https://aka.ms/locationineligible.
|
|
12
|
+
location = "northeurope"
|
|
13
|
+
|
|
14
|
+
# Azure subscription this environment deploys into. Leave empty to use whichever
|
|
15
|
+
# subscription `az account show` reports; pin it here once you know the id, so
|
|
16
|
+
# two environments can never land in the same place by accident.
|
|
17
|
+
# `dude iac login --env dev` prints the id to paste in.
|
|
18
|
+
subscription_id = ""
|
|
19
|
+
|
|
20
|
+
# Shared container registry — filled in by `dude iac bootstrap`.
|
|
21
|
+
acr_name = "CHANGE-ME"
|
|
22
|
+
acr_resource_group = "{{projectName}}-shared-rg"
|
|
23
|
+
|
|
24
|
+
# The image tag every container app runs. `dude iac deploy`/`ship` rewrites this
|
|
25
|
+
# line, so it is the committed record of what is deployed — commit it after a
|
|
26
|
+
# release and the next `terraform apply` will not roll production backwards.
|
|
27
|
+
image_tag = "latest"
|
|
28
|
+
|
|
29
|
+
# Network. The Container Apps subnet must be at least a /23; the platform
|
|
30
|
+
# refuses anything smaller.
|
|
31
|
+
vnet_cidr = "10.0.0.0/16"
|
|
32
|
+
aca_subnet_cidr = "10.0.0.0/23"
|
|
33
|
+
{{#if withPostgres}}
|
|
34
|
+
db_subnet_cidr = "10.0.4.0/24"
|
|
35
|
+
{{/if}}
|
|
36
|
+
|
|
37
|
+
# Application sizing. Allowed cpu/memory pairs are fixed by the platform:
|
|
38
|
+
# 0.25/0.5Gi, 0.5/1Gi, 0.75/1.5Gi, 1/2Gi, 1.25/2.5Gi, …
|
|
39
|
+
# Setting a min_replicas of 0 makes a service free while idle, at the cost of a
|
|
40
|
+
# cold start on the next request — fine for the backend in dev, awkward for the
|
|
41
|
+
# frontend because it is the first thing a visitor hits.
|
|
42
|
+
frontend_cpu = 0.25
|
|
43
|
+
frontend_memory = "0.5Gi"
|
|
44
|
+
frontend_min_replicas = 1
|
|
45
|
+
frontend_max_replicas = 3
|
|
46
|
+
|
|
47
|
+
backend_cpu = 0.5
|
|
48
|
+
backend_memory = "1Gi"
|
|
49
|
+
backend_min_replicas = 1
|
|
50
|
+
backend_max_replicas = 3
|
|
51
|
+
{{#if withCelery}}
|
|
52
|
+
|
|
53
|
+
worker_cpu = 0.5
|
|
54
|
+
worker_memory = "1Gi"
|
|
55
|
+
worker_replicas = 1
|
|
56
|
+
{{/if}}
|
|
57
|
+
|
|
58
|
+
debug = "true"
|
|
59
|
+
log_retention_days = 30
|
|
60
|
+
{{#if withPostgres}}
|
|
61
|
+
|
|
62
|
+
# Azure Database for PostgreSQL (Flexible Server)
|
|
63
|
+
# Burstable (B_) is the cheap dev tier; move to GP_Standard_* for production —
|
|
64
|
+
# zone-redundant HA is not available on Burstable.
|
|
65
|
+
db_sku_name = "B_Standard_B1ms"
|
|
66
|
+
db_storage_mb = 32768
|
|
67
|
+
db_backup_retention_days = 7
|
|
68
|
+
db_high_availability = false
|
|
69
|
+
{{/if}}
|