@wtfalch/foundry 0.36.0 → 0.36.1

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.
@@ -34,10 +34,16 @@ export declare const DIGESTS: PinnedVersions;
34
34
  */
35
35
  export declare function pinnedRef(key: keyof PinnedVersions): string;
36
36
  /**
37
- * A declared tag that equals the pinned one gets its digest; any other
38
- * declared tag (an override) is passed through unchanged.
37
+ * The two image fields Coolify accepts. Its tag rule has no `@` or `:`, so a
38
+ * digest goes in the name as `<image>@sha256` and the tag holds the bare
39
+ * 64-hex digest (Coolify pulls `<name>:<tag>`). A declared tag that equals the
40
+ * pinned one gets its digest; any other declared tag (an override) is passed
41
+ * through unchanged.
39
42
  */
40
- export declare function pinnedTagFor(key: keyof PinnedVersions, tag: string): string;
43
+ export declare function coolifyImageFor(key: keyof PinnedVersions, image: string, tag: string): {
44
+ docker_registry_image_name: string;
45
+ docker_registry_image_tag: string;
46
+ };
41
47
  /**
42
48
  * Why an image tag cannot be used, or `null`. #248: generalised out of what
43
49
  * was `platform-providers.ts`'s `mailImageTagBlocked`, the one guard
@@ -41,11 +41,20 @@ export function pinnedRef(key) {
41
41
  return `${VERSIONS[key]}@${DIGESTS[key]}`;
42
42
  }
43
43
  /**
44
- * A declared tag that equals the pinned one gets its digest; any other
45
- * declared tag (an override) is passed through unchanged.
44
+ * The two image fields Coolify accepts. Its tag rule has no `@` or `:`, so a
45
+ * digest goes in the name as `<image>@sha256` and the tag holds the bare
46
+ * 64-hex digest (Coolify pulls `<name>:<tag>`). A declared tag that equals the
47
+ * pinned one gets its digest; any other declared tag (an override) is passed
48
+ * through unchanged.
46
49
  */
