create-bytecontent 0.0.0-stage → 0.1.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ByteRings
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ export declare function makeSecret(): string;
2
+ export declare function supportsNodeMajor(major: number): boolean;
3
+ export declare function isValidDomain(value: string): boolean;
4
+ export declare function makeEnvironment(domain: string, version: string): string;
package/dist/config.js ADDED
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeSecret = makeSecret;
4
+ exports.supportsNodeMajor = supportsNodeMajor;
5
+ exports.isValidDomain = isValidDomain;
6
+ exports.makeEnvironment = makeEnvironment;
7
+ const node_crypto_1 = require("node:crypto");
8
+ function makeSecret() {
9
+ return (0, node_crypto_1.randomBytes)(32).toString('base64url');
10
+ }
11
+ function supportsNodeMajor(major) {
12
+ return Number.isInteger(major) && major >= 24;
13
+ }
14
+ function isValidDomain(value) {
15
+ if (value.length > 253 || value.split('.').length < 2)
16
+ return false;
17
+ return value
18
+ .split('.')
19
+ .every((label) => /^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/.test(label));
20
+ }
21
+ function makeEnvironment(domain, version) {
22
+ const values = {
23
+ DOMAIN: domain,
24
+ BYTECONTENT_VERSION: version,
25
+ POSTGRES_PASSWORD: makeSecret(),
26
+ APP_DB_PASSWORD: makeSecret(),
27
+ SETUP_TOKEN: makeSecret(),
28
+ TENANCY_MODE: 'single',
29
+ COOKIE_SECURE: 'true',
30
+ LOG_LEVEL: 'info',
31
+ STORAGE_DRIVER: 'local',
32
+ };
33
+ return `${Object.entries(values)
34
+ .map(([key, value]) => `${key}=${JSON.stringify(value)}`)
35
+ .join('\n')}\n`;
36
+ }
37
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;AAEA,gCAEC;AAED,8CAEC;AAED,sCAKC;AAED,0CAeC;AAhCD,6CAA0C;AAE1C,SAAgB,UAAU;IACxB,OAAO,IAAA,yBAAW,EAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC/C,CAAC;AAED,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;AAChD,CAAC;AAED,SAAgB,aAAa,CAAC,KAAa;IACzC,IAAI,KAAK,CAAC,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACpE,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC;SACV,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iDAAiD,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACrF,CAAC;AAED,SAAgB,eAAe,CAAC,MAAc,EAAE,OAAe;IAC7D,MAAM,MAAM,GAAG;QACb,MAAM,EAAE,MAAM;QACd,mBAAmB,EAAE,OAAO;QAC5B,iBAAiB,EAAE,UAAU,EAAE;QAC/B,eAAe,EAAE,UAAU,EAAE;QAC7B,WAAW,EAAE,UAAU,EAAE;QACzB,YAAY,EAAE,QAAQ;QACtB,aAAa,EAAE,MAAM;QACrB,SAAS,EAAE,MAAM;QACjB,cAAc,EAAE,OAAO;KACxB,CAAC;IACF,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;SAC7B,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;SACxD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACpB,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,266 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ /* eslint-disable no-console */
5
+ const node_fs_1 = require("node:fs");
6
+ const promises_1 = require("node:fs/promises");
7
+ const node_child_process_1 = require("node:child_process");
8
+ const node_path_1 = require("node:path");
9
+ const promises_2 = require("node:readline/promises");
10
+ const contracts_1 = require("@byterings-dev/contracts");
11
+ const config_1 = require("./config");
12
+ const packageInfo = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '..', 'package.json'), 'utf8'));
13
+ const releaseInfo = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '..', 'release-support.json'), 'utf8'));
14
+ function ask(question, defaultValue = '') {
15
+ const rl = (0, promises_2.createInterface)({ input: process.stdin, output: process.stdout });
16
+ return rl
17
+ .question(`${question}${defaultValue ? ` [${defaultValue}]` : ''}: `)
18
+ .then((answer) => answer.trim() || defaultValue)
19
+ .finally(() => rl.close());
20
+ }
21
+ async function askSecret(question) {
22
+ if (!process.stdin.isTTY || !process.stdin.setRawMode) {
23
+ throw new Error(`${question} must be entered in an interactive terminal.`);
24
+ }
25
+ process.stdout.write(`${question}: `);
26
+ process.stdin.setRawMode(true);
27
+ process.stdin.resume();
28
+ process.stdin.setEncoding('utf8');
29
+ return await new Promise((resolveValue, reject) => {
30
+ let value = '';
31
+ const cleanup = () => {
32
+ process.stdin.off('data', onData);
33
+ process.stdin.off('close', onClose);
34
+ process.stdin.setRawMode(false);
35
+ process.stdin.pause();
36
+ process.stdout.write('\n');
37
+ };
38
+ const onClose = () => {
39
+ cleanup();
40
+ reject(new Error('Input closed.'));
41
+ };
42
+ const onData = (chunk) => {
43
+ for (const character of chunk) {
44
+ if (character === '\u0003') {
45
+ cleanup();
46
+ reject(new Error('Cancelled.'));
47
+ return;
48
+ }
49
+ if (character === '\r' || character === '\n') {
50
+ cleanup();
51
+ resolveValue(value);
52
+ return;
53
+ }
54
+ if (character === '\u007f' || character === '\b')
55
+ value = value.slice(0, -1);
56
+ else
57
+ value += character;
58
+ }
59
+ };
60
+ process.stdin.on('data', onData);
61
+ process.stdin.once('close', onClose);
62
+ });
63
+ }
64
+ async function confirm(question) {
65
+ return /^(y|yes)$/i.test(await ask(`${question} [y/N]`));
66
+ }
67
+ async function commandWorks(command, args) {
68
+ return await new Promise((resolveResult) => {
69
+ const child = (0, node_child_process_1.spawn)(command, args, { stdio: 'ignore', shell: process.platform === 'win32' });
70
+ child.once('error', () => resolveResult(false));
71
+ child.once('exit', (code) => resolveResult(code === 0));
72
+ });
73
+ }
74
+ async function runDocker(directory, args) {
75
+ const env = { ...process.env };
76
+ for (const key of [
77
+ 'DATABASE_URL',
78
+ 'POSTGRES_PASSWORD',
79
+ 'APP_DB_PASSWORD',
80
+ 'SETUP_TOKEN',
81
+ 'S3_SECRET_ACCESS_KEY',
82
+ ])
83
+ delete env[key];
84
+ await new Promise((resolveRun, reject) => {
85
+ const child = (0, node_child_process_1.spawn)('docker', ['compose', '--env-file', '.env.production', '-f', 'docker-compose.prod.yml', ...args], { cwd: directory, env, stdio: 'inherit', shell: process.platform === 'win32' });
86
+ child.once('error', () => reject(new Error('Docker CLI could not be started.')));
87
+ child.once('exit', (code) => code === 0
88
+ ? resolveRun()
89
+ : reject(new Error(`Docker Compose exited with status ${code ?? 'unknown'}`)));
90
+ });
91
+ }
92
+ async function copyTree(source, target) {
93
+ await (0, promises_1.mkdir)(target, { recursive: true });
94
+ for (const entry of await (0, promises_1.readdir)(source, { withFileTypes: true })) {
95
+ const from = (0, node_path_1.join)(source, entry.name);
96
+ const to = (0, node_path_1.join)(target, entry.name);
97
+ if (entry.isDirectory())
98
+ await copyTree(from, to);
99
+ else
100
+ await (0, promises_1.writeFile)(to, await (0, promises_1.readFile)(from));
101
+ }
102
+ }
103
+ function slugify(value) {
104
+ return value
105
+ .toLowerCase()
106
+ .normalize('NFKD')
107
+ .replace(/[^a-z0-9]+/g, '-')
108
+ .replace(/^-+|-+$/g, '')
109
+ .slice(0, 63);
110
+ }
111
+ async function setupOwner(baseUrl) {
112
+ const status = await fetch(new URL('/api/v1/setup/status', baseUrl), {
113
+ signal: AbortSignal.timeout(5000),
114
+ });
115
+ if (!status.ok)
116
+ throw new Error(`Could not check setup status (HTTP ${status.status}).`);
117
+ const statusBody = (await status.json());
118
+ if (statusBody.data?.initialized) {
119
+ console.log(`This instance is already initialized. Sign in at ${baseUrl}/login.`);
120
+ return;
121
+ }
122
+ const tenantName = await ask('Organization name');
123
+ const tenantSlug = await ask('Organization slug', slugify(tenantName));
124
+ const name = await ask('Administrator name');
125
+ const email = await ask('Administrator email');
126
+ const password = await askSecret('Administrator password (input hidden)');
127
+ const input = contracts_1.setupRequestSchema.safeParse({ tenantName, tenantSlug, name, email, password });
128
+ if (!input.success) {
129
+ throw new Error(input.error.issues.map((issue) => `${issue.path.join('.')}: ${issue.message}`).join('\n'));
130
+ }
131
+ const token = process.env.SETUP_TOKEN;
132
+ if (!token)
133
+ throw new Error('SETUP_TOKEN is missing from .env.production.');
134
+ const response = await fetch(new URL('/api/v1/setup', baseUrl), {
135
+ method: 'POST',
136
+ headers: { 'content-type': 'application/json', 'x-setup-token': token },
137
+ body: JSON.stringify(input.data),
138
+ signal: AbortSignal.timeout(15000),
139
+ });
140
+ if (!response.ok) {
141
+ const body = (await response.json().catch(() => ({})));
142
+ throw new Error(body.message ?? `First-run setup failed (HTTP ${response.status}).`);
143
+ }
144
+ }
145
+ async function waitReady(baseUrl) {
146
+ for (let attempt = 0; attempt < 60; attempt += 1) {
147
+ try {
148
+ const response = await fetch(new URL('/api/v1/health/ready', baseUrl), {
149
+ signal: AbortSignal.timeout(3000),
150
+ });
151
+ if (response.ok)
152
+ return;
153
+ }
154
+ catch {
155
+ // DNS, certificate issuance, and the first migration can take a moment.
156
+ }
157
+ await new Promise((resolveDelay) => setTimeout(resolveDelay, 2000));
158
+ }
159
+ throw new Error(`${baseUrl} did not become ready. Check DNS and ports 80/443, then rerun setup after the endpoint is reachable.`);
160
+ }
161
+ function parseArgs(args) {
162
+ let directory = '';
163
+ let help = false;
164
+ let version = false;
165
+ for (let i = 0; i < args.length; i += 1) {
166
+ const arg = args[i];
167
+ if (arg === undefined)
168
+ continue;
169
+ if (arg === '--help' || arg === '-h')
170
+ help = true;
171
+ else if (arg === '--version' || arg === '-v')
172
+ version = true;
173
+ else if (arg === '--directory' || arg === '-d') {
174
+ const value = args[++i];
175
+ if (!value || value.startsWith('-'))
176
+ throw new Error(`${arg} requires a directory path.`);
177
+ directory = value;
178
+ }
179
+ else if (arg.startsWith('-'))
180
+ throw new Error(`Unknown option: ${arg}`);
181
+ else if (!directory)
182
+ directory = arg;
183
+ else
184
+ throw new Error('Only one destination directory can be provided.');
185
+ }
186
+ return { directory, help, version };
187
+ }
188
+ async function main() {
189
+ const options = parseArgs(process.argv.slice(2));
190
+ if (options.help) {
191
+ console.log('Usage: npx create-bytecontent [directory]\n\nCreates a versioned Docker Compose installation.');
192
+ return;
193
+ }
194
+ if (options.version) {
195
+ console.log(packageInfo.version);
196
+ return;
197
+ }
198
+ const nodeMajor = Number(process.versions.node.split('.')[0]);
199
+ if (!(0, config_1.supportsNodeMajor)(nodeMajor))
200
+ throw new Error(`Node.js 24 or later is required; current version is ${process.version}.`);
201
+ if (!(await commandWorks('docker', ['compose', 'version'])))
202
+ throw new Error('Docker Engine with Compose v2 is required.');
203
+ if (!(await commandWorks('docker', ['info', '--format', '{{.ServerVersion}}'])))
204
+ throw new Error('Docker daemon is unavailable or the current user lacks access.');
205
+ const name = options.directory || (await ask('Installation directory', 'bytecontent'));
206
+ const directory = (0, node_path_1.resolve)(process.cwd(), name);
207
+ const existing = await (0, promises_1.access)(directory).then(() => true, () => false);
208
+ if (existing) {
209
+ const contents = await (0, promises_1.readdir)(directory);
210
+ if (contents.length > 0) {
211
+ const marker = await (0, promises_1.access)((0, node_path_1.join)(directory, '.bytecontent-install.json')).then(() => true, () => false);
212
+ const envFile = await (0, promises_1.access)((0, node_path_1.join)(directory, '.env.production')).then(() => true, () => false);
213
+ if (!marker || !envFile)
214
+ throw new Error(`${directory} is not empty; no files were changed.`);
215
+ process.loadEnvFile((0, node_path_1.join)(directory, '.env.production'));
216
+ const domain = process.env.DOMAIN;
217
+ if (!domain || !(0, config_1.isValidDomain)(domain))
218
+ throw new Error('Existing .env.production has an invalid DOMAIN.');
219
+ const baseUrl = `https://${domain}`;
220
+ if (!(await confirm(`Resume this ByteContent installation at ${directory}?`)))
221
+ return;
222
+ await runDocker(directory, ['pull']);
223
+ await runDocker(directory, ['up', '-d']);
224
+ await waitReady(baseUrl);
225
+ await setupOwner(baseUrl);
226
+ return;
227
+ }
228
+ }
229
+ const domain = (await ask('Public domain with DNS pointing to this server')).toLowerCase();
230
+ if (!(0, config_1.isValidDomain)(domain))
231
+ throw new Error('Enter a valid domain name without a scheme or path.');
232
+ await (0, promises_1.mkdir)(directory, { recursive: true });
233
+ await copyTree((0, node_path_1.join)(__dirname, '..', 'templates'), directory);
234
+ const readmePath = (0, node_path_1.join)(directory, 'README.md');
235
+ const readme = await (0, promises_1.readFile)(readmePath, 'utf8');
236
+ await (0, promises_1.writeFile)(readmePath, readme.replaceAll('{{VERSION}}', releaseInfo.platformVersion), 'utf8');
237
+ await (0, promises_1.writeFile)((0, node_path_1.join)(directory, '.env.production'), (0, config_1.makeEnvironment)(domain, releaseInfo.platformVersion), {
238
+ encoding: 'utf8',
239
+ flag: 'wx',
240
+ mode: 0o600,
241
+ });
242
+ await (0, promises_1.chmod)((0, node_path_1.join)(directory, '.env.production'), 0o600);
243
+ await (0, promises_1.writeFile)((0, node_path_1.join)(directory, '.gitignore'), '.env.production\nbackups/\nstorage/\n', {
244
+ encoding: 'utf8',
245
+ flag: 'wx',
246
+ });
247
+ await (0, promises_1.writeFile)((0, node_path_1.join)(directory, '.bytecontent-install.json'), `${JSON.stringify({ deployment: 'docker-compose', version: releaseInfo.platformVersion }, null, 2)}\n`, { encoding: 'utf8', flag: 'wx' });
248
+ console.log(`Created ${directory}. Secret values were generated and not displayed.`);
249
+ if (!(await confirm('Pull the release images, start services, and apply migrations to this new database?'))) {
250
+ console.log('No services were started. Review .env.production, then run docker compose pull and up.');
251
+ return;
252
+ }
253
+ await runDocker(directory, ['pull']);
254
+ await runDocker(directory, ['up', '-d']);
255
+ process.loadEnvFile((0, node_path_1.join)(directory, '.env.production'));
256
+ const baseUrl = `https://${domain}`;
257
+ console.log('Waiting for HTTPS and database readiness.');
258
+ await waitReady(baseUrl);
259
+ await setupOwner(baseUrl);
260
+ console.log(`ByteContent is ready at ${baseUrl}. Sign in at ${baseUrl}/login.`);
261
+ }
262
+ main().catch((error) => {
263
+ console.error(error instanceof Error ? error.message : error);
264
+ process.exitCode = 1;
265
+ });
266
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CAAC;IACzC,OAAO,CAAC,WAAW,CAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,WAAW,MAAM,EAAE,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;IACzD,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,2BAA2B,OAAO,gBAAgB,OAAO,SAAS,CAAC,CAAC;AAClF,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC9D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,41 @@
1
1
  {
2
2
  "name": "create-bytecontent",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.2",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/byterings/byteringscms.git",
7
+ "directory": "packages/create-bytecontent"
8
+ },
9
+ "license": "MIT",
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "description": "Create a self-hosted ByteContent Docker Compose installation",
14
+ "engines": {
15
+ "node": ">=24"
16
+ },
17
+ "main": "dist/index.js",
18
+ "types": "dist/index.d.ts",
19
+ "bin": {
20
+ "create-bytecontent": "dist/index.js"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "templates",
25
+ "release-support.json"
26
+ ],
27
+ "dependencies": {
28
+ "@byterings-dev/contracts": "0.1.2"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "^24",
32
+ "vitest": "^3"
33
+ },
34
+ "scripts": {
35
+ "build": "tsc -p tsconfig.build.json",
36
+ "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
37
+ "lint": "eslint src",
38
+ "typecheck": "tsc -p tsconfig.json --noEmit",
39
+ "test": "vitest run"
40
+ }
6
41
  }
@@ -0,0 +1,103 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "platformVersion": "0.1.2",
4
+ "cliVersion": "0.1.2",
5
+ "sdkVersion": "0.1.2",
6
+ "contractsVersion": "0.1.2",
7
+ "support": {
8
+ "node": {
9
+ "minimumMajorVersion": 24,
10
+ "supportedMajorVersions": [
11
+ 24
12
+ ],
13
+ "testedMajorVersions": [
14
+ 24,
15
+ 25
16
+ ]
17
+ },
18
+ "postgres": {
19
+ "supportedMajorVersions": [
20
+ 17
21
+ ],
22
+ "testedMajorVersions": [
23
+ 17
24
+ ]
25
+ },
26
+ "deployments": [
27
+ "native",
28
+ "docker-compose"
29
+ ],
30
+ "api": "v1"
31
+ },
32
+ "compatibilityEvidence": {
33
+ "results": [
34
+ {
35
+ "nodeMajor": 24,
36
+ "postgresMajor": 17,
37
+ "deployment": "docker-compose",
38
+ "result": "passed",
39
+ "runUrl": "https://github.com/byterings/byteringscms/actions/runs/47052946441",
40
+ "commit": "57b98cc7745a3e743e34fcbb8fbde8c33c5d5660",
41
+ "testedAt": "2026-12-03T06:51:31.454Z"
42
+ },
43
+ {
44
+ "nodeMajor": 24,
45
+ "postgresMajor": 17,
46
+ "deployment": "native",
47
+ "result": "passed",
48
+ "runUrl": "https://github.com/byterings/byteringscms/actions/runs/47052946441",
49
+ "commit": "57b98cc7745a3e743e34fcbb8fbde8c33c5d5660",
50
+ "testedAt": "2026-12-03T06:51:56.057Z"
51
+ },
52
+ {
53
+ "nodeMajor": 25,
54
+ "postgresMajor": 17,
55
+ "deployment": "native",
56
+ "result": "passed",
57
+ "runUrl": "https://github.com/byterings/byteringscms/actions/runs/47052946441",
58
+ "commit": "57b98cc7745a3e743e34fcbb8fbde8c33c5d5660",
59
+ "testedAt": "2026-12-03T06:51:59.129Z"
60
+ }
61
+ ]
62
+ },
63
+ "pluginCompatibilityEvidence": {
64
+ "results": [
65
+ {
66
+ "pluginId": "cms-publishing",
67
+ "pluginVersion": "1.0.0",
68
+ "platformVersion": "0.1.2",
69
+ "nodeMajor": 24,
70
+ "postgresMajor": 17,
71
+ "deployment": "docker-compose",
72
+ "result": "passed",
73
+ "runUrl": "https://github.com/byterings/byteringscms/actions/runs/47052946441",
74
+ "commit": "57b98cc7745a3e743e34fcbb8fbde8c33c5d5660",
75
+ "testedAt": "2026-12-03T06:51:31.498Z"
76
+ },
77
+ {
78
+ "pluginId": "cms-publishing",
79
+ "pluginVersion": "1.0.0",
80
+ "platformVersion": "0.1.2",
81
+ "nodeMajor": 24,
82
+ "postgresMajor": 17,
83
+ "deployment": "native",
84
+ "result": "passed",
85
+ "runUrl": "https://github.com/byterings/byteringscms/actions/runs/47052946441",
86
+ "commit": "57b98cc7745a3e743e34fcbb8fbde8c33c5d5660",
87
+ "testedAt": "2026-12-03T06:51:56.103Z"
88
+ },
89
+ {
90
+ "pluginId": "cms-publishing",
91
+ "pluginVersion": "1.0.0",
92
+ "platformVersion": "0.1.2",
93
+ "nodeMajor": 25,
94
+ "postgresMajor": 17,
95
+ "deployment": "native",
96
+ "result": "passed",
97
+ "runUrl": "https://github.com/byterings/byteringscms/actions/runs/47052946441",
98
+ "commit": "57b98cc7745a3e743e34fcbb8fbde8c33c5d5660",
99
+ "testedAt": "2026-12-03T06:51:59.170Z"
100
+ }
101
+ ]
102
+ }
103
+ }
@@ -0,0 +1,37 @@
1
+ # Production settings for docker-compose.prod.yml.
2
+ # Copy to .env.production, replace EVERY value, keep the file out of Git.
3
+ # Generate secrets with: openssl rand -base64 32
4
+
5
+ # Public host name; Caddy obtains a TLS certificate for it automatically.
6
+ DOMAIN=cms.example.com
7
+
8
+ # ByteContent container release to run. Docker updates change this value.
9
+ BYTECONTENT_VERSION=0.1.2
10
+
11
+ # Database superuser (used only for initialization, backups and restores).
12
+ POSTGRES_PASSWORD=change-me-superuser-password
13
+ # Application role (row-level security applies to it).
14
+ APP_DB_PASSWORD=change-me-app-password
15
+
16
+ # Required header value for the one-time first-run setup (x-setup-token).
17
+ SETUP_TOKEN=change-me-at-least-16-characters
18
+
19
+ # single: one organization; multi: many isolated tenants (platform admins provision them)
20
+ TENANCY_MODE=single
21
+
22
+ # Keep true behind HTTPS. Set to false only for local evaluation over plain http.
23
+ COOKIE_SECURE=true
24
+
25
+ LOG_LEVEL=info
26
+
27
+ # Media storage: local (Docker volume) or s3 (S3, R2, MinIO, ...)
28
+ STORAGE_DRIVER=local
29
+ # S3_BUCKET=
30
+ # S3_REGION=auto
31
+ # S3_ENDPOINT=https://<account>.r2.cloudflarestorage.com
32
+ # S3_ACCESS_KEY_ID=
33
+ # S3_SECRET_ACCESS_KEY=
34
+
35
+ # Optional tenant quotas (0 = unlimited)
36
+ TENANT_MAX_RECORDS=0
37
+ TENANT_MAX_MEDIA_BYTES=0
@@ -0,0 +1,37 @@
1
+ # ByteContent installation
2
+
3
+ This directory contains the Docker Compose deployment for ByteContent
4
+ {{VERSION}}. `.env.production` contains generated credentials; keep it private
5
+ and out of source control.
6
+
7
+ ## Services
8
+
9
+ ```bash
10
+ docker compose --env-file .env.production -f docker-compose.prod.yml ps
11
+ docker compose --env-file .env.production -f docker-compose.prod.yml logs -f
12
+ ```
13
+
14
+ The Compose stack starts Caddy, the Admin Studio, the API, and PostgreSQL.
15
+ Database migrations run when the API starts. Data is stored in named Docker
16
+ volumes.
17
+
18
+ ## Update container images
19
+
20
+ Edit `BYTECONTENT_VERSION` in `.env.production`, then pull and restart:
21
+
22
+ ```bash
23
+ docker compose --env-file .env.production -f docker-compose.prod.yml pull
24
+ docker compose --env-file .env.production -f docker-compose.prod.yml up -d
25
+ ```
26
+
27
+ Before changing versions on a live installation, create and verify a database
28
+ and media backup. Read the ByteContent release notes and compatibility report
29
+ for the target version first. Keep the previous version available for
30
+ recovery.
31
+
32
+ ## Configuration and recovery
33
+
34
+ The deployment settings are in `.env.production`; do not overwrite it with the
35
+ example file after setup. Review `docs/operations/backup-restore.md` in the
36
+ ByteContent source repository for the backup and restore procedure. Protect
37
+ the database and media volumes together.
@@ -0,0 +1,95 @@
1
+ # Self-hosted production deployment.
2
+ #
3
+ # cp .env.production.example .env.production # then edit every value
4
+ # docker compose --env-file .env.production -f docker-compose.prod.yml pull
5
+ # docker compose --env-file .env.production -f docker-compose.prod.yml up -d
6
+ #
7
+ # Caddy terminates HTTPS (automatic certificates for $DOMAIN) and is the only
8
+ # service exposed to the network. The API and database stay internal.
9
+ name: bytecontent
10
+
11
+ services:
12
+ postgres:
13
+ image: postgres:17-alpine
14
+ restart: unless-stopped
15
+ environment:
16
+ POSTGRES_USER: postgres
17
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}
18
+ POSTGRES_DB: postgres
19
+ APP_DB_USER: byterings
20
+ APP_DB_PASSWORD: ${APP_DB_PASSWORD:?set APP_DB_PASSWORD}
21
+ volumes:
22
+ - postgres-data:/var/lib/postgresql/data
23
+ - ./infrastructure/docker/postgres/init-prod:/docker-entrypoint-initdb.d:ro
24
+ healthcheck:
25
+ test: ['CMD-SHELL', 'pg_isready -U postgres']
26
+ interval: 5s
27
+ timeout: 3s
28
+ retries: 30
29
+
30
+ api:
31
+ image: ghcr.io/byterings/bytecontent-api:${BYTECONTENT_VERSION:-0.1.2}
32
+ restart: unless-stopped
33
+ depends_on:
34
+ postgres: { condition: service_healthy }
35
+ environment:
36
+ DATABASE_URL: postgresql://byterings:${APP_DB_PASSWORD}@postgres:5432/byterings
37
+ RUN_MIGRATIONS: 'true'
38
+ TENANCY_MODE: ${TENANCY_MODE:-single}
39
+ # Requests arrive through Caddy and the Admin Studio proxy.
40
+ TRUST_PROXY: 'true'
41
+ COOKIE_SECURE: ${COOKIE_SECURE:-true}
42
+ SETUP_TOKEN: ${SETUP_TOKEN:?set SETUP_TOKEN}
43
+ LOG_LEVEL: ${LOG_LEVEL:-info}
44
+ STORAGE_DRIVER: ${STORAGE_DRIVER:-local}
45
+ S3_BUCKET: ${S3_BUCKET:-}
46
+ S3_REGION: ${S3_REGION:-auto}
47
+ S3_ENDPOINT: ${S3_ENDPOINT:-}
48
+ S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID:-}
49
+ S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:-}
50
+ TENANT_MAX_RECORDS: ${TENANT_MAX_RECORDS:-0}
51
+ TENANT_MAX_MEDIA_BYTES: ${TENANT_MAX_MEDIA_BYTES:-0}
52
+ volumes:
53
+ - media:/data/storage
54
+ - ./plugins:/app/plugins:ro
55
+ - ./.bytecontent:/app/.bytecontent:ro
56
+
57
+ admin:
58
+ image: ghcr.io/byterings/bytecontent-admin:${BYTECONTENT_VERSION:-0.1.2}
59
+ restart: unless-stopped
60
+ depends_on: [api]
61
+ environment:
62
+ API_URL: http://api:4000
63
+
64
+ caddy:
65
+ image: caddy:2-alpine
66
+ restart: unless-stopped
67
+ depends_on: [admin]
68
+ ports:
69
+ - '80:80'
70
+ - '443:443'
71
+ environment:
72
+ DOMAIN: ${DOMAIN:?set DOMAIN}
73
+ volumes:
74
+ - ./infrastructure/docker/Caddyfile:/etc/caddy/Caddyfile:ro
75
+ - caddy-data:/data
76
+ - caddy-config:/config
77
+
78
+ # Daily housekeeping: docker compose --env-file .env.production -f docker-compose.prod.yml run --rm maintenance
79
+ maintenance:
80
+ image: ghcr.io/byterings/bytecontent-api:${BYTECONTENT_VERSION:-0.1.2}
81
+ profiles: ['jobs']
82
+ depends_on:
83
+ postgres: { condition: service_healthy }
84
+ environment:
85
+ DATABASE_URL: postgresql://byterings:${APP_DB_PASSWORD}@postgres:5432/byterings
86
+ STORAGE_DRIVER: ${STORAGE_DRIVER:-local}
87
+ volumes:
88
+ - media:/data/storage
89
+ command: ['node', 'dist/cli/maintenance.js']
90
+
91
+ volumes:
92
+ postgres-data:
93
+ media:
94
+ caddy-data:
95
+ caddy-config:
@@ -0,0 +1,10 @@
1
+ {$DOMAIN} {
2
+ encode zstd gzip
3
+ header {
4
+ Strict-Transport-Security "max-age=31536000; includeSubDomains"
5
+ -Server
6
+ }
7
+ # Everything - Admin Studio and /api/* - goes through the Admin Studio,
8
+ # whose same-origin proxy forwards API calls to the internal API service.
9
+ reverse_proxy admin:3000
10
+ }
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ # Production database bootstrap: creates the application role (no superuser,
3
+ # no BYPASSRLS, so row-level security applies) and its database. Runs once,
4
+ # when the data volume is first initialized.
5
+ set -eu
6
+
7
+ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<SQL
8
+ CREATE ROLE ${APP_DB_USER} LOGIN NOSUPERUSER NOBYPASSRLS NOCREATEDB PASSWORD '${APP_DB_PASSWORD}';
9
+ CREATE DATABASE byterings OWNER ${APP_DB_USER} ENCODING 'UTF8';
10
+ SQL
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Sample trusted plugin for the CMS template.
5
+ *
6
+ * Plugins receive record data only and return field changes; the platform
7
+ * validates those changes against the entity metadata like any user input.
8
+ *
9
+ * @param {import('@byterings-dev/contracts').PluginApi} api
10
+ */
11
+ function register(api) {
12
+ /** @type {import('@byterings-dev/contracts').BeforeHookHandler} */
13
+ const publishing = ({ fields, data, previous }) => {
14
+ const changes = {};
15
+ const becamePublished =
16
+ data.status === 'published' && (!previous || previous.status !== 'published');
17
+ if (becamePublished && !data.publishedAt && fields.includes('publishedAt')) {
18
+ changes.publishedAt = new Date().toISOString();
19
+ }
20
+ if (!data.seoTitle && typeof data.title === 'string' && fields.includes('seoTitle')) {
21
+ changes.seoTitle = data.title.slice(0, 70);
22
+ }
23
+ return changes;
24
+ };
25
+
26
+ api.on('record.beforeCreate', publishing);
27
+ api.on('record.beforeUpdate', publishing);
28
+ api.on('record.afterCreate', ({ entity, recordId, data }) => {
29
+ if (data.status === 'published') api.log(`${entity} ${recordId} published`);
30
+ });
31
+ }
32
+
33
+ module.exports = { register };
@@ -0,0 +1,9 @@
1
+ {
2
+ "id": "cms-publishing",
3
+ "name": "CMS publishing helpers",
4
+ "version": "1.0.0",
5
+ "description": "Sets publishedAt when an article or page is first published, and fills an empty SEO title from the title.",
6
+ "capabilities": ["records:modify", "records:observe"],
7
+ "entities": ["article", "page"],
8
+ "main": "index.js"
9
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.