create-objectstack 14.8.0 → 15.1.0
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/templates/blank/.dockerignore +6 -0
- package/dist/templates/blank/Dockerfile +30 -0
- package/dist/templates/blank/README.md +23 -0
- package/dist/templates/blank/docker-compose.yml +39 -0
- package/dist/templates/blank/objectstack.config.ts +5 -0
- package/dist/templates/blank/package.json +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Container build for this ObjectStack app.
|
|
2
|
+
#
|
|
3
|
+
# docker build -t my-app .
|
|
4
|
+
# docker run -p 8080:8080 \
|
|
5
|
+
# -e OS_DATABASE_URL="postgres://user:pass@db-host:5432/myapp" \
|
|
6
|
+
# -e OS_AUTH_SECRET -e OS_SECRET_KEY \
|
|
7
|
+
# my-app
|
|
8
|
+
#
|
|
9
|
+
# Or run the full app + Postgres stack: see docker-compose.yml.
|
|
10
|
+
# Docs: https://docs.objectstack.ai/docs/deployment/self-hosting
|
|
11
|
+
|
|
12
|
+
# ── Build stage: compile TypeScript metadata to the artifact ─────────
|
|
13
|
+
FROM node:22-slim AS build
|
|
14
|
+
WORKDIR /app
|
|
15
|
+
COPY package*.json ./
|
|
16
|
+
RUN npm ci
|
|
17
|
+
COPY . .
|
|
18
|
+
RUN npx os build # → dist/objectstack.json
|
|
19
|
+
|
|
20
|
+
# ── Runtime: the official ObjectStack runtime image ──────────────────
|
|
21
|
+
# Ships Node + @objectstack/cli with `os start`, a non-root user, the
|
|
22
|
+
# /api/v1/health HEALTHCHECK, and OS_ARTIFACT_PATH/OS_PORT preset (port 8080)
|
|
23
|
+
# — see docker/README.md in the framework repo. Pin the tag to the
|
|
24
|
+
# @objectstack/cli version in your package.json so the runtime matches the
|
|
25
|
+
# CLI that built the artifact.
|
|
26
|
+
FROM ghcr.io/objectstack-ai/objectstack:latest
|
|
27
|
+
COPY --from=build --chown=node:node /app/dist/objectstack.json /srv/app/objectstack.json
|
|
28
|
+
|
|
29
|
+
# OS_DATABASE_URL, OS_AUTH_SECRET, and OS_SECRET_KEY are injected at runtime —
|
|
30
|
+
# never bake them into the image.
|
|
@@ -40,6 +40,29 @@ otherwise fail *silently at runtime* — e.g. a bare `done` (instead of
|
|
|
40
40
|
`record.done`) in an action predicate that would hide the action on every
|
|
41
41
|
record. See `AGENTS.md` for the full convention.
|
|
42
42
|
|
|
43
|
+
## Deploy
|
|
44
|
+
|
|
45
|
+
The project ships container-ready — the `Dockerfile` builds your metadata into
|
|
46
|
+
an artifact and runs it on the official ObjectStack runtime image
|
|
47
|
+
(`ghcr.io/objectstack-ai/objectstack`):
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Image only
|
|
51
|
+
docker build -t my-app .
|
|
52
|
+
|
|
53
|
+
# Or the full app + Postgres stack
|
|
54
|
+
cat > .env <<EOF
|
|
55
|
+
POSTGRES_PASSWORD=$(openssl rand -hex 16)
|
|
56
|
+
OS_AUTH_SECRET=$(openssl rand -hex 32)
|
|
57
|
+
OS_SECRET_KEY=$(openssl rand -hex 32)
|
|
58
|
+
EOF
|
|
59
|
+
docker compose up -d
|
|
60
|
+
curl -fsS http://localhost:8080/api/v1/health
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Bare Node, Kubernetes, reverse-proxy wiring, and the required secrets are
|
|
64
|
+
covered in [Self-Hosted Deployment](https://docs.objectstack.ai/docs/deployment/self-hosting).
|
|
65
|
+
|
|
43
66
|
## Next steps
|
|
44
67
|
|
|
45
68
|
- Add an object: see the `objectstack-data` skill.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Single-host production stack: this app + Postgres.
|
|
2
|
+
#
|
|
3
|
+
# Create a .env file next to this compose file (never committed) with
|
|
4
|
+
# POSTGRES_PASSWORD / OS_AUTH_SECRET / OS_SECRET_KEY (generate secrets with
|
|
5
|
+
# `openssl rand -hex 32`), then `docker compose up -d`.
|
|
6
|
+
#
|
|
7
|
+
# Docs: https://docs.objectstack.ai/docs/deployment/self-hosting
|
|
8
|
+
|
|
9
|
+
services:
|
|
10
|
+
app:
|
|
11
|
+
build: .
|
|
12
|
+
ports:
|
|
13
|
+
- "8080:8080"
|
|
14
|
+
environment:
|
|
15
|
+
OS_DATABASE_URL: postgres://objectstack:${POSTGRES_PASSWORD}@db:5432/myapp
|
|
16
|
+
OS_AUTH_SECRET: ${OS_AUTH_SECRET}
|
|
17
|
+
OS_SECRET_KEY: ${OS_SECRET_KEY}
|
|
18
|
+
depends_on:
|
|
19
|
+
db:
|
|
20
|
+
condition: service_healthy
|
|
21
|
+
restart: unless-stopped
|
|
22
|
+
|
|
23
|
+
db:
|
|
24
|
+
image: postgres:17
|
|
25
|
+
environment:
|
|
26
|
+
POSTGRES_USER: objectstack
|
|
27
|
+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
28
|
+
POSTGRES_DB: myapp
|
|
29
|
+
volumes:
|
|
30
|
+
- pgdata:/var/lib/postgresql/data
|
|
31
|
+
healthcheck:
|
|
32
|
+
test: ["CMD-SHELL", "pg_isready -U objectstack -d myapp"]
|
|
33
|
+
interval: 5s
|
|
34
|
+
timeout: 3s
|
|
35
|
+
retries: 10
|
|
36
|
+
restart: unless-stopped
|
|
37
|
+
|
|
38
|
+
volumes:
|
|
39
|
+
pgdata:
|
|
@@ -9,6 +9,11 @@ export default defineStack({
|
|
|
9
9
|
type: 'app',
|
|
10
10
|
name: 'Blank Starter',
|
|
11
11
|
description: 'Minimal ObjectStack environment — a clean slate for building.',
|
|
12
|
+
// Protocol compatibility range (ADR-0087 D1): lets an incompatible runtime
|
|
13
|
+
// refuse this package at the boundary with the exact migration command,
|
|
14
|
+
// instead of crashing later. Kept in lockstep with releases by
|
|
15
|
+
// scripts/sync-template-versions.mjs.
|
|
16
|
+
engines: { protocol: '^15' },
|
|
12
17
|
},
|
|
13
18
|
objects: Object.values(objects),
|
|
14
19
|
});
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"typecheck": "tsc --noEmit"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@objectstack/spec": "^
|
|
15
|
-
"@objectstack/runtime": "^
|
|
16
|
-
"@objectstack/driver-memory": "^
|
|
17
|
-
"@objectstack/plugin-hono-server": "^
|
|
14
|
+
"@objectstack/spec": "^15.0.0",
|
|
15
|
+
"@objectstack/runtime": "^15.0.0",
|
|
16
|
+
"@objectstack/driver-memory": "^15.0.0",
|
|
17
|
+
"@objectstack/plugin-hono-server": "^15.0.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@objectstack/cli": "^
|
|
20
|
+
"@objectstack/cli": "^15.0.0",
|
|
21
21
|
"typescript": "^6.0.0"
|
|
22
22
|
}
|
|
23
23
|
}
|