@ductape/cli 0.5.2 → 0.5.5

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.
@@ -0,0 +1,16 @@
1
+ import type { Command } from 'commander';
2
+ export interface WebhookOptions {
3
+ app: string;
4
+ webhook?: string;
5
+ event?: string;
6
+ definitionFile?: string;
7
+ profile?: string;
8
+ json?: boolean;
9
+ }
10
+ export declare function webhookRequest(verb: string, events: boolean, opts: WebhookOptions, body?: Record<string, unknown>): {
11
+ module: "webhooks";
12
+ method: string;
13
+ params: unknown[];
14
+ };
15
+ export declare function runAppWebhooks(verb: string, events: boolean, opts: WebhookOptions): Promise<void>;
16
+ export declare function registerAppWebhooks(apps: Command, wrap: (fn: (...args: any[]) => Promise<void>) => (...args: any[]) => void): void;
@@ -0,0 +1,60 @@
1
+ import { resolveBody } from '../lib/read-body.js';
2
+ import { printJson } from '../lib/output.js';
3
+ import { requireWorkspaceContext } from '../lib/workspace-context.js';
4
+ import { createSdkProxyClient } from '../lib/proxy/sdk-proxy.js';
5
+ export function webhookRequest(verb, events, opts, body) {
6
+ if (!['list', 'get', 'create', 'update', 'delete'].includes(verb))
7
+ throw new Error('Invalid webhook operation');
8
+ if (!opts.app)
9
+ throw new Error('Provide --app <app_tag>');
10
+ if ((events || !['list', 'create'].includes(verb)) && !opts.webhook)
11
+ throw new Error('Provide --webhook <webhook_tag>');
12
+ if (['create', 'update'].includes(verb) && (!body || !Object.keys(body).length))
13
+ throw new Error('Provide a non-empty --definition-file JSON object');
14
+ if (events && !['list', 'create'].includes(verb) && !opts.event)
15
+ throw new Error('Provide --event <event_tag>');
16
+ if (verb === 'create' && (typeof body?.tag !== 'string' || !body.tag.trim()))
17
+ throw new Error('Creation requires a tag in the JSON body');
18
+ const method = `${events ? 'events.' : ''}${verb === 'get' ? 'fetch' : verb}`;
19
+ const tag = events ? `${opts.webhook}:${opts.event}` : opts.webhook;
20
+ let params;
21
+ if (verb === 'list')
22
+ params = events ? [opts.app, opts.webhook] : [opts.app];
23
+ else if (verb === 'create') {
24
+ if (events && String(body.tag).includes(':'))
25
+ throw new Error('Event JSON tag must be local; pass its parent using --webhook');
26
+ params = [opts.app, events ? { ...body, tag: `${opts.webhook}:${body.tag}` } : body];
27
+ }
28
+ else
29
+ params = verb === 'update' ? [opts.app, tag, body] : [opts.app, tag];
30
+ return { module: 'webhooks', method, params };
31
+ }
32
+ export async function runAppWebhooks(verb, events, opts) {
33
+ const body = ['create', 'update'].includes(verb)
34
+ ? await resolveBody({ file: opts.definitionFile, interactive: false, requireBody: true, patch: verb === 'update' }) : undefined;
35
+ const request = webhookRequest(verb, events, opts, body);
36
+ const ctx = requireWorkspaceContext({ profile: opts.profile });
37
+ const proxy = createSdkProxyClient({ apiUrl: ctx.apiUrl, workspaceId: ctx.workspaceId,
38
+ userId: ctx.credentials.user_id, publicKey: ctx.credentials.public_key, token: ctx.credentials.auth_token });
39
+ const result = await proxy.execute(request.module, request.method, request.params);
40
+ printJson(result ?? (['create', 'update', 'delete'].includes(verb)
41
+ ? { acknowledged: true, operation: `webhooks.${request.method}`, app: opts.app }
42
+ : null), Boolean(opts.json));
43
+ }
44
+ export function registerAppWebhooks(apps, wrap) {
45
+ const webhooks = apps.command('webhooks').description('Manage app webhook definitions (does not register with providers or publish apps)');
46
+ const events = webhooks.command('events').description('Manage webhook event selectors and payload samples');
47
+ for (const [parent, isEvent] of [[webhooks, false], [events, true]]) {
48
+ for (const verb of ['list', 'get', 'create', 'update', 'delete']) {
49
+ const command = parent.command(verb).requiredOption('--app <tag>', 'App tag');
50
+ if (isEvent || !['list', 'create'].includes(verb))
51
+ command.requiredOption('--webhook <tag>', 'Webhook tag');
52
+ if (isEvent && !['list', 'create'].includes(verb))
53
+ command.requiredOption('--event <tag>', 'Local event tag');
54
+ if (['create', 'update'].includes(verb))
55
+ command.requiredOption('--definition-file <path>', 'JSON definition file');
56
+ command.option('--profile <name>').option('--json', 'JSON output')
57
+ .action(wrap((opts) => runAppWebhooks(verb, isEvent, opts)));
58
+ }
59
+ }
60
+ }
@@ -1,4 +1,14 @@
1
1
  import { type CommandInteractiveFlags } from '../lib/interactive-opts.js';
2
+ export declare function runAppVersions(opts: {
3
+ id: string;
4
+ profile?: string;
5
+ }): Promise<void>;
6
+ export declare function runAppVersionRename(opts: {
7
+ id: string;
8
+ from: string;
9
+ to: string;
10
+ profile?: string;
11
+ }): Promise<void>;
2
12
  export declare function runApps(verb: string, opts: {
3
13
  profile?: string;
4
14
  status?: string;
@@ -2,10 +2,21 @@ import { schemaKeyForEntity } from '../lib/forms/index.js';
2
2
  import { isInteractive, promptTag } from '../lib/forms/prompt.js';
3
3
  import { toInteractiveOpts } from '../lib/interactive-opts.js';
4
4
  import { bodyRequiredHint, resolveBody } from '../lib/read-body.js';
5
- import { createApp, deleteApp, getApp, listApps, updateApp, updateAppViaProxy, } from '../lib/platform-api.js';
5
+ import { createApp, deleteApp, getApp, getAppVersions, listApps, updateApp, updateAppViaProxy, } from '../lib/platform-api.js';
6
6
  import { printJson } from '../lib/output.js';
7
7
  import { requireWorkspaceContext } from '../lib/workspace-context.js';
8
8
  const VERBS = ['list', 'get', 'create', 'update', 'delete'];
9
+ export async function runAppVersions(opts) {
10
+ printJson(await getAppVersions(requireWorkspaceContext({ profile: opts.profile }), opts.id), true);
11
+ }
12
+ export async function runAppVersionRename(opts) {
13
+ if (!opts.from || !opts.to || opts.from === opts.to ||
14
+ opts.from.trim() !== opts.from || opts.to.trim() !== opts.to) {
15
+ throw new Error('Distinct explicit source and destination version labels are required');
16
+ }
17
+ const ctx = requireWorkspaceContext({ profile: opts.profile });
18
+ printJson(await updateApp(ctx, opts.id, { fromVersion: opts.from, version: opts.to }), true);
19
+ }
9
20
  export async function runApps(verb, opts, extraArgs) {
10
21
  const v = verb.toLowerCase();
11
22
  if (!VERBS.includes(v)) {
@@ -1 +1,28 @@
1
- export declare function runInstall(): Promise<void>;
1
+ export interface IPlatformFilesOptions {
2
+ /** Where the files go: ~/.ductape/platform unless told otherwise. */
3
+ platformDir: string;
4
+ /** Where the templates are. */
5
+ templatesDir?: string;
6
+ /** Pin the images to this release instead of `latest`. */
7
+ tag?: string;
8
+ /** Makes the install's own encryption key. Replaceable so a test is repeatable. */
9
+ newKey?: () => string;
10
+ }
11
+ export interface IPlatformFilesResult {
12
+ /** A new .env was written. */
13
+ createdEnv: boolean;
14
+ /** The .env had no ENC_KEY and one was added. */
15
+ addedKey: boolean;
16
+ /** The compose file of an earlier install (the retired single-image one) was kept here. */
17
+ previous?: string;
18
+ }
19
+ /**
20
+ * Writes the compose files, the gateway configuration and the settings file. The compose files are always replaced, because they
21
+ * describe the release. The settings file is never replaced: it is the customer's. It is made once, with an ENC_KEY of its own
22
+ * (the key that encrypts everything this install stores), and an existing one without a key is given one.
23
+ */
24
+ export declare function writePlatformFiles(options: IPlatformFilesOptions): IPlatformFilesResult;
25
+ export declare function runInstall(opts?: {
26
+ tag?: string;
27
+ pull?: boolean;
28
+ }): Promise<void>;
@@ -1,4 +1,5 @@
1
- import { spawnSync, spawn } from 'node:child_process';
1
+ import { spawn, spawnSync } from 'node:child_process';
2
+ import crypto from 'node:crypto';
2
3
  import fs from 'node:fs';
3
4
  import path from 'node:path';
4
5
  import { fileURLToPath } from 'node:url';
@@ -6,32 +7,70 @@ import { HUB_PLATFORM_DIR } from '../lib/config.js';
6
7
  import { success } from '../lib/output.js';
7
8
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
9
  const TEMPLATES_DIR = path.resolve(__dirname, '../../templates');
9
- const HUB_IMAGES = [
10
- 'ductape/platform-api:latest',
11
- 'ductape/platform-workbench:latest',
10
+ /**
11
+ * The files `ductape install` writes, and where they come from. They are generated from the platform's own compose file by
12
+ * platform/scripts/render-release.mjs, so what a customer runs is what this repository runs.
13
+ */
14
+ const PLATFORM_FILES = [
15
+ ['docker-compose.release.yml', 'docker-compose.yml'],
16
+ ['docker-compose.backend.yml', 'docker-compose.backend.yml'],
17
+ ['docker-compose.workbench.yml', 'docker-compose.workbench.yml'],
18
+ ['api-gateway.conf', 'api-gateway.conf'],
12
19
  ];
13
20
  function checkCommand(cmd, args) {
14
21
  const r = spawnSync(cmd, args, { stdio: 'ignore' });
15
22
  return r.status === 0;
16
23
  }
17
- function pull(image) {
24
+ /** Runs `docker compose pull` in the platform folder, so every image the compose file names is fetched, whoever published it. */
25
+ function pullImages(platformDir, tag) {
18
26
  return new Promise((resolve, reject) => {
19
- console.log(`Pulling ${image} …`);
20
- const child = spawn('docker', ['pull', image], {
27
+ const child = spawn('docker', ['compose', 'pull'], {
28
+ cwd: platformDir,
21
29
  stdio: 'inherit',
22
30
  shell: process.platform === 'win32',
31
+ env: { ...process.env, ...(tag ? { DUCTAPE_TAG: tag } : {}) },
23
32
  });
24
33
  child.on('error', reject);
25
34
  child.on('close', (code) => resolve(code ?? 1));
26
35
  });
27
36
  }
28
- function copyTemplate(name, dest, overwrite = false) {
29
- const src = path.join(TEMPLATES_DIR, name);
30
- if (!overwrite && fs.existsSync(dest))
31
- return;
32
- fs.copyFileSync(src, dest);
37
+ const newEncKey = () => crypto.randomBytes(48).toString('base64url');
38
+ /** Sets `NAME=value` in env text: replaces an uncommented line, or adds one. Never echoes the value. */
39
+ function setEnvValue(text, name, value) {
40
+ const line = new RegExp(`^${name}=.*$`, 'm');
41
+ return line.test(text) ? text.replace(line, `${name}=${value}`) : `${text.replace(/\n*$/, '\n')}${name}=${value}\n`;
33
42
  }
34
- export async function runInstall() {
43
+ /**
44
+ * Writes the compose files, the gateway configuration and the settings file. The compose files are always replaced, because they
45
+ * describe the release. The settings file is never replaced: it is the customer's. It is made once, with an ENC_KEY of its own
46
+ * (the key that encrypts everything this install stores), and an existing one without a key is given one.
47
+ */
48
+ export function writePlatformFiles(options) {
49
+ const { platformDir, tag } = options;
50
+ const templatesDir = options.templatesDir ?? TEMPLATES_DIR;
51
+ const makeKey = options.newKey ?? newEncKey;
52
+ fs.mkdirSync(platformDir, { recursive: true });
53
+ const composeTarget = path.join(platformDir, 'docker-compose.yml');
54
+ let previous;
55
+ if (fs.existsSync(composeTarget) && /platform-api\b/.test(fs.readFileSync(composeTarget, 'utf8'))) {
56
+ previous = path.join(platformDir, 'docker-compose.previous.yml');
57
+ fs.copyFileSync(composeTarget, previous);
58
+ }
59
+ for (const [template, target] of PLATFORM_FILES)
60
+ fs.copyFileSync(path.join(templatesDir, template), path.join(platformDir, target));
61
+ const envTarget = path.join(platformDir, '.env');
62
+ const created = !fs.existsSync(envTarget);
63
+ let env = created ? fs.readFileSync(path.join(templatesDir, 'platform.env'), 'utf8') : fs.readFileSync(envTarget, 'utf8');
64
+ const hasKey = /^ENC_KEY=\S+/m.test(env);
65
+ if (!hasKey)
66
+ env = setEnvValue(env, 'ENC_KEY', makeKey());
67
+ if (tag)
68
+ env = setEnvValue(env, 'DUCTAPE_TAG', tag);
69
+ fs.writeFileSync(envTarget, env, { mode: 0o600 });
70
+ fs.chmodSync(envTarget, 0o600);
71
+ return { createdEnv: created, addedKey: !hasKey, ...(previous ? { previous } : {}) };
72
+ }
73
+ export async function runInstall(opts = {}) {
35
74
  const issues = [];
36
75
  if (!checkCommand('docker', ['--version'])) {
37
76
  issues.push('Docker is not installed or not on PATH');
@@ -43,22 +82,31 @@ export async function runInstall() {
43
82
  console.error('Install check failed:\n' + issues.map((i) => ` - ${i}`).join('\n'));
44
83
  process.exit(1);
45
84
  }
46
- // Pull platform images from Docker Hub
47
- for (const image of HUB_IMAGES) {
48
- const code = await pull(image);
85
+ const platformDir = process.env.DUCTAPE_PLATFORM_DIR ? path.resolve(process.env.DUCTAPE_PLATFORM_DIR) : HUB_PLATFORM_DIR;
86
+ const result = writePlatformFiles({ platformDir, tag: opts.tag });
87
+ if (opts.pull !== false) {
88
+ const code = await pullImages(platformDir, opts.tag);
49
89
  if (code !== 0) {
50
- console.error(`Failed to pull ${image} (exit ${code}). Check your internet connection or run \`docker login\`.`);
90
+ console.error(`Failed to pull the platform images (exit ${code}). Check your internet connection, run \`docker login\`, or use --no-pull to run images already on this machine.`);
51
91
  process.exit(1);
52
92
  }
53
93
  }
54
- // Write platform files to ~/.ductape/platform/
55
- fs.mkdirSync(HUB_PLATFORM_DIR, { recursive: true });
56
- copyTemplate('docker-compose.release.yml', path.join(HUB_PLATFORM_DIR, 'docker-compose.yml'), true);
57
- copyTemplate('api-gateway.conf', path.join(HUB_PLATFORM_DIR, 'api-gateway.conf'), true);
58
- copyTemplate('platform.env', path.join(HUB_PLATFORM_DIR, '.env'), false); // don't overwrite existing .env
59
- success(`Platform installed to ${HUB_PLATFORM_DIR}`);
94
+ success(`Platform installed to ${platformDir}`);
95
+ console.log('');
96
+ if (result.previous) {
97
+ console.log(` An earlier install was here. Its compose file is kept as ${path.basename(result.previous)}.`);
98
+ console.log(` If it is still running, stop it first: docker compose -f ${result.previous} down --remove-orphans`);
99
+ console.log('');
100
+ }
101
+ if (result.createdEnv || result.addedKey) {
102
+ console.log(` Settings: ${path.join(platformDir, '.env')}`);
103
+ console.log(' This install has its own ENC_KEY there. Back that file up: without the key, secrets this install stores cannot be read.');
104
+ }
105
+ else {
106
+ console.log(` Your settings in ${path.join(platformDir, '.env')} were left as they were.`);
107
+ }
108
+ console.log(' Add your AWS credentials there for cloud connections, and the DEPLOY_ settings to use Ductape Deploy.');
60
109
  console.log('');
61
- console.log(' Edit ~/.ductape/platform/.env to add your AWS credentials (needed for cloud connections).');
62
110
  console.log(' Then run: ductape start');
63
111
  console.log('');
64
112
  console.log(' Workbench: http://localhost:4310');
@@ -1,4 +1,6 @@
1
1
  import { spawn } from 'node:child_process';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
2
4
  import { getApiUrl, loadGlobalConfig, resolvePlatformDir } from '../lib/config.js';
3
5
  import { printJson, success } from '../lib/output.js';
4
6
  const WORKBENCH_ONLY_COMPOSE = [
@@ -10,12 +12,13 @@ const WORKBENCH_ONLY_COMPOSE = [
10
12
  function normalizeViteApiBase(url) {
11
13
  return url.endsWith('/') ? url : `${url}/`;
12
14
  }
13
- function runCompose(args, cwd) {
15
+ function runCompose(args, cwd, env = {}) {
14
16
  return new Promise((resolve, reject) => {
15
17
  const child = spawn('docker', ['compose', ...args], {
16
18
  cwd,
17
19
  stdio: 'inherit',
18
20
  shell: process.platform === 'win32',
21
+ env: { ...process.env, ...env },
19
22
  });
20
23
  child.on('error', reject);
21
24
  child.on('close', (code) => resolve(code ?? 1));
@@ -26,7 +29,10 @@ export async function runStart(opts) {
26
29
  if (opts.remote) {
27
30
  const apiBase = normalizeViteApiBase(getApiUrl('cloud'));
28
31
  const composeArgs = [...WORKBENCH_ONLY_COMPOSE];
29
- if (opts.build) {
32
+ // A source checkout can rebuild the Workbench for another API. An installed platform has only the published image, which reads its
33
+ // API address when it starts, so it is pointed at the other API with an environment variable instead.
34
+ const hasSource = fs.existsSync(path.join(platformDir, 'workbench', 'Dockerfile'));
35
+ if (opts.build && hasSource) {
30
36
  const buildCode = await runCompose([
31
37
  ...composeArgs,
32
38
  'build',
@@ -39,7 +45,7 @@ export async function runStart(opts) {
39
45
  if (buildCode !== 0)
40
46
  throw new Error(`docker compose build exited with ${buildCode}`);
41
47
  }
42
- const code = await runCompose([...composeArgs, 'up', '-d', 'workbench'], platformDir);
48
+ const code = await runCompose([...composeArgs, 'up', '-d', 'workbench'], platformDir, hasSource ? {} : { DUCTAPE_PUBLIC_URL: apiBase.replace(/\/$/, '') });
43
49
  if (code !== 0)
44
50
  throw new Error(`docker compose exited with ${code}`);
45
51
  success(`Workbench UI: http://localhost:4310 (API → ${apiBase})`);
package/dist/index.js CHANGED
@@ -33,9 +33,10 @@ import { runWorkspacesCurrent, runWorkspacesList, runWorkspacesRefresh, runWorks
33
33
  import { runGeneratePayload, runGenerateSnippet } from './commands/generate.js';
34
34
  import { runCompletion } from './commands/completion.js';
35
35
  import { runProducts, runProductApps, runProductAppActions, runProductComponents, runProductEnvironments } from './commands/products.js';
36
- import { runApps } from './commands/apps.js';
36
+ import { runApps, runAppVersionRename, runAppVersions } from './commands/apps.js';
37
37
  import { runAppsImport } from './commands/apps-import.js';
38
38
  import { runAppActions } from './commands/app-actions.js';
39
+ import { registerAppWebhooks } from './commands/app-webhooks.js';
39
40
  import { runMarketplace } from './commands/marketplace.js';
40
41
  import { runCapabilitySearch } from './commands/capabilities.js';
41
42
  import { runApply } from './commands/apply.js';
@@ -204,8 +205,10 @@ program
204
205
  .action(wrap((opts) => runWhoami(Boolean(opts.json))));
205
206
  program
206
207
  .command('install')
207
- .description('Check Docker/Node prerequisites and prepare platform .env')
208
- .action(wrap(runInstall));
208
+ .description('Install the Ductape platform on this machine: write its compose files and settings, and pull the images')
209
+ .option('--tag <tag>', 'Install this release of the images instead of latest')
210
+ .option('--no-pull', 'Do not pull images: use the ones already on this machine (for images you built yourself)')
211
+ .action(wrap((opts) => runInstall(opts)));
209
212
  const profiles = program.command('profiles').description('Manage API profiles (cloud / local)');
210
213
  profiles
211
214
  .command('list')
@@ -770,6 +773,20 @@ const apps = program
770
773
  throw new Error('Specify a verb: list | get | create | update | delete');
771
774
  return runApps(verb, opts, []);
772
775
  }));
776
+ apps.command('versions')
777
+ .description('Fetch lightweight version metadata without actions, webhooks or credentials')
778
+ .requiredOption('--id <id>', 'App ID')
779
+ .option('--profile <name>')
780
+ .option('--json', 'JSON output')
781
+ .action(wrap((opts) => runAppVersions(opts)));
782
+ apps.command('rename-version')
783
+ .description('Rename a version label atomically without changing its contents')
784
+ .requiredOption('--id <id>', 'App ID')
785
+ .requiredOption('--from <label>', 'Existing version label')
786
+ .requiredOption('--to <label>', 'New, unused version label')
787
+ .option('--profile <name>')
788
+ .option('--json', 'JSON output')
789
+ .action(wrap((opts) => runAppVersionRename(opts)));
773
790
  apps
774
791
  .command('import <file>')
775
792
  .description('Import Postman v2.1 or OpenAPI 3.0 into a new or existing app')
@@ -778,7 +795,7 @@ apps
778
795
  .option('--app-id <id>', 'Update existing app by _id')
779
796
  .option('--app-tag <tag>', 'Update existing app by tag')
780
797
  .option('--update', 'Replace/update if app already exists')
781
- .option('--version <tag>', 'App version tag', '0.0.1')
798
+ .requiredOption('--version <tag>', 'Verified provider API version or explicit integration revision (no automatic default)')
782
799
  .option('--json', 'JSON output')
783
800
  .action(wrap((file, opts) => runAppsImport(file, {
784
801
  profile: opts.profile,
@@ -791,6 +808,7 @@ apps
791
808
  })));
792
809
  const appActions = apps.command('actions').description("An app's own actions (endpoints). resource is a path relative to each of the app's " +
793
810
  'environment base_urls (e.g. "/v1/users/{id}"), not a full URL.');
811
+ registerAppWebhooks(apps, wrap);
794
812
  appActions
795
813
  .command('list')
796
814
  .requiredOption('--app <tag>', 'App tag')
@@ -5,6 +5,7 @@ export declare const IMPORT_DOC_TYPES: {
5
5
  readonly openapi: "OpenApiV3.0";
6
6
  };
7
7
  export type ImportFormat = keyof typeof IMPORT_DOC_TYPES;
8
+ export declare function requireImportVersion(version?: string): string;
8
9
  export declare function parseImportFormat(value: string): ImportFormat;
9
10
  export declare function importAppFromFile(ctx: WorkspaceContext, opts: {
10
11
  filePath: string;
@@ -5,6 +5,12 @@ export const IMPORT_DOC_TYPES = {
5
5
  postman: 'PostmanV2.1',
6
6
  openapi: 'OpenApiV3.0',
7
7
  };
8
+ export function requireImportVersion(version) {
9
+ if (!version?.trim()) {
10
+ throw new Error('Provide --version with the verified provider API version. For unversioned or mixed APIs, choose an explicit integration revision; no placeholder version is assigned automatically.');
11
+ }
12
+ return version.trim();
13
+ }
8
14
  export function parseImportFormat(value) {
9
15
  const v = value.toLowerCase().replace(/[_\s]/g, '');
10
16
  if (v === 'postman' || v === 'postmanv21' || v === 'postman2.1' || v === 'postmanv2.1') {
@@ -24,6 +30,7 @@ function uploadFilename(filePath) {
24
30
  return `${base}.json`;
25
31
  }
26
32
  export async function importAppFromFile(ctx, opts) {
33
+ const version = requireImportVersion(opts.version);
27
34
  const abs = path.resolve(opts.filePath);
28
35
  if (!fs.existsSync(abs))
29
36
  throw new Error(`File not found: ${abs}`);
@@ -35,7 +42,7 @@ export async function importAppFromFile(ctx, opts) {
35
42
  form.append('public_key', ctx.credentials.public_key);
36
43
  form.append('user_id', ctx.credentials.user_id);
37
44
  form.append('type', IMPORT_DOC_TYPES[opts.format]);
38
- form.append('version', opts.version ?? '0.0.1');
45
+ form.append('version', version);
39
46
  form.append('update', opts.update ? 'true' : 'false');
40
47
  if (opts.appId)
41
48
  form.append('app_id', opts.appId);
@@ -24,6 +24,7 @@ export declare function getApp(ctx: WorkspaceContext, opts: {
24
24
  tag?: string;
25
25
  }): Promise<unknown>;
26
26
  export declare function createApp(ctx: WorkspaceContext, body: Record<string, unknown>): Promise<unknown>;
27
+ export declare function getAppVersions(ctx: WorkspaceContext, appId: string): Promise<unknown>;
27
28
  export declare function updateApp(ctx: WorkspaceContext, appId: string, body: Record<string, unknown>): Promise<unknown>;
28
29
  export declare function updateAppViaProxy(ctx: WorkspaceContext, tag: string, body: Record<string, unknown>): Promise<unknown>;
29
30
  export declare function deleteApp(ctx: WorkspaceContext, appId: string): Promise<unknown>;
@@ -428,6 +428,9 @@ export async function createApp(ctx, body) {
428
428
  const result = await client(ctx).post('/apps/v1/create', payload);
429
429
  return unwrapOne(result);
430
430
  }
431
+ export async function getAppVersions(ctx, appId) {
432
+ return unwrapOne(await client(ctx).getPath(`/apps/v1/${appId}/versions/metadata`, workspaceAuthQuery(ctx)));
433
+ }
431
434
  export async function updateApp(ctx, appId, body) {
432
435
  const q = workspaceAuthQuery(ctx);
433
436
  const result = await client(ctx).put(`/apps/v1/${appId}?${new URLSearchParams(q).toString()}`, { component: 'app', ...body });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ductape/cli",
3
- "version": "0.5.2",
3
+ "version": "0.5.5",
4
4
  "description": "Ductape CLI — local platform, login, link projects, and manage resources via the proxy (Workbench-compatible)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,26 +1,14 @@
1
- upstream nest_users { server users:8002; }
2
- upstream nest_workspaces { server workspaces:8001; }
3
- upstream nest_emails { server emails:8003; }
4
- upstream nest_apps { server apps:8004; }
5
- upstream nest_marketplace { server marketplace:8007; }
6
- upstream nest_logs { server logs:8008; }
7
- upstream nest_integrations { server integrations:8009; }
8
- upstream nest_webhooks { server webhooks:8012; }
9
- upstream nest_notifications { server notifications:8013; }
10
- upstream nest_partnerships { server partnerships:8014; }
11
- upstream nest_jobs { server jobs:8015; }
12
- upstream nest_pricing { server pricing:8011; }
13
- upstream nest_admins { server admins:8018; }
14
- upstream nest_proxy { server proxy:8020; }
15
- upstream nest_tickets { server tickets:9002; }
16
- upstream nest_realtime { server realtime:3030; }
17
-
1
+ # Upstream names are resolved when a request arrives (Docker's resolver, short cache), not when nginx starts.
2
+ # Otherwise a restarted service gets a new address that nginx never learns, and one missing service stops the
3
+ # whole gateway from starting.
18
4
  server {
19
5
  listen 8000;
6
+ resolver 127.0.0.11 valid=5s ipv6=off;
20
7
  client_max_body_size 50m;
21
8
 
22
9
  location /users/ {
23
- proxy_pass http://nest_users/users/;
10
+ set $upstream http://users:8002;
11
+ proxy_pass $upstream;
24
12
  proxy_http_version 1.1;
25
13
  proxy_set_header Host $host;
26
14
  proxy_set_header X-Real-IP $remote_addr;
@@ -29,7 +17,8 @@ server {
29
17
  }
30
18
 
31
19
  location /workspaces/ {
32
- proxy_pass http://nest_workspaces/workspaces/;
20
+ set $upstream http://workspaces:8001;
21
+ proxy_pass $upstream;
33
22
  proxy_http_version 1.1;
34
23
  proxy_set_header Host $host;
35
24
  proxy_set_header X-Real-IP $remote_addr;
@@ -38,7 +27,8 @@ server {
38
27
  }
39
28
 
40
29
  location /emails/ {
41
- proxy_pass http://nest_emails/emails/;
30
+ set $upstream http://emails:8003;
31
+ proxy_pass $upstream;
42
32
  proxy_http_version 1.1;
43
33
  proxy_set_header Host $host;
44
34
  proxy_set_header X-Real-IP $remote_addr;
@@ -47,7 +37,8 @@ server {
47
37
  }
48
38
 
49
39
  location /apps/ {
50
- proxy_pass http://nest_apps/apps/;
40
+ set $upstream http://apps:8004;
41
+ proxy_pass $upstream;
51
42
  proxy_http_version 1.1;
52
43
  proxy_set_header Host $host;
53
44
  proxy_set_header X-Real-IP $remote_addr;
@@ -56,7 +47,8 @@ server {
56
47
  }
57
48
 
58
49
  location /marketplace/ {
59
- proxy_pass http://nest_marketplace/marketplace/;
50
+ set $upstream http://marketplace:8007;
51
+ proxy_pass $upstream;
60
52
  proxy_http_version 1.1;
61
53
  proxy_set_header Host $host;
62
54
  proxy_set_header X-Real-IP $remote_addr;
@@ -65,7 +57,19 @@ server {
65
57
  }
66
58
 
67
59
  location /logs/ {
68
- proxy_pass http://nest_logs/logs/;
60
+ set $upstream http://logs:8008;
61
+ proxy_pass $upstream;
62
+ proxy_http_version 1.1;
63
+ proxy_set_header Host $host;
64
+ proxy_set_header X-Real-IP $remote_addr;
65
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
66
+ proxy_set_header X-Forwarded-Proto $scheme;
67
+ }
68
+
69
+ # The Workbench and the SDK call the logs service under /log/v1, so it is routed as well as /logs/.
70
+ location /log/ {
71
+ set $upstream http://logs:8008;
72
+ proxy_pass $upstream;
69
73
  proxy_http_version 1.1;
70
74
  proxy_set_header Host $host;
71
75
  proxy_set_header X-Real-IP $remote_addr;
@@ -74,7 +78,8 @@ server {
74
78
  }
75
79
 
76
80
  location /integrations/ {
77
- proxy_pass http://nest_integrations/integrations/;
81
+ set $upstream http://integrations:8009;
82
+ proxy_pass $upstream;
78
83
  proxy_http_version 1.1;
79
84
  proxy_set_header Host $host;
80
85
  proxy_set_header X-Real-IP $remote_addr;
@@ -87,7 +92,8 @@ server {
87
92
  }
88
93
 
89
94
  location /webhooks/ {
90
- proxy_pass http://nest_webhooks/webhooks/;
95
+ set $upstream http://webhooks:8012;
96
+ proxy_pass $upstream;
91
97
  proxy_http_version 1.1;
92
98
  proxy_set_header Host $host;
93
99
  proxy_set_header X-Real-IP $remote_addr;
@@ -96,7 +102,8 @@ server {
96
102
  }
97
103
 
98
104
  location /notifications/ {
99
- proxy_pass http://nest_notifications/notifications/;
105
+ set $upstream http://notifications:8013;
106
+ proxy_pass $upstream;
100
107
  proxy_http_version 1.1;
101
108
  proxy_set_header Host $host;
102
109
  proxy_set_header X-Real-IP $remote_addr;
@@ -105,7 +112,8 @@ server {
105
112
  }
106
113
 
107
114
  location /partnerships/ {
108
- proxy_pass http://nest_partnerships/partnerships/;
115
+ set $upstream http://partnerships:8014;
116
+ proxy_pass $upstream;
109
117
  proxy_http_version 1.1;
110
118
  proxy_set_header Host $host;
111
119
  proxy_set_header X-Real-IP $remote_addr;
@@ -114,7 +122,8 @@ server {
114
122
  }
115
123
 
116
124
  location /jobs/ {
117
- proxy_pass http://nest_jobs/jobs/;
125
+ set $upstream http://jobs:8015;
126
+ proxy_pass $upstream;
118
127
  proxy_http_version 1.1;
119
128
  proxy_set_header Host $host;
120
129
  proxy_set_header X-Real-IP $remote_addr;
@@ -123,7 +132,8 @@ server {
123
132
  }
124
133
 
125
134
  location /pricing/ {
126
- proxy_pass http://nest_pricing/pricing/;
135
+ set $upstream http://pricing:8011;
136
+ proxy_pass $upstream;
127
137
  proxy_http_version 1.1;
128
138
  proxy_set_header Host $host;
129
139
  proxy_set_header X-Real-IP $remote_addr;
@@ -132,7 +142,8 @@ server {
132
142
  }
133
143
 
134
144
  location /admins/ {
135
- proxy_pass http://nest_admins/admins/;
145
+ set $upstream http://admins:8018;
146
+ proxy_pass $upstream;
136
147
  proxy_http_version 1.1;
137
148
  proxy_set_header Host $host;
138
149
  proxy_set_header X-Real-IP $remote_addr;
@@ -141,7 +152,8 @@ server {
141
152
  }
142
153
 
143
154
  location /proxy/ {
144
- proxy_pass http://nest_proxy/proxy/;
155
+ set $upstream http://proxy:8020;
156
+ proxy_pass $upstream;
145
157
  proxy_http_version 1.1;
146
158
  proxy_set_header Host $host;
147
159
  proxy_set_header X-Real-IP $remote_addr;
@@ -153,7 +165,8 @@ server {
153
165
  }
154
166
 
155
167
  location /tickets/ {
156
- proxy_pass http://nest_tickets/tickets/;
168
+ set $upstream http://tickets:9002;
169
+ proxy_pass $upstream;
157
170
  proxy_http_version 1.1;
158
171
  proxy_set_header Host $host;
159
172
  proxy_set_header X-Real-IP $remote_addr;
@@ -161,8 +174,10 @@ server {
161
174
  proxy_set_header X-Forwarded-Proto $scheme;
162
175
  }
163
176
 
164
- location /realtime/ {
165
- proxy_pass http://nest_realtime/;
177
+ # Realtime is served by the proxy service (WebSocket, at /realtime). Both /realtime and /realtime/ are accepted.
178
+ location ~ ^/realtime/?$ {
179
+ set $upstream http://proxy:8020;
180
+ proxy_pass $upstream;
166
181
  proxy_http_version 1.1;
167
182
  proxy_set_header Upgrade $http_upgrade;
168
183
  proxy_set_header Connection "upgrade";
@@ -170,6 +185,10 @@ server {
170
185
  proxy_set_header X-Real-IP $remote_addr;
171
186
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
172
187
  proxy_set_header X-Forwarded-Proto $scheme;
188
+ # A connection may sit idle for a long time between messages; the server pings it every 30 seconds.
189
+ proxy_connect_timeout 60s;
190
+ proxy_send_timeout 3600s;
191
+ proxy_read_timeout 3600s;
173
192
  }
174
193
 
175
194
  location / {
@@ -0,0 +1,7 @@
1
+ # Backend only: everything except the Workbench. Used by `ductape start --backend-only`.
2
+ name: ductape-platform
3
+
4
+ services:
5
+ workbench:
6
+ profiles:
7
+ - never
@@ -1,38 +1,44 @@
1
- # Ductape platform — Docker Hub release compose
2
- # Written by `ductape install` to ~/.ductape/platform/docker-compose.yml
3
- # Run `ductape start` to bring the stack up.
1
+ # Ductape platform: the published images, run on your machine.
2
+ # Written by `ductape install` to ~/.ductape/platform/docker-compose.yml. Do not edit: `ductape install` replaces it. Put your settings in .env next to it.
3
+ # Generated from platform/docker-compose.yml by platform/scripts/render-release.mjs.
4
+ # Run `ductape start` to bring the stack up. Pin a release with DUCTAPE_TAG (default: latest) in .env.
4
5
 
5
6
  name: ductape-platform
6
7
 
7
- x-api-image: &api-image
8
- image: ductape/platform-api:latest
8
+ x-backend: &backend
9
9
  restart: unless-stopped
10
+ env_file:
11
+ - path: .env
12
+ required: false
10
13
  depends_on:
11
14
  mongo:
12
15
  condition: service_healthy
13
- kafka:
14
- condition: service_started
15
16
  networks:
16
17
  - platform
17
18
 
18
- x-api-env: &api-env
19
- NODE_ENV: production
20
- DB_HOST: mongodb://mongo:27017/ductape
21
- KAFKA_BROKERS: kafka:29092
22
- KAFKA_TOPIC_PREFIX: ductape
23
- USE_KAFKA: "true"
24
- KAFKA_RPC_TIMEOUT_MS: "15000"
19
+ x-backend-env: &backend-env
20
+ NODE_ENV: ${NODE_ENV:-development}
21
+ # "self" marks a self-hosted install: licence checks and read-only mode apply.
22
+ APP_ENV: ${APP_ENV:-self}
23
+ DB_HOST: ${DB_HOST:-mongodb://mongo:27017/ductape}
24
+ ENC_KEY: ${ENC_KEY:?Set ENC_KEY in platform/.env (any long random string, the same for every service)}
25
+ ENV_STRICT: ${ENV_STRICT:-false}
25
26
  EMAIL_SERVICE: http://emails:8003
26
27
  USER_SERVICE: http://users:8002
27
28
  WORKSPACE_SERVICE: http://workspaces:8001
29
+ DEVELOPER_SERVICE: http://workspaces:8001
30
+ APP_SERVICE: http://apps:8004
28
31
  PRICING_SERVICE: http://pricing:8011
29
32
  NOTIFICATION_SERVICE: http://notifications:8013
30
33
  ADMIN_SERVICE: http://admins:8018
31
- APPS_SERVICE: http://apps:8004
32
- DEFAULT_ADMIN_ROLE_ID: ${DEFAULT_ADMIN_ROLE_ID:-}
33
- CORS_ORIGINS: http://localhost:4310,http://127.0.0.1:4310,http://localhost:4320,http://127.0.0.1:4320,http://localhost:3000,http://localhost
34
- AWS_ACCOUNT_ID: ${AWS_ACCOUNT_ID:-480358138685}
35
- AWS_DUCTAPE_ACCOUNT_ID: ${AWS_DUCTAPE_ACCOUNT_ID:-${AWS_ACCOUNT_ID:-480358138685}}
34
+ JOB_SERVICE: http://jobs:8015
35
+ # Services that use the Ductape SDK (healthcheck probes, integrations, proxy, jobs) call the platform API
36
+ # through the gateway. Without this the SDK defaults to https://api.ductape.app, the hosted cloud.
37
+ DUCTAPE_API_BASE_URL: http://api-gateway:8000
38
+ # The address of this install's gateway as seen from outside (see .env.example). Webhook URLs and file links use it.
39
+ DUCTAPE_PUBLIC_URL: ${DUCTAPE_PUBLIC_URL:-http://localhost:4311}
40
+ DUCTAPE_SIGNIN_URL: ${DUCTAPE_SIGNIN_URL:-http://localhost:4310/login}
41
+ DUCTAPE_SIGNUP_URL: ${DUCTAPE_SIGNUP_URL:-http://localhost:4310/signup}
36
42
 
37
43
  services:
38
44
  mongo:
@@ -50,32 +56,16 @@ services:
50
56
  networks:
51
57
  - platform
52
58
 
53
- zookeeper:
54
- image: confluentinc/cp-zookeeper:7.6.1
55
- environment:
56
- ZOOKEEPER_CLIENT_PORT: 2181
57
- ZOOKEEPER_TICK_TIME: 2000
58
- ports:
59
- - "2181:2181"
60
- networks:
61
- - platform
62
-
63
- kafka:
64
- image: confluentinc/cp-kafka:7.6.1
65
- depends_on:
66
- - zookeeper
67
- ports:
68
- - "9092:9092"
69
- environment:
70
- KAFKA_BROKER_ID: 1
71
- KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
72
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
73
- KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
74
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
75
- KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
76
- KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
77
- KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
78
- KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
59
+ redis:
60
+ image: redis:7-alpine
61
+ restart: unless-stopped
62
+ volumes:
63
+ - redis_data:/data
64
+ healthcheck:
65
+ test: ["CMD", "redis-cli", "ping"]
66
+ interval: 5s
67
+ timeout: 5s
68
+ retries: 10
79
69
  networks:
80
70
  - platform
81
71
 
@@ -95,163 +85,190 @@ services:
95
85
  - platform
96
86
 
97
87
  users:
98
- <<: *api-image
88
+ <<: *backend
89
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-users:${DUCTAPE_TAG:-latest}
99
90
  environment:
100
- <<: *api-env
101
- NEST_APP: users
91
+ <<: *backend-env
92
+ MODULE: users
102
93
  PORT: "8002"
103
94
  ports:
104
95
  - "8002:8002"
105
96
 
106
97
  workspaces:
107
- <<: *api-image
98
+ <<: *backend
99
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-workspaces:${DUCTAPE_TAG:-latest}
108
100
  environment:
109
- <<: *api-env
110
- NEST_APP: workspaces
101
+ <<: *backend-env
102
+ MODULE: workspaces
111
103
  PORT: "8001"
104
+ GCS_PUBLIC_BUCKET: ${GCS_PUBLIC_BUCKET:-}
105
+ GCS_PRIVATE_BUCKET: ${GCS_PRIVATE_BUCKET:-}
106
+ GOOGLE_APPLICATION_CREDENTIALS: ${GOOGLE_APPLICATION_CREDENTIALS:-}
107
+ AWS_ACCESS_KEY: ${AWS_ACCESS_KEY:-}
108
+ AWS_SECRET_KEY: ${AWS_SECRET_KEY:-}
109
+ # Uploaded files (logos, attachments) are kept on this install's disk unless UPLOAD_DRIVER=gcs.
110
+ UPLOAD_DIR: /data/uploads
111
+ volumes:
112
+ - uploads_data:/data/uploads
112
113
  ports:
113
114
  - "8001:8001"
114
115
 
115
116
  emails:
116
- <<: *api-image
117
+ <<: *backend
118
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-emails:${DUCTAPE_TAG:-latest}
117
119
  environment:
118
- <<: *api-env
119
- NEST_APP: emails
120
+ <<: *backend-env
121
+ MODULE: emails
120
122
  PORT: "8003"
121
123
  ports:
122
124
  - "8003:8003"
123
125
 
124
126
  apps:
125
- <<: *api-image
127
+ <<: *backend
128
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-apps:${DUCTAPE_TAG:-latest}
126
129
  environment:
127
- <<: *api-env
128
- NEST_APP: apps
130
+ <<: *backend-env
131
+ MODULE: apps
129
132
  PORT: "8004"
130
133
  ports:
131
134
  - "8004:8004"
132
135
 
133
136
  integrations:
134
- <<: *api-image
135
- env_file:
136
- - .env
137
+ <<: *backend
138
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-integrations:${DUCTAPE_TAG:-latest}
137
139
  environment:
138
- <<: *api-env
139
- NEST_APP: integrations
140
+ <<: *backend-env
141
+ MODULE: integrations
140
142
  PORT: "8009"
141
143
  AWS_REGION: ${AWS_REGION:-us-east-1}
144
+ AWS_ACCOUNT_ID: ${AWS_ACCOUNT_ID:-480358138685}
145
+ AWS_DUCTAPE_ACCOUNT_ID: ${AWS_DUCTAPE_ACCOUNT_ID:-${AWS_ACCOUNT_ID:-480358138685}}
142
146
  AWS_SDK_LOAD_CONFIG: ${AWS_SDK_LOAD_CONFIG:-1}
143
147
  AWS_PROFILE: ${AWS_PROFILE:-}
148
+ # For AssumeRole during cloud connection validate (or use the ~/.aws mount below).
144
149
  AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID:-}
145
150
  AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY:-}
146
151
  AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN:-}
147
152
  volumes:
153
+ # Use local AWS CLI credentials when keys are not in platform/.env
148
154
  - ${HOME}/.aws:/root/.aws:ro
149
155
  ports:
150
156
  - "8009:8009"
151
157
 
152
158
  pricing:
153
- <<: *api-image
159
+ <<: *backend
160
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-pricing:${DUCTAPE_TAG:-latest}
154
161
  environment:
155
- <<: *api-env
156
- NEST_APP: pricing
162
+ <<: *backend-env
163
+ MODULE: pricing
157
164
  PORT: "8011"
158
165
  ports:
159
166
  - "8011:8011"
160
167
 
161
168
  logs:
162
- <<: *api-image
169
+ <<: *backend
170
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-logs:${DUCTAPE_TAG:-latest}
163
171
  environment:
164
- <<: *api-env
165
- NEST_APP: logs
172
+ <<: *backend-env
173
+ MODULE: logs
166
174
  PORT: "8008"
167
175
  ports:
168
176
  - "8008:8008"
169
177
 
170
178
  proxy:
171
- <<: *api-image
179
+ <<: *backend
180
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-proxy:${DUCTAPE_TAG:-latest}
172
181
  environment:
173
- <<: *api-env
174
- NEST_APP: proxy
182
+ <<: *backend-env
183
+ MODULE: proxy
175
184
  PORT: "8020"
176
- DUCTAPE_API_BASE_URL: http://api-gateway:8000
177
185
  ports:
178
186
  - "8020:8020"
179
187
 
180
188
  admins:
181
- <<: *api-image
189
+ <<: *backend
190
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-admins:${DUCTAPE_TAG:-latest}
182
191
  environment:
183
- <<: *api-env
184
- NEST_APP: admins
192
+ <<: *backend-env
193
+ MODULE: admins
185
194
  PORT: "8018"
186
195
  ports:
187
196
  - "8018:8018"
188
197
 
189
198
  notifications:
190
- <<: *api-image
199
+ <<: *backend
200
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-notifications:${DUCTAPE_TAG:-latest}
191
201
  environment:
192
- <<: *api-env
193
- NEST_APP: notifications
202
+ <<: *backend-env
203
+ MODULE: notifications
194
204
  PORT: "8013"
195
205
  ports:
196
206
  - "8013:8013"
197
207
 
198
208
  webhooks:
199
- <<: *api-image
209
+ <<: *backend
210
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-webhooks:${DUCTAPE_TAG:-latest}
200
211
  environment:
201
- <<: *api-env
202
- NEST_APP: webhooks
212
+ <<: *backend-env
213
+ MODULE: webhooks
203
214
  PORT: "8012"
215
+ # Webhook URLs handed to providers are BASE_URL + /webhooks/v1/process/<id>. They must be the address of THIS install.
216
+ BASE_URL: ${WEBHOOKS_BASE_URL:-${DUCTAPE_PUBLIC_URL:-http://localhost:4311}}
204
217
  ports:
205
218
  - "8012:8012"
206
219
 
207
220
  jobs:
208
- <<: *api-image
221
+ <<: *backend
222
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-jobs:${DUCTAPE_TAG:-latest}
223
+ depends_on:
224
+ mongo:
225
+ condition: service_healthy
226
+ redis:
227
+ condition: service_healthy
209
228
  environment:
210
- <<: *api-env
211
- NEST_APP: jobs
229
+ <<: *backend-env
230
+ MODULE: jobs
212
231
  PORT: "8015"
232
+ REDIS_HOST: redis://redis:6379
213
233
  ports:
214
234
  - "8015:8015"
215
235
 
216
236
  marketplace:
217
- <<: *api-image
237
+ <<: *backend
238
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-marketplace:${DUCTAPE_TAG:-latest}
218
239
  environment:
219
- <<: *api-env
220
- NEST_APP: marketplace
240
+ <<: *backend-env
241
+ MODULE: marketplace
221
242
  PORT: "8007"
222
243
  ports:
223
244
  - "8007:8007"
224
245
 
225
246
  partnerships:
226
- <<: *api-image
247
+ <<: *backend
248
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-partnerships:${DUCTAPE_TAG:-latest}
227
249
  environment:
228
- <<: *api-env
229
- NEST_APP: partnerships
250
+ <<: *backend-env
251
+ MODULE: partnerships
230
252
  PORT: "8014"
231
253
  ports:
232
254
  - "8014:8014"
233
255
 
234
256
  tickets:
235
- <<: *api-image
257
+ <<: *backend
258
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-tickets:${DUCTAPE_TAG:-latest}
236
259
  environment:
237
- <<: *api-env
238
- NEST_APP: tickets
260
+ <<: *backend-env
261
+ MODULE: tickets
239
262
  PORT: "9002"
240
263
  ports:
241
264
  - "9002:9002"
242
265
 
243
- realtime:
244
- <<: *api-image
245
- environment:
246
- <<: *api-env
247
- NEST_APP: realtime
248
- PORT: "3030"
249
- ports:
250
- - "3030:3030"
251
-
252
266
  workbench:
253
- image: ductape/platform-workbench:latest
267
+ image: ${DUCTAPE_IMAGE_ORG:-ductape}/platform-workbench:${DUCTAPE_TAG:-latest}
254
268
  restart: unless-stopped
269
+ environment:
270
+ # Read when the container starts (see workbench/docker/40-runtime-config.sh), so the published image works on any domain.
271
+ DUCTAPE_PUBLIC_URL: ${DUCTAPE_PUBLIC_URL:-http://localhost:4311}
255
272
  ports:
256
273
  - "4310:80"
257
274
  networks:
@@ -263,3 +280,5 @@ networks:
263
280
 
264
281
  volumes:
265
282
  mongo_data:
283
+ redis_data:
284
+ uploads_data:
@@ -0,0 +1,58 @@
1
+ # Workbench only: the Workbench, pointed at another API. Used by `ductape start --remote`.
2
+ name: ductape-platform
3
+
4
+ services:
5
+ mongo:
6
+ profiles:
7
+ - never
8
+ redis:
9
+ profiles:
10
+ - never
11
+ api-gateway:
12
+ profiles:
13
+ - never
14
+ users:
15
+ profiles:
16
+ - never
17
+ workspaces:
18
+ profiles:
19
+ - never
20
+ emails:
21
+ profiles:
22
+ - never
23
+ apps:
24
+ profiles:
25
+ - never
26
+ integrations:
27
+ profiles:
28
+ - never
29
+ pricing:
30
+ profiles:
31
+ - never
32
+ logs:
33
+ profiles:
34
+ - never
35
+ proxy:
36
+ profiles:
37
+ - never
38
+ admins:
39
+ profiles:
40
+ - never
41
+ notifications:
42
+ profiles:
43
+ - never
44
+ webhooks:
45
+ profiles:
46
+ - never
47
+ jobs:
48
+ profiles:
49
+ - never
50
+ marketplace:
51
+ profiles:
52
+ - never
53
+ partnerships:
54
+ profiles:
55
+ - never
56
+ tickets:
57
+ profiles:
58
+ - never
@@ -1,16 +1,74 @@
1
- # Ductape platform environment — edit and save as ~/.ductape/platform/.env
2
- # Required for AWS cloud connections. All other vars have working defaults.
1
+ # Ductape platform settings. `ductape install` created this file and gave it an ENC_KEY of its own. Back it up: without ENC_KEY, stored secrets cannot be read.
2
+ # Compose passes this file to every backend service.
3
3
 
4
- # --- AWS cloud connections ---
5
- # Needed for workbench → Cloud → "Complete setup". Leave blank to skip cloud connections.
4
+ # Required: the key every backend service uses to encrypt stored secrets and sign service tokens.
5
+ # Use one long random value (for example: openssl rand -hex 32) and keep it the same for every service.
6
+ # Changing it later makes previously stored secrets unreadable.
7
+ ENC_KEY=
8
+ # Optional: key for login tokens
9
+ # LOGIN_ENC_KEY=
10
+
11
+ # The address of THIS install's API gateway, as seen from outside (no trailing slash). The default only works on the
12
+ # machine running it. Set it to the public address you serve the gateway on, for example https://ductape.example.com.
13
+ # It is used for:
14
+ # - the webhook URLs Ductape gives to providers (they must point at your system, not Ductape cloud),
15
+ # - the API address the Workbench calls,
16
+ # - the links to uploaded files.
17
+ # Third parties (payment providers, GitHub, and so on) must be able to reach <this address>/webhooks/v1/process/* from the
18
+ # internet. Allow that path through your firewall or load balancer; everything else can stay private.
19
+ # DUCTAPE_PUBLIC_URL=http://localhost:4311
20
+
21
+ # Every other variable the backend reads is listed in backend/ENV.md. Add any of them here to
22
+ # change it; compose passes this file to every backend service.
23
+
24
+ # Optional override for bootstrap admin role (defaults to auto-created "Super Admin")
25
+ # DEFAULT_ADMIN_ROLE_ID=
26
+
27
+ # Workbench image build arg (only when rebuilding the workbench service)
28
+ # VITE_API_BASE_URL=http://localhost:4311/
29
+
30
+ # --- AWS cloud connections (required for workbench → Cloud → Complete setup) ---
31
+ # The integrations service calls sts:AssumeRole to validate connections. Without these,
32
+ # "Complete setup" fails with "Missing credentials in config".
33
+
34
+ # 12-digit AWS account ID where Ductape runs (shown in IAM trust policies as the trusting principal).
6
35
  AWS_ACCOUNT_ID=480358138685
36
+ # Optional alias; defaults to AWS_ACCOUNT_ID if unset.
37
+ # AWS_DUCTAPE_ACCOUNT_ID=480358138685
38
+
39
+ # IAM user access keys in that same account. The user needs permission to sts:AssumeRole
40
+ # on the DuctapeAccess role (e.g. arn:aws:iam::480358138685:role/DuctapeAccess).
41
+ # Workbench shows the exact IAM user ARN (e.g. arn:aws:iam::480358138685:user/Ductape).
7
42
  AWS_ACCESS_KEY_ID=
8
43
  AWS_SECRET_ACCESS_KEY=
9
44
  AWS_REGION=us-east-1
45
+
46
+ # Ductape file/image uploads (separate public and private GCS buckets).
47
+ GCS_PUBLIC_BUCKET=
48
+ GCS_PRIVATE_BUCKET=
49
+ # Full single-line service-account JSON (single-quote the value in .env).
50
+ GOOGLE_APPLICATION_CREDENTIALS=
51
+ # Optional session token for temporary credentials
10
52
  # AWS_SESSION_TOKEN=
53
+
54
+ # Alternative to keys above: use a profile from `aws configure` on the host (mounts ~/.aws).
11
55
  # AWS_PROFILE=default
12
56
  # AWS_SDK_LOAD_CONFIG=1
13
57
 
14
- # --- Optional overrides ---
15
- # DEFAULT_ADMIN_ROLE_ID=
16
- # AWS_DUCTAPE_ACCOUNT_ID=480358138685
58
+ # --- Ductape Deploy (deploy your own functions and services into your own cloud account) ---
59
+ # Everything here is off until you turn it on. Plans can be made and read with all of it off; nothing changes in any cloud.
60
+ # Details: https://docs.ductape.app/deploy/operate
61
+ #
62
+ # Let Deploy change your clouds. Without it, plans can be made and approved and nothing is applied.
63
+ # DEPLOY_ALLOW_MUTATIONS=true
64
+ # Read the state of your cloud when planning (the Workbench needs this to make plans).
65
+ # DEPLOY_OBSERVE_FROM_PROVIDER=true
66
+ # Run the worker that advances builds and deployments. Run it in one integrations container.
67
+ # DEPLOY_RECONCILER=true
68
+ # Limit Deploy to some workspaces (comma-separated workspace ids). Unset allows every workspace.
69
+ # DEPLOY_ENABLED_WORKSPACES=
70
+ # Only workspace owners and admins can approve plans, retire versions and change policy.
71
+ # DEPLOY_ADMIN_ONLY=true
72
+ # The addresses your install calls deployed services from, so customers can allow them on a Fargate load balancer
73
+ # (comma-separated CIDR blocks, such as 203.0.113.7/32).
74
+ # DEPLOY_CONTROL_PLANE_CIDRS=