@dotcms/create-app 26.9.3-1 → 26.9.3-1-next.2649

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/README.md CHANGED
@@ -8,10 +8,10 @@ Beta. Behavior and flags may change.
8
8
 
9
9
  ## Requirements
10
10
 
11
- - Node.js + npm
11
+ - Node.js 22.22.3+ and npm
12
12
  - Git
13
13
  - Docker (for `--local` or `--starter`)
14
- - Internet access (downloads templates and docker-compose)
14
+ - Internet access (downloads templates; pulls Docker images)
15
15
 
16
16
  ## Which SDK Version Should I Use?
17
17
 
@@ -89,22 +89,27 @@ Flow:
89
89
  2. Checks dotCMS health at `/api/v1/appconfiguration`.
90
90
  3. Authenticates (up to 3 attempts).
91
91
  4. Reads `defaultSite` from `/api/v1/site/defaultSite`.
92
- 5. Configures UVE via `/api/v1/apps/dotema-config-v2/{siteId}`.
92
+ 5. Configures UVE via `/api/v1/apps/dotema-config-v2/{siteId}`. **Optional** — if this fails the
93
+ CLI warns, explains how to finish it by hand, and carries on.
93
94
  6. Scaffolds selected frontend and runs `npm install`.
94
- 7. Prints framework-specific env setup instructions.
95
+ 7. Writes `.env` with your host, site ID and token (see [Your `.env`](#your-env)).
95
96
 
96
97
  ### 2) Local mode (`--local`)
97
98
 
98
99
  Flow:
99
100
 
100
101
  1. Validates Docker availability.
101
- 2. Validates required ports: `8082`, `8443`, `9200`, `9600`.
102
- 3. Downloads docker-compose from dotCMS main repo.
103
- 4. Runs `docker compose up -d`.
104
- 5. Waits for local health check.
102
+ 2. Checks the ports this stack publishes: `8082`, `8443` and `8090`. A dotCMS already running on
103
+ `8082` is not treated as a conflict — see [If dotCMS is already running](#if-dotcms-is-already-running).
104
+ 3. Writes the **bundled** `docker-compose.yml` into the project directory (see
105
+ [The bundled Docker stack](#the-bundled-docker-stack)).
106
+ 4. Runs `docker compose up -d --wait`, which blocks until every service reports healthy, streaming
107
+ progress and elapsed time so a long first pull is never a silent spinner.
108
+ 5. Waits for readiness on `/dotmgt/readyz`, falling back to `/api/v1/appconfiguration`.
105
109
  6. Authenticates with default local credentials (`admin@dotcms.com` / `admin`).
106
- 7. Reads `defaultSite`, configures UVE, scaffolds frontend, runs `npm install`.
107
- 8. Prints framework-specific env setup instructions.
110
+ 7. Reads `defaultSite`, configures UVE (optional — a failure warns and continues), scaffolds the
111
+ frontend, runs `npm install`.
112
+ 8. Writes `.env` with your host, site ID and token (see [Your `.env`](#your-env)).
108
113
 
109
114
  ### 3) Starter-only local mode (`--starter <url>`)
110
115
 
@@ -113,7 +118,7 @@ Flow:
113
118
  Flow:
114
119
 
115
120
  1. Same Docker and port checks as local mode.
116
- 2. Downloads docker-compose.
121
+ 2. Writes the bundled `docker-compose.yml`.
117
122
  3. Rewrites `CUSTOM_STARTER_URL` in `docker-compose.yml`.
118
123
  4. Also passes `CUSTOM_STARTER_URL` in compose environment at runtime.
119
124
  5. Starts containers and waits for health check.
@@ -121,6 +126,77 @@ Flow:
121
126
 
122
127
  Use this when your starter is not compatible with the default frontend sample flow.
123
128
 
129
+ ## The bundled Docker stack
130
+
131
+ `--local` and `--starter` write a `docker-compose.yml` that **ships inside this package**. It is
132
+ no longer downloaded from the `dotCMS/core` repository at run time, so the stack you get is the one
133
+ this CLI version was tested against, rather than whatever is currently on `main`.
134
+
135
+ The stack is `db` (PostgreSQL), `opensearch`, and `dotcms`. `dotcms` starts only after both
136
+ dependencies report **healthy**, and carries `restart: unless-stopped`, so it no longer races
137
+ Postgres and exit at startup.
138
+
139
+ ### Published ports
140
+
141
+ | Port | Binding | Purpose |
142
+ | --- | --- | --- |
143
+ | `8082` | all interfaces | dotCMS HTTP |
144
+ | `8443` | all interfaces | dotCMS HTTPS |
145
+ | `8090` | **`127.0.0.1` only** | dotCMS management endpoints |
146
+
147
+ PostgreSQL and OpenSearch publish **no** ports — they are reachable only from inside the compose
148
+ network, so running your own Postgres or OpenSearch on the usual ports does not conflict.
149
+
150
+ > **Why 8090 is loopback-only.** It serves `/dotmgt/livez`, `/dotmgt/readyz`, `/dotmgt/health` and
151
+ > `/dotmgt/metrics`, and dotCMS authorizes those purely by the port a request arrives on — there is
152
+ > no credential check and no IP allow-list. Binding it to `0.0.0.0` would expose your instance's
153
+ > health and metrics to everyone on your network. It is bound to `127.0.0.1` deliberately; do not
154
+ > "fix" it to a wildcard.
155
+
156
+ ### Using a different compose file
157
+
158
+ Set `DOTCMS_COMPOSE_URL` to fetch one from a URL instead of using the bundled file:
159
+
160
+ ```bash
161
+ DOTCMS_COMPOSE_URL=https://example.com/my-compose.yml npx @dotcms/create-app my-app --local
162
+ ```
163
+
164
+ This is an escape hatch for hotfixes. The file must keep a single-line `CUSTOM_STARTER_URL:` entry
165
+ or `--starter` will fail against it.
166
+
167
+ ## If dotCMS is already running
168
+
169
+ A dotCMS on `8082` from a previous run is not a conflict — the CLI probes it and offers a choice:
170
+
171
+ ```
172
+ ⚠ Found a dotCMS already running at http://localhost:8082
173
+ Docker project "my-app" · Up 8 minutes (healthy)
174
+
175
+ ? How would you like to continue?
176
+ ❯ Use this instance for my project
177
+ Replace it with a clean instance
178
+ Cancel
179
+ ```
180
+
181
+ **Replace** stops that Docker project and removes its volumes (`docker compose -p <project> down -v`)
182
+ before starting fresh. It is offered only when a Compose project owns the port — something started
183
+ outside Compose is not the CLI's to destroy.
184
+
185
+ Reuse requires the instance to pass a readiness check **and** issue a token; anything else on `8082`
186
+ is still a hard failure.
187
+
188
+ In a non-interactive run (CI, or no TTY) the CLI auto-reuses and prints a notice. It never replaces
189
+ without being asked.
190
+
191
+ ## Your `.env`
192
+
193
+ The CLI writes `.env` into your project with the values the scaffolded app reads — `NEXT_PUBLIC_*`
194
+ for Next.js, `PUBLIC_*` for Astro. You do not need to copy anything by hand.
195
+
196
+ An existing `.env` is never overwritten: the CLI prints the values instead so you can merge them.
197
+ Angular has no `.env` — it reads a TypeScript `environment` object, so the values are printed for
198
+ you to paste into the environment files.
199
+
124
200
  ## Examples
125
201
 
126
202
  Interactive:
@@ -172,9 +248,10 @@ Docker not available:
172
248
 
173
249
  Ports already in use:
174
250
 
175
- - macOS/Linux: `lsof -i :8082`
176
- - Windows: `netstat -ano | findstr ":8082"`
177
- - Stop conflicting services or run `docker compose down`.
251
+ - If it is a dotCMS from a previous run, the CLI offers to reuse or replace it — see
252
+ [If dotCMS is already running](#if-dotcms-is-already-running).
253
+ - Otherwise, find the owner: `lsof -i :8082` (macOS/Linux) or
254
+ `netstat -ano | findstr ":8082"` (Windows), then stop it or run `docker compose down`.
178
255
 
179
256
  `zip END header not found` during starter load:
180
257
 
@@ -186,13 +263,19 @@ Ports already in use:
186
263
  Build:
187
264
 
188
265
  ```sh
189
- yarn nx build sdk-create-app --skip-nx-cache
266
+ pnpm nx build sdk-create-app --skip-nx-cache
190
267
  ```
191
268
 
192
269
  Lint:
193
270
 
194
271
  ```sh
195
- yarn nx lint sdk-create-app
272
+ pnpm nx lint sdk-create-app
273
+ ```
274
+
275
+ Verify the package ships correctly (asserts the compose asset reaches `dist/` and the npm tarball):
276
+
277
+ ```sh
278
+ pnpm nx verify-package sdk-create-app
196
279
  ```
197
280
 
198
281
  Dist output:
@@ -0,0 +1,86 @@
1
+ # Bundled with @dotcms/create-app. Written to the project directory by the CLI.
2
+ # Implements contracts/compose-service-contract.md C1-C8.
3
+ services:
4
+ db:
5
+ image: pgvector/pgvector:pg18
6
+ command: postgres -c 'max_connections=400' -c 'shared_buffers=128MB'
7
+ environment:
8
+ POSTGRES_USER: 'dotcmsdbuser'
9
+ POSTGRES_PASSWORD: 'password'
10
+ POSTGRES_DB: 'dotcms'
11
+ volumes:
12
+ - dbdata:/var/lib/postgresql
13
+ networks: [db_net]
14
+ healthcheck:
15
+ test: ['CMD-SHELL', 'pg_isready -U dotcmsdbuser -d dotcms -h localhost -p 5432']
16
+ interval: 10s
17
+ timeout: 5s
18
+ retries: 5
19
+ restart: unless-stopped
20
+
21
+ opensearch:
22
+ image: opensearchproject/opensearch:1
23
+ environment:
24
+ cluster.name: 'elastic-cluster'
25
+ discovery.type: 'single-node'
26
+ bootstrap.memory_lock: 'true'
27
+ OPENSEARCH_JAVA_OPTS: '-Xmx1G'
28
+ ulimits:
29
+ memlock: { soft: -1, hard: -1 }
30
+ nofile: { soft: 65536, hard: 65536 }
31
+ volumes:
32
+ - opensearch-data:/usr/share/opensearch/data
33
+ networks: [opensearch-net]
34
+ healthcheck:
35
+ test:
36
+ [
37
+ 'CMD-SHELL',
38
+ 'curl -sk https://localhost:9200 -u admin:admin | grep -q cluster_name'
39
+ ]
40
+ interval: 10s
41
+ timeout: 5s
42
+ retries: 12
43
+ restart: unless-stopped
44
+
45
+ dotcms:
46
+ image: dotcms/dotcms:latest
47
+ environment:
48
+ CMS_JAVA_OPTS: '-Xmx1g '
49
+ LANG: 'C.UTF-8'
50
+ TZ: 'UTC'
51
+ DB_BASE_URL: 'jdbc:postgresql://db/dotcms'
52
+ DB_USERNAME: 'dotcmsdbuser'
53
+ DB_PASSWORD: 'password'
54
+ DOT_ES_AUTH_BASIC_PASSWORD: 'admin'
55
+ DOT_ES_ENDPOINTS: 'https://opensearch:9200'
56
+ DOT_INITIAL_ADMIN_PASSWORD: 'admin'
57
+ DOT_DOTCMS_CLUSTER_ID: 'dotcms-production'
58
+ CUSTOM_STARTER_URL: 'https://repo.dotcms.com/artifactory/libs-release-local/com/dotcms/starter/20260630/starter-20260630.zip'
59
+ depends_on:
60
+ db:
61
+ condition: service_healthy
62
+ opensearch:
63
+ condition: service_healthy
64
+ volumes:
65
+ - cms-shared:/data/shared
66
+ networks: [db_net, opensearch-net]
67
+ healthcheck:
68
+ test: ['CMD', 'curl', '-f', 'http://127.0.0.1:8090/dotmgt/livez']
69
+ interval: 30s
70
+ timeout: 10s
71
+ retries: 5
72
+ start_period: 180s
73
+ restart: unless-stopped
74
+ ports:
75
+ - '8082:8082'
76
+ - '8443:8443'
77
+ - '127.0.0.1:8090:8090'
78
+
79
+ networks:
80
+ db_net:
81
+ opensearch-net:
82
+
83
+ volumes:
84
+ cms-shared:
85
+ dbdata:
86
+ opensearch-data: