@wtfalch/foundry 0.22.2 → 0.22.3

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/plan/diff.js CHANGED
@@ -9,7 +9,7 @@ import { planFilesKeys } from './entry-files-key.js';
9
9
  import { appHostname, entryHostnames, tunnelDnsHostnames, tunnelDomainList } from './hostnames.js';
10
10
  import { LOGIN_BINDING_SCOPE_KEY, companyLoginTunnelHost, loginBindingState, loginHostClientIds, loginHostnameFor, pendingRemovalHosts, } from './login-host.js';
11
11
  import { MAIL_COPY_COMPLETED_SCOPE_KEY, MAIL_COPY_DONE_SCOPE_KEY, parseMailCopyCompleted, } from './mail-copy.js';
12
- import { CALLS_MAS_APPLIED_IMAGE_TAG_SCOPE_KEY, CALLS_SYNAPSE_APPLIED_IMAGE_TAG_SCOPE_KEY, ORG_MAIL_APPLIED_APEX_SCOPE_KEY, ORG_MAIL_APPLIED_HOST_SCOPE_KEY, ORG_MAIL_APPLIED_MODE_SCOPE_KEY, ORG_MAIL_APPLIED_USES_DOMAIN_SCOPE_KEY, appEnvAppliedScopeKey, appSettingsOf, appStepKey, appliedAppDomains, appliedAppSettings, dbEnvAppliedScopeKey, resolveAppEnv, serviceDbEnvAppliedScopeKey, versionNotAppliedLine, } from './platform-diff.js';
12
+ import { CALLS_MAS_APPLIED_IMAGE_TAG_SCOPE_KEY, CALLS_SYNAPSE_APPLIED_IMAGE_TAG_SCOPE_KEY, ORG_MAIL_APPLIED_APEX_SCOPE_KEY, ORG_MAIL_APPLIED_HOST_SCOPE_KEY, ORG_MAIL_APPLIED_MODE_SCOPE_KEY, ORG_MAIL_APPLIED_USES_DOMAIN_SCOPE_KEY, appEnvAppliedScopeKey, appFolderDiffers, appSettingsOf, appStepKey, appliedAppDomains, appliedAppSettings, dbEnvAppliedScopeKey, resolveAppEnv, serviceDbEnvAppliedScopeKey, versionNotAppliedLine, } from './platform-diff.js';
13
13
  import { DEFAULT_ORG_PLATFORM_READINESS, } from './platform-org.js';
14
14
  import { PLATFORM_AUTH_BROKER_MAIL_KEY_REF } from './platform-providers.js';
15
15
  import { appLabelsAppliedScopeKey, entryLabelHash, entryLabelSpec } from './proxy-labels.js';
@@ -2229,7 +2229,7 @@ function planApp(org, entryKey, byKey, claimed, recordedIds, plannedSteps, authI
2229
2229
  key: blockedKey('port'),
2230
2230
  });
2231
2231
  }