47
- export function pinnedTagFor(key, tag) {
48
- return tag === VERSIONS[key] ? pinnedRef(key) : tag;
50
+ export function coolifyImageFor(key, image, tag) {
51
+ if (tag !== VERSIONS[key]) {
52
+ return { docker_registry_image_name: image, docker_registry_image_tag: tag };
53
+ }
54
+ return {
55
+ docker_registry_image_name: `${image}@sha256`,
56
+ docker_registry_image_tag: DIGESTS[key].replace(/^sha256:/, ''),
57
+ };
49
58
  }
50
59
  /**
51
60
  * Tag spellings that resolve to whatever the registry currently has, not a
@@ -1,7 +1,7 @@
1
1
  import { AsyncLocalStorage } from 'node:async_hooks';
2
2
  import { randomBytes, randomUUID } from 'node:crypto';
3
3
  import { URL } from 'node:url';
4
- import { pinnedTagFor } from '../bootstrap/versions.js';
4
+ import { coolifyImageFor } from '../bootstrap/versions.js';
5
5
  import { redactSecrets } from '../calls-sfu-deploy-support.js';
6
6
  import { resolveCallsSfuUrls } from '../calls-sfu.js';
7
7
  import { APP_ENTRY_KEY, appEntry, filesCollectionEnvName, ownerMailboxRecorded, ownerMailboxes, ownsServices, sharedSecretRef, } from '../org.js';
@@ -3870,8 +3870,7 @@ export class FoundryStepExecutor {
3870
3870
  server_uuid: server.uuid,
3871
3871
  environment_name: environment.name,
3872
3872
  environment_uuid: environment.uuid,
3873
- docker_registry_image_name: SYNAPSE_IMAGE,
3874
- docker_registry_image_tag: pinnedTagFor('synapse', synapseTag),
3873
+ ...coolifyImageFor('synapse', SYNAPSE_IMAGE, synapseTag),
3875
3874
  ports_exposes: '8008',
3876
3875
  name: names.synapse,
3877
3876
  description: `Synapse for ${org.slug}'s calls stack (${SYNAPSE_IMAGE}:${synapseTag})`,
@@ -1,4 +1,4 @@
1
- import { pinnedTagFor } from '../bootstrap/versions.js';
1
+ import { coolifyImageFor } from '../bootstrap/versions.js';
2
2
  import { mintLivekitCredentials } from '../calls-sfu-keys.js';
3
3
  import { LIVEKIT_SIGNALLING_PORT, sfuSlotPorts } from '../calls-sfu.js';
4
4
  import { ensureCloudflaredConnector } from './cloudflared-connector.js';
@@ -105,8 +105,7 @@ export async function provisionSfuApp(scope, deps, target, input) {
105
105
  server_uuid: server.uuid,
106
106
  environment_name: environment.name,
107
107
  environment_uuid: environment.uuid,
108
- docker_registry_image_name: OWN_SFU_IMAGE,
109
- docker_registry_image_tag: pinnedTagFor('livekit', input.version),
108
+ ...coolifyImageFor('livekit', OWN_SFU_IMAGE, input.version),
110
109
  ports_exposes: String(LIVEKIT_SIGNALLING_PORT),
111
110
  ports_mappings: sfuPortsMappings(input.slot),
112
111
  name: target.names.sfuApp,
@@ -122,7 +121,7 @@ export async function provisionSfuApp(scope, deps, target, input) {
122
121
  // Set on every run: a declared version or slot reaches an existing app here.
123
122
  await coolify.updateApplication(appId, {
124
123
  custom_internal_name: target.internal.sfu,
125
- docker_registry_image_tag: pinnedTagFor('livekit', input.version),
124
+ ...coolifyImageFor('livekit', OWN_SFU_IMAGE, input.version),
126
125
  ports_exposes: String(LIVEKIT_SIGNALLING_PORT),
127
126
  ports_mappings: sfuPortsMappings(input.slot),
128
127
  ...healthCheckSettings('/', LIVEKIT_SIGNALLING_PORT),
@@ -1,7 +1,7 @@
1
1
  import { createHash, createPrivateKey, generateKeyPairSync, randomBytes, randomUUID, sign, } from 'node:crypto';
2
2
  import { isIPv4 } from 'node:net';
3
3
  import { applyObjects, openInstance, platformMailSettingsObjects } from '@wtfalch/email/postmaster';
4
- import { VERSIONS, floatingTagBlocked, pinnedRef, pinnedTagFor } from '../bootstrap/versions.js';
4
+ import { VERSIONS, coolifyImageFor, floatingTagBlocked, pinnedRef } from '../bootstrap/versions.js';
5
5
  import { redactSecrets } from '../calls-sfu-deploy-support.js';
6
6
  import { ownerMailboxes } from '../org.js';
7
7
  import { BOULE_BRIDGE_SECRET_ENV, BOULE_PEER_PASSWORD_ENV, BOULE_PEER_ROLE, bouleHostnameFor, } from './boule.js';
@@ -2539,8 +2539,7 @@ export async function provisionMailServer(scope, deps, target, input) {
2539
2539
  server_uuid: server.uuid,
2540
2540
  environment_name: environment.name,
2541
2541
  environment_uuid: environment.uuid,
2542
- docker_registry_image_name: STALWART_IMAGE,
2543
- docker_registry_image_tag: pinnedTagFor('stalwart', imageTag),
2542
+ ...coolifyImageFor('stalwart', STALWART_IMAGE, imageTag),
2544
2543
  ports_exposes: STALWART_PORTS_EXPOSES,
2545
2544
  ...(hostPorts ? { ports_mappings: hostPorts } : {}),
2546
2545
  name: target.names.mailApp,
@@ -2560,7 +2559,7 @@ export async function provisionMailServer(scope, deps, target, input) {
2560
2559
  // `'ready'` probe below. Stalwart's own readiness route and HTTP port.
2561
2560
  await deps.coolify.updateApplication(appId, {
2562
2561
  custom_internal_name: target.internal.mail,
2563
- docker_registry_image_tag: pinnedTagFor('stalwart', imageTag),
2562
+ ...coolifyImageFor('stalwart', STALWART_IMAGE, imageTag),
2564
2563
  ...healthCheckSettings(STALWART_READY_PATH, Number(STALWART_HTTP_PORT)),
2565
2564
  // Only a platform that uses the shared relay, or one that did, changes a published port.
2566
2565
  ...(portsChanged ? { ports_mappings: hostPorts } : {}),
@@ -7263,8 +7262,7 @@ async function provisionPlatformHc(context, deps) {
7263
7262
  server_uuid: server.uuid,
7264
7263
  environment_name: environment.name,
7265
7264
  environment_uuid: environment.uuid,
7266
- docker_registry_image_name: HC_IMAGE,
7267
- docker_registry_image_tag: pinnedTagFor('hc', gitRef),
7265
+ ...coolifyImageFor('hc', HC_IMAGE, gitRef),
7268
7266
  ports_exposes: HC_PORT,
7269
7267
  name: PLATFORM_HC_APP_NAME,
7270
7268
  description: `Healthchecks for the platform's own heartbeats (#540, ${HC_IMAGE}:${gitRef})`,
@@ -7277,7 +7275,7 @@ async function provisionPlatformHc(context, deps) {
7277
7275
  // own rule. The image tag too, so a declared release change reaches the app.
7278
7276
  await deps.coolify.updateApplication(appId, {
7279
7277
  custom_internal_name: HC_INTERNAL_NAME,
7280
- docker_registry_image_tag: pinnedTagFor('hc', gitRef),
7278
+ ...coolifyImageFor('hc', HC_IMAGE, gitRef),
7281
7279
  ...healthCheckSettings(HC_HEALTH_CHECK_PATH, Number(HC_PORT)),
7282
7280
  });
7283
7281
  // ---- env, parsed off the database's own owner credentials -----------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/foundry",
3
- "version": "0.36.0",
3
+ "version": "0.36.1",
4
4
  "description": "Foundry's SDK: the declared org's types, the plan and apply contracts, and the state store's interface.",
5
5
  "repository": {
6
6
  "type": "git",