@smi-digital/create-smi-app 2.7.5 → 2.7.6
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 +16 -1
- package/package.json +1 -1
- package/templates/integrations/strapi-astro/databases.yml.template +15 -0
- package/templates/integrations/strapi-astro/docker-compose.yml.template +8 -3
- package/templates/integrations/strapi-astro/integration.config.json +4 -0
- package/templates/integrations/strapi-astro/production.backend.env.template +11 -0
package/dist/index.js
CHANGED
|
@@ -504,6 +504,14 @@ async function createApps(projectRoot, targets) {
|
|
|
504
504
|
`Could not normalize config/plugins.ts: ${error instanceof Error ? error.message : String(error)}`
|
|
505
505
|
);
|
|
506
506
|
}
|
|
507
|
+
await runStep(
|
|
508
|
+
"Adding Postgres driver (pg) for production",
|
|
509
|
+
async () => runCommandQuiet(
|
|
510
|
+
"npm",
|
|
511
|
+
["install", "pg"],
|
|
512
|
+
join4(projectRoot, target.directory)
|
|
513
|
+
)
|
|
514
|
+
);
|
|
507
515
|
}
|
|
508
516
|
await runSequentially(index + 1);
|
|
509
517
|
};
|
|
@@ -590,7 +598,14 @@ async function createIntegrations(options, projectRoot, templatesDir) {
|
|
|
590
598
|
api_token_salt: generateSecret(),
|
|
591
599
|
admin_jwt_secret: generateSecret(),
|
|
592
600
|
transfer_token_salt: generateSecret(),
|
|
593
|
-
jwt_secret: generateSecret()
|
|
601
|
+
jwt_secret: generateSecret(),
|
|
602
|
+
// Postgres identifier derived from app_name (hyphens -> underscores), so
|
|
603
|
+
// the role/database name needs no quoting.
|
|
604
|
+
db_name: String(options.integrationInputs?.app_name ?? "").replaceAll(
|
|
605
|
+
"-",
|
|
606
|
+
"_"
|
|
607
|
+
),
|
|
608
|
+
db_password: generateSecret()
|
|
594
609
|
/* eslint-enable camelcase */
|
|
595
610
|
};
|
|
596
611
|
return copyTemplateFile(
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Databases this project needs on the shared Postgres instance.
|
|
2
|
+
# The deploy provisions each one (login role + database) automatically — no
|
|
3
|
+
# manual step, no SSH. This file is the GitOps source of truth for the project's
|
|
4
|
+
# databases; passwords live (encrypted) in production.backend.env.
|
|
5
|
+
#
|
|
6
|
+
# - name: the database AND login-role name (Postgres-safe identifier)
|
|
7
|
+
# - password_env: the variable in production.backend.env holding its password
|
|
8
|
+
#
|
|
9
|
+
# To add an app-managed database (e.g. a separate dataset the site reads), add an
|
|
10
|
+
# entry here and its connection vars to production.backend.env:
|
|
11
|
+
# - name: my_dataset
|
|
12
|
+
# password_env: MY_DATASET_DATABASE_PASSWORD
|
|
13
|
+
databases:
|
|
14
|
+
- name: __DB_NAME__
|
|
15
|
+
password_env: DATABASE_PASSWORD
|
|
@@ -6,9 +6,9 @@ services:
|
|
|
6
6
|
restart: unless-stopped
|
|
7
7
|
env_file:
|
|
8
8
|
- ./backend.env
|
|
9
|
-
volumes:
|
|
9
|
+
volumes:
|
|
10
|
+
# Uploads stay on local disk for now; DB lives in Postgres (no sqlite volume).
|
|
10
11
|
- ./data/uploads:/opt/app/public/uploads
|
|
11
|
-
- ./data/database:/opt/app/.tmp
|
|
12
12
|
networks:
|
|
13
13
|
- agency_shared_network
|
|
14
14
|
healthcheck:
|
|
@@ -27,7 +27,10 @@ services:
|
|
|
27
27
|
- "traefik.http.services.__APP_NAME__-strapi.loadbalancer.server.port=1337"
|
|
28
28
|
# Strapi requires larger body sizes for media uploads (25MB)
|
|
29
29
|
- "traefik.http.middlewares.__APP_NAME__-strapi-limit.buffering.maxRequestBodyBytes=25000000"
|
|
30
|
-
|
|
30
|
+
# Global middlewares (defined in webhosting-infra/traefik/dynamic) + the local
|
|
31
|
+
# body-size limit. rate-limit first so abusive traffic is dropped early; this
|
|
32
|
+
# matters most on the public Strapi admin/API.
|
|
33
|
+
- "traefik.http.routers.__APP_NAME__-strapi.middlewares=rate-limit@file,secure-headers@file,__APP_NAME__-strapi-limit"
|
|
31
34
|
|
|
32
35
|
__APP_NAME__-astro:
|
|
33
36
|
container_name: __APP_NAME__-astro
|
|
@@ -75,6 +78,8 @@ services:
|
|
|
75
78
|
# Listen on both www and non-www
|
|
76
79
|
- "traefik.http.routers.__APP_NAME__-astro.rule=Host(`__PROJECT_DOMAIN__`) || Host(`www.__PROJECT_DOMAIN__`)"
|
|
77
80
|
- "traefik.http.routers.__APP_NAME__-astro.tls.certresolver=letsencrypt"
|
|
81
|
+
# Global middlewares (defined in webhosting-infra/traefik/dynamic)
|
|
82
|
+
- "traefik.http.routers.__APP_NAME__-astro.middlewares=secure-headers@file,rate-limit@file"
|
|
78
83
|
# Route traffic to the Nginx Cache (Port 80) instead of Astro directly
|
|
79
84
|
- "traefik.http.services.__APP_NAME__-astro.loadbalancer.server.port=80"
|
|
80
85
|
|
|
@@ -17,6 +17,17 @@ ADMIN_JWT_SECRET=__ADMIN_JWT_SECRET__
|
|
|
17
17
|
TRANSFER_TOKEN_SALT=__TRANSFER_TOKEN_SALT__
|
|
18
18
|
JWT_SECRET=__JWT_SECRET__
|
|
19
19
|
|
|
20
|
+
# Database — production uses Postgres (local dev defaults to SQLite).
|
|
21
|
+
# A matching role + database must exist on the shared Postgres instance,
|
|
22
|
+
# reachable as DATABASE_HOST on the agency_shared_network.
|
|
23
|
+
DATABASE_CLIENT=postgres
|
|
24
|
+
DATABASE_HOST=postgres
|
|
25
|
+
DATABASE_PORT=5432
|
|
26
|
+
DATABASE_NAME=__DB_NAME__
|
|
27
|
+
DATABASE_USERNAME=__DB_NAME__
|
|
28
|
+
DATABASE_PASSWORD=__DB_PASSWORD__
|
|
29
|
+
DATABASE_SSL=false
|
|
30
|
+
|
|
20
31
|
# Production Settings
|
|
21
32
|
HOST=0.0.0.0
|
|
22
33
|
PORT=1337
|