@semiont/cli 0.2.26-build.33 → 0.2.26
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/cli.mjs +17 -32
- package/dist/templates/cdk/app-stack.ts +4 -4
- package/package.json +3 -3
- package/dist/templates/docker-compose.yml +0 -53
- package/dist/templates/envoy.yaml +0 -152
package/dist/cli.mjs
CHANGED
|
@@ -17811,7 +17811,9 @@ var init_frontend_provision = __esm({
|
|
|
17811
17811
|
}
|
|
17812
17812
|
const nextAuthSecret = crypto3.randomBytes(32).toString("base64");
|
|
17813
17813
|
const config2 = service.config;
|
|
17814
|
+
const frontendUrl = config2.url;
|
|
17814
17815
|
const port = config2.port;
|
|
17816
|
+
const semiontEnv = service.environment;
|
|
17815
17817
|
const siteName = config2.siteName;
|
|
17816
17818
|
const backendService = service.environmentConfig.services["backend"];
|
|
17817
17819
|
if (!backendService) {
|
|
@@ -17821,14 +17823,14 @@ var init_frontend_provision = __esm({
|
|
|
17821
17823
|
metadata: { serviceType: "frontend" }
|
|
17822
17824
|
};
|
|
17823
17825
|
}
|
|
17824
|
-
|
|
17826
|
+
const backendUrl = backendService.publicURL;
|
|
17827
|
+
if (!backendUrl) {
|
|
17825
17828
|
return {
|
|
17826
17829
|
success: false,
|
|
17827
|
-
error: "Backend
|
|
17830
|
+
error: "Backend publicURL not configured",
|
|
17828
17831
|
metadata: { serviceType: "frontend" }
|
|
17829
17832
|
};
|
|
17830
17833
|
}
|
|
17831
|
-
const backendUrl = `http://localhost:${backendService.port}`;
|
|
17832
17834
|
if (!siteName) {
|
|
17833
17835
|
return {
|
|
17834
17836
|
success: false,
|
|
@@ -17837,37 +17839,15 @@ var init_frontend_provision = __esm({
|
|
|
17837
17839
|
};
|
|
17838
17840
|
}
|
|
17839
17841
|
const oauthAllowedDomains = service.environmentConfig.site?.oauthAllowedDomains || [];
|
|
17840
|
-
const frontendService = service.environmentConfig.services["frontend"];
|
|
17841
|
-
if (!frontendService) {
|
|
17842
|
-
return {
|
|
17843
|
-
success: false,
|
|
17844
|
-
error: "Frontend service not found in environment configuration",
|
|
17845
|
-
metadata: { serviceType: "frontend" }
|
|
17846
|
-
};
|
|
17847
|
-
}
|
|
17848
|
-
if (!frontendService.publicURL) {
|
|
17849
|
-
return {
|
|
17850
|
-
success: false,
|
|
17851
|
-
error: "Frontend publicURL not configured - required for NextAuth",
|
|
17852
|
-
metadata: { serviceType: "frontend" }
|
|
17853
|
-
};
|
|
17854
|
-
}
|
|
17855
|
-
const frontendUrl = frontendService.publicURL;
|
|
17856
|
-
const allowedOrigins = [];
|
|
17857
|
-
if (frontendService.allowedOrigins && Array.isArray(frontendService.allowedOrigins)) {
|
|
17858
|
-
allowedOrigins.push(...frontendService.allowedOrigins);
|
|
17859
|
-
}
|
|
17860
|
-
const publicUrl = new URL(frontendService.publicURL);
|
|
17861
|
-
allowedOrigins.push(publicUrl.host);
|
|
17862
17842
|
const envUpdates = {
|
|
17863
17843
|
"NODE_ENV": "development",
|
|
17864
17844
|
"PORT": port.toString(),
|
|
17865
17845
|
"NEXTAUTH_URL": frontendUrl,
|
|
17866
17846
|
"NEXTAUTH_SECRET": nextAuthSecret,
|
|
17867
|
-
"
|
|
17847
|
+
"SEMIONT_ENV": semiontEnv,
|
|
17848
|
+
"NEXT_PUBLIC_API_URL": backendUrl,
|
|
17868
17849
|
"NEXT_PUBLIC_SITE_NAME": siteName,
|
|
17869
|
-
"NEXT_PUBLIC_OAUTH_ALLOWED_DOMAINS": oauthAllowedDomains.join(",")
|
|
17870
|
-
"NEXT_PUBLIC_ALLOWED_ORIGINS": allowedOrigins.join(",")
|
|
17850
|
+
"NEXT_PUBLIC_OAUTH_ALLOWED_DOMAINS": oauthAllowedDomains.join(",")
|
|
17871
17851
|
};
|
|
17872
17852
|
if (fs20.existsSync(envExamplePath)) {
|
|
17873
17853
|
let envContent = fs20.readFileSync(envExamplePath, "utf-8");
|
|
@@ -17899,8 +17879,11 @@ PORT=${port}
|
|
|
17899
17879
|
NEXTAUTH_URL=${frontendUrl}
|
|
17900
17880
|
NEXTAUTH_SECRET=${nextAuthSecret}
|
|
17901
17881
|
|
|
17902
|
-
#
|
|
17903
|
-
|
|
17882
|
+
# Semiont Configuration System
|
|
17883
|
+
SEMIONT_ENV=${semiontEnv}
|
|
17884
|
+
|
|
17885
|
+
# Backend API URL (from backend.publicURL in environment config)
|
|
17886
|
+
NEXT_PUBLIC_API_URL=${backendUrl}
|
|
17904
17887
|
|
|
17905
17888
|
# Site name (from frontend.siteName in environment config)
|
|
17906
17889
|
NEXT_PUBLIC_SITE_NAME=${siteName}
|
|
@@ -17994,7 +17977,7 @@ This directory contains runtime files for the frontend service.
|
|
|
17994
17977
|
## Configuration
|
|
17995
17978
|
|
|
17996
17979
|
Edit \`.env.local\` to configure:
|
|
17997
|
-
-
|
|
17980
|
+
- API URL (NEXT_PUBLIC_API_URL)
|
|
17998
17981
|
- Port (PORT)
|
|
17999
17982
|
- Other environment-specific settings
|
|
18000
17983
|
|
|
@@ -24955,6 +24938,8 @@ var init_ecs_publish = __esm({
|
|
|
24955
24938
|
const buildEnv = { ...process.env };
|
|
24956
24939
|
if (service.name === "frontend") {
|
|
24957
24940
|
const domain2 = envConfig.site.domain || service.config?.domain || (service.environment === "production" ? "semiont.com" : `${service.environment}.semiont.com`);
|
|
24941
|
+
const apiUrl = `https://${domain2}`;
|
|
24942
|
+
buildEnv.NEXT_PUBLIC_API_URL = apiUrl;
|
|
24958
24943
|
buildEnv.NEXT_PUBLIC_APP_NAME = envConfig.site.siteName || "Semiont";
|
|
24959
24944
|
buildEnv.NEXT_PUBLIC_SITE_NAME = envConfig.site.siteName || "Semiont";
|
|
24960
24945
|
buildEnv.NEXT_PUBLIC_DOMAIN = domain2;
|
|
@@ -24963,9 +24948,9 @@ var init_ecs_publish = __esm({
|
|
|
24963
24948
|
buildEnv.NEXT_TELEMETRY_DISABLED = "1";
|
|
24964
24949
|
if (!service.quiet && service.verbose) {
|
|
24965
24950
|
printInfo(`Frontend build configuration:`);
|
|
24951
|
+
printInfo(` API URL: ${apiUrl}`);
|
|
24966
24952
|
printInfo(` Domain: ${domain2}`);
|
|
24967
24953
|
printInfo(` Site Name: ${buildEnv.NEXT_PUBLIC_SITE_NAME}`);
|
|
24968
|
-
printInfo(` API Routing: ALB routes /resources/*, /annotations/*, etc. to backend (runtime)`);
|
|
24969
24954
|
printInfo(` OAuth Domains: ${envConfig.site.oauthAllowedDomains?.join(", ") || "(none)"} (set at runtime)`);
|
|
24970
24955
|
}
|
|
24971
24956
|
}
|
|
@@ -362,17 +362,17 @@ export class SemiontAppStack extends cdk.Stack {
|
|
|
362
362
|
PORT: '3000',
|
|
363
363
|
HOSTNAME: '0.0.0.0',
|
|
364
364
|
// Public environment variables (available to browser)
|
|
365
|
+
NEXT_PUBLIC_API_URL: `https://${domainName}`,
|
|
365
366
|
NEXT_PUBLIC_SITE_NAME: siteName,
|
|
366
367
|
NEXT_PUBLIC_DOMAIN: domainName,
|
|
367
368
|
// OAuth domains for server-side NextAuth validation
|
|
368
369
|
OAUTH_ALLOWED_DOMAINS: Array.isArray(oauthAllowedDomains) ? oauthAllowedDomains.join(',') : oauthAllowedDomains,
|
|
369
370
|
// NextAuth configuration
|
|
370
371
|
NEXTAUTH_URL: `https://${domainName}`,
|
|
371
|
-
// Backend URL for server-side
|
|
372
|
-
// Used by frontend's NextAuth
|
|
372
|
+
// Backend URL for server-side authentication calls (Service Connect DNS)
|
|
373
|
+
// Used by frontend's NextAuth to communicate with backend container-to-container
|
|
373
374
|
// This is NOT the public URL - it's the internal AWS Service Connect address
|
|
374
|
-
|
|
375
|
-
SERVER_API_URL: 'http://backend:4000',
|
|
375
|
+
BACKEND_INTERNAL_URL: 'http://backend:4000',
|
|
376
376
|
},
|
|
377
377
|
secrets: {
|
|
378
378
|
NEXTAUTH_SECRET: ecs.Secret.fromSecretsManager(appSecrets, 'nextAuthSecret'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semiont/cli",
|
|
3
|
-
"version": "0.2.26
|
|
3
|
+
"version": "0.2.26",
|
|
4
4
|
"description": "Semiont CLI - Unified environment management tool",
|
|
5
5
|
"_comment": "AWS SDK dependencies (@aws-sdk/*) are only used by platforms/aws",
|
|
6
6
|
"type": "module",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"@aws-sdk/client-sts": "^3.859.0",
|
|
66
66
|
"@aws-sdk/client-wafv2": "^3.859.0",
|
|
67
67
|
"@prisma/client": "^6.13.0",
|
|
68
|
-
"@semiont/api-client": "0.2.26
|
|
69
|
-
"@semiont/core": "0.2.26
|
|
68
|
+
"@semiont/api-client": "0.2.26",
|
|
69
|
+
"@semiont/core": "0.2.26",
|
|
70
70
|
"@testcontainers/postgresql": "^11.5.1",
|
|
71
71
|
"arg": "^5.0.2",
|
|
72
72
|
"bcrypt": "^5.1.1",
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# Docker Compose configuration with Envoy proxy for local development
|
|
2
|
-
version: '3.8'
|
|
3
|
-
|
|
4
|
-
services:
|
|
5
|
-
envoy:
|
|
6
|
-
image: envoyproxy/envoy:v1.28-latest
|
|
7
|
-
ports:
|
|
8
|
-
- "80:80"
|
|
9
|
-
- "9901:9901" # Admin interface
|
|
10
|
-
volumes:
|
|
11
|
-
- ./apps/cli/templates/envoy.yaml:/etc/envoy/envoy.yaml:ro
|
|
12
|
-
depends_on:
|
|
13
|
-
- frontend
|
|
14
|
-
- backend
|
|
15
|
-
networks:
|
|
16
|
-
- semiont
|
|
17
|
-
|
|
18
|
-
frontend:
|
|
19
|
-
image: ghcr.io/the-ai-alliance/semiont-frontend:dev
|
|
20
|
-
environment:
|
|
21
|
-
- SERVER_API_URL=http://backend:4000
|
|
22
|
-
- NEXTAUTH_URL=http://localhost
|
|
23
|
-
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
|
|
24
|
-
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
|
|
25
|
-
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
|
|
26
|
-
networks:
|
|
27
|
-
- semiont
|
|
28
|
-
|
|
29
|
-
backend:
|
|
30
|
-
image: ghcr.io/the-ai-alliance/semiont-backend:dev
|
|
31
|
-
environment:
|
|
32
|
-
- DATABASE_URL=${DATABASE_URL}
|
|
33
|
-
- JWT_SECRET=${JWT_SECRET}
|
|
34
|
-
networks:
|
|
35
|
-
- semiont
|
|
36
|
-
|
|
37
|
-
postgres:
|
|
38
|
-
image: postgres:16-alpine
|
|
39
|
-
environment:
|
|
40
|
-
- POSTGRES_DB=semiont
|
|
41
|
-
- POSTGRES_USER=semiont
|
|
42
|
-
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
|
43
|
-
volumes:
|
|
44
|
-
- postgres_data:/var/lib/postgresql/data
|
|
45
|
-
networks:
|
|
46
|
-
- semiont
|
|
47
|
-
|
|
48
|
-
networks:
|
|
49
|
-
semiont:
|
|
50
|
-
driver: bridge
|
|
51
|
-
|
|
52
|
-
volumes:
|
|
53
|
-
postgres_data:
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
# Envoy proxy configuration for local development and Codespaces
|
|
2
|
-
# Routes traffic between frontend (Next.js) and backend (Hono API)
|
|
3
|
-
#
|
|
4
|
-
# Routing rules (order matters - first match wins):
|
|
5
|
-
# 1. /api/auth/* → frontend (NextAuth)
|
|
6
|
-
# 2. /api/cookies/* → frontend (cookie consent/export)
|
|
7
|
-
# 3. /api/resources/* → frontend (authenticated proxy for images/files)
|
|
8
|
-
# 4. /resources/* → backend (main API)
|
|
9
|
-
# 5. /annotations/* → backend (main API)
|
|
10
|
-
# 6. /admin/* → backend (main API)
|
|
11
|
-
# 7. /api/* → backend (OpenAPI docs, spec)
|
|
12
|
-
# 8. /* → frontend (Next.js pages)
|
|
13
|
-
|
|
14
|
-
static_resources:
|
|
15
|
-
listeners:
|
|
16
|
-
- name: listener_0
|
|
17
|
-
address:
|
|
18
|
-
socket_address:
|
|
19
|
-
address: 0.0.0.0
|
|
20
|
-
port_value: 80
|
|
21
|
-
filter_chains:
|
|
22
|
-
- filters:
|
|
23
|
-
- name: envoy.filters.network.http_connection_manager
|
|
24
|
-
typed_config:
|
|
25
|
-
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
|
|
26
|
-
stat_prefix: ingress_http
|
|
27
|
-
access_log:
|
|
28
|
-
- name: envoy.access_loggers.stdout
|
|
29
|
-
typed_config:
|
|
30
|
-
"@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog
|
|
31
|
-
http_filters:
|
|
32
|
-
- name: envoy.filters.http.router
|
|
33
|
-
typed_config:
|
|
34
|
-
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
|
|
35
|
-
route_config:
|
|
36
|
-
name: local_route
|
|
37
|
-
virtual_hosts:
|
|
38
|
-
- name: local_service
|
|
39
|
-
domains: ["*"]
|
|
40
|
-
routes:
|
|
41
|
-
# Frontend Next.js API routes (must come before backend /api/*)
|
|
42
|
-
- match:
|
|
43
|
-
prefix: "/api/auth/"
|
|
44
|
-
route:
|
|
45
|
-
cluster: frontend
|
|
46
|
-
timeout: 30s
|
|
47
|
-
- match:
|
|
48
|
-
prefix: "/api/cookies/"
|
|
49
|
-
route:
|
|
50
|
-
cluster: frontend
|
|
51
|
-
timeout: 30s
|
|
52
|
-
- match:
|
|
53
|
-
prefix: "/api/resources/"
|
|
54
|
-
route:
|
|
55
|
-
cluster: frontend
|
|
56
|
-
timeout: 30s
|
|
57
|
-
|
|
58
|
-
# Backend API routes (without /api prefix)
|
|
59
|
-
- match:
|
|
60
|
-
prefix: "/resources/"
|
|
61
|
-
route:
|
|
62
|
-
cluster: backend
|
|
63
|
-
timeout: 30s
|
|
64
|
-
- match:
|
|
65
|
-
prefix: "/annotations/"
|
|
66
|
-
route:
|
|
67
|
-
cluster: backend
|
|
68
|
-
timeout: 30s
|
|
69
|
-
- match:
|
|
70
|
-
prefix: "/admin/"
|
|
71
|
-
route:
|
|
72
|
-
cluster: backend
|
|
73
|
-
timeout: 30s
|
|
74
|
-
- match:
|
|
75
|
-
prefix: "/entity-types/"
|
|
76
|
-
route:
|
|
77
|
-
cluster: backend
|
|
78
|
-
timeout: 30s
|
|
79
|
-
- match:
|
|
80
|
-
prefix: "/jobs/"
|
|
81
|
-
route:
|
|
82
|
-
cluster: backend
|
|
83
|
-
timeout: 30s
|
|
84
|
-
- match:
|
|
85
|
-
prefix: "/users/"
|
|
86
|
-
route:
|
|
87
|
-
cluster: backend
|
|
88
|
-
timeout: 30s
|
|
89
|
-
- match:
|
|
90
|
-
prefix: "/tokens/"
|
|
91
|
-
route:
|
|
92
|
-
cluster: backend
|
|
93
|
-
timeout: 30s
|
|
94
|
-
- match:
|
|
95
|
-
prefix: "/health"
|
|
96
|
-
route:
|
|
97
|
-
cluster: backend
|
|
98
|
-
timeout: 30s
|
|
99
|
-
- match:
|
|
100
|
-
prefix: "/status"
|
|
101
|
-
route:
|
|
102
|
-
cluster: backend
|
|
103
|
-
timeout: 30s
|
|
104
|
-
|
|
105
|
-
# Backend OpenAPI documentation routes
|
|
106
|
-
- match:
|
|
107
|
-
prefix: "/api/"
|
|
108
|
-
route:
|
|
109
|
-
cluster: backend
|
|
110
|
-
timeout: 30s
|
|
111
|
-
|
|
112
|
-
# Everything else goes to frontend (Next.js pages)
|
|
113
|
-
- match:
|
|
114
|
-
prefix: "/"
|
|
115
|
-
route:
|
|
116
|
-
cluster: frontend
|
|
117
|
-
timeout: 30s
|
|
118
|
-
|
|
119
|
-
clusters:
|
|
120
|
-
- name: backend
|
|
121
|
-
connect_timeout: 5s
|
|
122
|
-
type: STRICT_DNS
|
|
123
|
-
lb_policy: ROUND_ROBIN
|
|
124
|
-
load_assignment:
|
|
125
|
-
cluster_name: backend
|
|
126
|
-
endpoints:
|
|
127
|
-
- lb_endpoints:
|
|
128
|
-
- endpoint:
|
|
129
|
-
address:
|
|
130
|
-
socket_address:
|
|
131
|
-
address: backend
|
|
132
|
-
port_value: 4000
|
|
133
|
-
|
|
134
|
-
- name: frontend
|
|
135
|
-
connect_timeout: 5s
|
|
136
|
-
type: STRICT_DNS
|
|
137
|
-
lb_policy: ROUND_ROBIN
|
|
138
|
-
load_assignment:
|
|
139
|
-
cluster_name: frontend
|
|
140
|
-
endpoints:
|
|
141
|
-
- lb_endpoints:
|
|
142
|
-
- endpoint:
|
|
143
|
-
address:
|
|
144
|
-
socket_address:
|
|
145
|
-
address: frontend
|
|
146
|
-
port_value: 3000
|
|
147
|
-
|
|
148
|
-
admin:
|
|
149
|
-
address:
|
|
150
|
-
socket_address:
|
|
151
|
-
address: 0.0.0.0
|
|
152
|
-
port_value: 9901
|