2232
- if (want.folder !== have.folder ||
2232
+ if (appFolderDiffers(want, have) ||
2233
2233
  want.autoDeploy !== have.autoDeploy ||
2234
2234
  (want.port !== null && want.port !== have.port)) {
2235
2235
  return {
@@ -117,8 +117,6 @@ export interface CoolifyPort {
117
117
  ports_exposes?: string;
118
118
  /** `false` for an internal entry: Coolify makes no domain for it. */
119
119
  autogenerate_domain?: boolean;
120
- /** The folder a `static` entry serves (`HostingEntry.folder`). */
121
- publish_directory?: string;
122
120
  /** Whether a push to `git_branch` deploys (`HostingEntry.autoDeploy`). */
123
121
  is_auto_deploy_enabled?: boolean;
124
122
  /**
@@ -23,7 +23,7 @@ import { healthCheckSettings } from './health-check-settings.js';
23
23
  import { appHostname, coolifyTunnelDomains, entryHostnames, tunnelDnsHostnames, tunnelDomainList, tunnelIngressHostnames, } from './hostnames.js';
24
24
  import { LOGIN_BINDING_SCOPE_KEY, LOGIN_HOST_PENDING_REMOVAL_SCOPE_KEY, LOGIN_HOST_SHARED_SCOPE_KEY, customersEntryKeys, loginBindingState, loginHostClientIds, pendingRemovalHosts, pendingRemovalState, } from './login-host.js';
25
25
  import { MAIL_COPY_COMPLETED_SCOPE_KEY, MAIL_COPY_DONE_SCOPE_KEY, parseMailCopyCompleted, runMailCopyStep, } from './mail-copy.js';
26
- import { CALLS_MAS_APPLIED_IMAGE_TAG_SCOPE_KEY, CALLS_SYNAPSE_APPLIED_IMAGE_TAG_SCOPE_KEY, ORG_MAIL_APPLIED_APEX_SCOPE_KEY, ORG_MAIL_APPLIED_HOST_SCOPE_KEY, ORG_MAIL_APPLIED_MODE_SCOPE_KEY, ORG_MAIL_APPLIED_USES_DOMAIN_SCOPE_KEY, appDomainsAppliedScopeKey, appEnvAppliedScopeKey, appNameFor, appSettingsAppliedScopeKey, appSettingsOf, appStepKey, appliedAppDomains, appliedAppSettings, dbEnvAppliedScopeKey, resolveAppEnv, serviceDbEnvAppliedScopeKey, } from './platform-diff.js';
26
+ import { CALLS_MAS_APPLIED_IMAGE_TAG_SCOPE_KEY, CALLS_SYNAPSE_APPLIED_IMAGE_TAG_SCOPE_KEY, ORG_MAIL_APPLIED_APEX_SCOPE_KEY, ORG_MAIL_APPLIED_HOST_SCOPE_KEY, ORG_MAIL_APPLIED_MODE_SCOPE_KEY, ORG_MAIL_APPLIED_USES_DOMAIN_SCOPE_KEY, appDomainsAppliedScopeKey, appEnvAppliedScopeKey, appFolderDiffers, appNameFor, appSettingsAppliedScopeKey, appSettingsOf, appStepKey, appliedAppDomains, appliedAppSettings, dbEnvAppliedScopeKey, resolveAppEnv, serviceDbEnvAppliedScopeKey, } from './platform-diff.js';
27
27
  import { AUTH_LOGIN_PORT, PLATFORM_AUTH_BROKER_MAIL_KEY_REF, PLATFORM_AUTH_LOGIN_INTERNAL_NAME, } from './platform-providers.js';
28
28
  import { appLabelsAppliedScopeKey, entryLabelHash, entryLabelSpec, entryProxyLabels, sameLabelSets, } from './proxy-labels.js';
29
29
  import { entryWorkerAppliedScopeKey, entryWorkerExclusionsScopeKey, entryWorkerRetiredScopeKey, entryWorkerRouteIdScopeKey, entryWorkerRoutePatternScopeKey, entryWorkerRoutePendingScopeKey, entryWorkerRouteZoneScopeKey, entryWorkerUploadedScopeKey, } from './worker.js';
@@ -1789,7 +1789,6 @@ export class FoundryStepExecutor {
1789
1789
  const names = entryHostnames(org, entry);
1790
1790
  const wantDomains = tunnelDomainList(names);
1791
1791
  const isStatic = entry.buildPack === 'static';
1792
- const folderField = isStatic ? 'publish_directory' : 'base_directory';
1793
1792
  const settingsKey = appSettingsAppliedScopeKey(entry.key);
1794
1793
  const domainsKey = appDomainsAppliedScopeKey(entry.key);
1795
1794
  let haveDomains;
@@ -1833,7 +1832,10 @@ export class FoundryStepExecutor {
1833
1832
  // A static site is served by Coolify's own web server on port 80.
1834
1833
  ports_exposes: isStatic ? '80' : entry.port === null ? undefined : String(entry.port),
1835
1834
  is_auto_deploy_enabled: entry.autoDeploy,
1836
- [folderField]: entry.folder === null ? undefined : `/${entry.folder}`,
1835
+ // Also the folder a static entry serves: Coolify's static build
1836
+ // copies `base_directory`, and reads `publish_directory` only for a
1837
+ // built app.
1838
+ base_directory: entry.folder === null ? undefined : `/${entry.folder}`,
1837
1839
  // Only the shared standard app builds from this repo; a bespoke
1838
1840
  // app's Dockerfile is at its own repo's root.
1839
1841
  dockerfile_location: entry.repo ? undefined : DEFAULT_APP_DOCKERFILE,
@@ -1848,8 +1850,8 @@ export class FoundryStepExecutor {
1848
1850
  // difference again.
1849
1851
  const want = appSettingsOf(entry);
1850
1852
  const patch = {};
1851
- if (want.folder !== have.folder)
1852
- patch[folderField] = want.folder ? `/${want.folder}` : '/';
1853
+ if (appFolderDiffers(want, have))
1854
+ patch.base_directory = want.folder ? `/${want.folder}` : '/';
1853
1855
  if (want.port !== have.port && want.port !== null && !isStatic) {
1854
1856
  patch.ports_exposes = String(want.port);
1855
1857
  }
@@ -1904,7 +1906,6 @@ export class FoundryStepExecutor {
1904
1906
  await this.ports.coolify.updateApplication(appId, patch);
1905
1907
  // The container builds and listens from these only at its next deploy.
1906
1908
  const settingsNeedDeploy = Boolean(patch.base_directory ||
1907
- patch.publish_directory ||
1908
1909
  patch.ports_exposes ||
1909
1910
  patch.domains !== undefined ||
1910
1911
  patch.custom_internal_name ||
@@ -482,8 +482,17 @@ export interface AppSettings {
482
482
  folder: string | null;
483
483
  port: number | null;
484
484
  autoDeploy: boolean;
485
+ /**
486
+ * Set for a `static` entry whose folder is written as `base_directory`,
487
+ * the field Coolify's static build serves from. A static marker without it
488
+ * was written as `publish_directory`, which that build ignores (it served
489
+ * the repo root), so the app is patched and redeployed once.
490
+ */
491
+ staticFolderIn?: 'base_directory';
485
492
  }
486
493
  export declare function appSettingsOf(entry: HostingEntry): AppSettings;
494
+ /** Whether the app's folder is not yet where Coolify reads it: a changed folder, or a static one written to the old field. */
495
+ export declare function appFolderDiffers(want: AppSettings, have: AppSettings): boolean;
487
496
  /** What an app that predates the marker has: Coolify's own defaults, so it plans no change. */
488
497
  export declare const DEFAULT_APP_SETTINGS: AppSettings;
489
498
  export declare function appSettingsAppliedScopeKey(entryKey: string): string;
@@ -520,7 +520,17 @@ export function serviceDbEnvAppliedScopeKey(service) {
520
520
  return `service_db_env_applied.${service}`;
521
521
  }
522
522
  export function appSettingsOf(entry) {
523
- return { folder: entry.folder, port: entry.port, autoDeploy: entry.autoDeploy };
523
+ return {
524
+ folder: entry.folder,
525
+ port: entry.port,
526
+ autoDeploy: entry.autoDeploy,
527
+ ...(entry.buildPack === 'static' ? { staticFolderIn: 'base_directory' } : {}),
528
+ };
529
+ }
530
+ /** Whether the app's folder is not yet where Coolify reads it: a changed folder, or a static one written to the old field. */
531
+ export function appFolderDiffers(want, have) {
532
+ return (want.folder !== have.folder ||
533
+ (want.folder !== null && want.staticFolderIn !== have.staticFolderIn));
524
534
  }
525
535
  /** What an app that predates the marker has: Coolify's own defaults, so it plans no change. */
526
536
  export const DEFAULT_APP_SETTINGS = { folder: null, port: null, autoDeploy: true };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/foundry",
3
- "version": "0.22.2",
3
+ "version": "0.22.3",
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",