@wtfalch/foundry 0.76.0 → 0.76.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.
|
@@ -13,6 +13,17 @@ export declare const DESKTOP_AUTH_HOME = "desktop_auth";
|
|
|
13
13
|
export declare const DESKTOP_AUTH_REVISION_SCOPE_KEY = "coolify_desktop_auth_revision";
|
|
14
14
|
/** The Agora origin the app was last written for (CLAUDE.md rule 3: the applied hostname is a scope id). */
|
|
15
15
|
export declare const DESKTOP_AUTH_ORIGIN_SCOPE_KEY = "coolify_desktop_auth_origin";
|
|
16
|
+
/**
|
|
17
|
+
* The org's one shared Postgres server ({@link ORG_POSTGRES_SERVER_SCOPE_KEY}) that desktop-auth's
|
|
18
|
+
* `MESSAGING_DATABASE_URL`/`MESSAGING_DATABASE_URL_OWNER` were last written for. Those two env values
|
|
19
|
+
* are built from the server's live `internal_db_url` at apply time (`executor.ts`'s `serverHome`), so a
|
|
20
|
+
* server that is re-provisioned under a new Coolify resource is always picked up correctly *once this
|
|
21
|
+
* step actually runs* -- but {@link DESKTOP_AUTH_REVISION_SCOPE_KEY} hashes only `desktopAuthEnv`'s
|
|
22
|
+
* fields, which never include the database host. Without this scope key a server change that leaves
|
|
23
|
+
* every other input (issuer, client id, org id, project ids) unchanged never replans the step at all, and
|
|
24
|
+
* the app keeps restarting against a host that no longer exists (foundry#1112).
|
|
25
|
+
*/
|
|
26
|
+
export declare const DESKTOP_AUTH_DB_SERVER_SCOPE_KEY = "coolify_desktop_auth_db_server";
|
|
16
27
|
/** The callback URI last put on Agora's client, or `unsupported:<uri>` when the providers client cannot. */
|
|
17
28
|
export declare const DESKTOP_AUTH_REDIRECT_SCOPE_KEY = "coolify_desktop_auth_redirect";
|
|
18
29
|
/** Recorded once the readiness probe through Agora answered. */
|
|
@@ -43,10 +54,12 @@ export declare function desktopAuthEnv(inputs: DesktopAuthInputs, runtimeRole: s
|
|
|
43
54
|
export declare function desktopAuthRevision(env: Readonly<Record<string, string>>): string;
|
|
44
55
|
/**
|
|
45
56
|
* The `coolify:desktop-auth` step. Planned when the app is not recorded, when the env it was written for
|
|
46
|
-
* differs (a rename moves the origin), when
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
57
|
+
* differs (a rename moves the origin), when the org's Postgres server has changed since the env was last
|
|
58
|
+
* written (foundry#1112: the database host is not part of that revision, since it is built from a live
|
|
59
|
+
* Coolify read the plan itself cannot make), when it never ran healthy, when the callback URI is not on
|
|
60
|
+
* Agora's client, and when Agora carries the upstream but the readiness probe never answered. Not planned
|
|
61
|
+
* while Agora is blocked (its own line says why) or while the `desktop_auth` home cannot exist yet
|
|
62
|
+
* (blocked). `homePlanned` is true when the databases step in this plan creates the home.
|
|
50
63
|
*/
|
|
51
64
|
export declare function planDesktopAuth(org: DeclaredOrg, recorded: Readonly<Record<string, string>>, input: {
|
|
52
65
|
host: AgoraHostValues | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import { ORG_SERVICE_SCHEMAS, orgServiceDatabase } from '../org.js';
|
|
2
|
+
import { ORG_POSTGRES_SERVER_SCOPE_KEY, ORG_SERVICE_SCHEMAS, orgServiceDatabase, } from '../org.js';
|
|
3
3
|
import { AGORA_CLIENT_ID_SCOPE_KEY, DESKTOP_AUTH_APP_SCOPE_KEY, DESKTOP_AUTH_DEPLOYED_SCOPE_KEY, DESKTOP_AUTH_PORT, ZITADEL_ORG_SCOPE_KEY, agoraHostnameFor, desktopAuthInternalName, desktopAuthUpstream, withRecordedMessagingProject, } from './agora.js';
|
|
4
4
|
import { ZITADEL_FILES_PROJECT_SCOPE_KEY } from './core-files.js';
|
|
5
5
|
export { DESKTOP_AUTH_APP_SCOPE_KEY, DESKTOP_AUTH_DEPLOYED_SCOPE_KEY, DESKTOP_AUTH_PORT, desktopAuthInternalName, desktopAuthUpstream, };
|
|
@@ -14,6 +14,17 @@ export const DESKTOP_AUTH_HOME = 'desktop_auth';
|
|
|
14
14
|
export const DESKTOP_AUTH_REVISION_SCOPE_KEY = 'coolify_desktop_auth_revision';
|
|
15
15
|
/** The Agora origin the app was last written for (CLAUDE.md rule 3: the applied hostname is a scope id). */
|
|
16
16
|
export const DESKTOP_AUTH_ORIGIN_SCOPE_KEY = 'coolify_desktop_auth_origin';
|
|
17
|
+
/**
|
|
18
|
+
* The org's one shared Postgres server ({@link ORG_POSTGRES_SERVER_SCOPE_KEY}) that desktop-auth's
|
|
19
|
+
* `MESSAGING_DATABASE_URL`/`MESSAGING_DATABASE_URL_OWNER` were last written for. Those two env values
|
|
20
|
+
* are built from the server's live `internal_db_url` at apply time (`executor.ts`'s `serverHome`), so a
|
|
21
|
+
* server that is re-provisioned under a new Coolify resource is always picked up correctly *once this
|
|
22
|
+
* step actually runs* -- but {@link DESKTOP_AUTH_REVISION_SCOPE_KEY} hashes only `desktopAuthEnv`'s
|
|
23
|
+
* fields, which never include the database host. Without this scope key a server change that leaves
|
|
24
|
+
* every other input (issuer, client id, org id, project ids) unchanged never replans the step at all, and
|
|
25
|
+
* the app keeps restarting against a host that no longer exists (foundry#1112).
|
|
26
|
+
*/
|
|
27
|
+
export const DESKTOP_AUTH_DB_SERVER_SCOPE_KEY = 'coolify_desktop_auth_db_server';
|
|
17
28
|
/** The callback URI last put on Agora's client, or `unsupported:<uri>` when the providers client cannot. */
|
|
18
29
|
export const DESKTOP_AUTH_REDIRECT_SCOPE_KEY = 'coolify_desktop_auth_redirect';
|
|
19
30
|
/** Recorded once the readiness probe through Agora answered. */
|
|
@@ -85,10 +96,12 @@ function runtimeRoleFor(org) {
|
|
|
85
96
|
}
|
|
86
97
|
/**
|
|
87
98
|
* The `coolify:desktop-auth` step. Planned when the app is not recorded, when the env it was written for
|
|
88
|
-
* differs (a rename moves the origin), when
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
99
|
+
* differs (a rename moves the origin), when the org's Postgres server has changed since the env was last
|
|
100
|
+
* written (foundry#1112: the database host is not part of that revision, since it is built from a live
|
|
101
|
+
* Coolify read the plan itself cannot make), when it never ran healthy, when the callback URI is not on
|
|
102
|
+
* Agora's client, and when Agora carries the upstream but the readiness probe never answered. Not planned
|
|
103
|
+
* while Agora is blocked (its own line says why) or while the `desktop_auth` home cannot exist yet
|
|
104
|
+
* (blocked). `homePlanned` is true when the databases step in this plan creates the home.
|
|
92
105
|
*/
|
|
93
106
|
export function planDesktopAuth(org, recorded, input) {
|
|
94
107
|
if (!input.host)
|
|
@@ -114,6 +127,10 @@ export function planDesktopAuth(org, recorded, input) {
|
|
|
114
127
|
else {
|
|
115
128
|
if (revision && recorded[DESKTOP_AUTH_REVISION_SCOPE_KEY] !== revision)
|
|
116
129
|
reasons.push('env');
|
|
130
|
+
const dbServer = recorded[ORG_POSTGRES_SERVER_SCOPE_KEY];
|
|
131
|
+
if (dbServer && recorded[DESKTOP_AUTH_DB_SERVER_SCOPE_KEY] !== dbServer) {
|
|
132
|
+
reasons.push('database host changed');
|
|
133
|
+
}
|
|
117
134
|
if (!recorded[DESKTOP_AUTH_DEPLOYED_SCOPE_KEY])
|
|
118
135
|
reasons.push('never ran healthy');
|
|
119
136
|
if (redirect !== callback && !blocked)
|
package/dist/plan/executor.js
CHANGED
|
@@ -32,7 +32,7 @@ import { LOGIN_COOKIE_DOMAIN_SCOPE_KEY } from './cookie-domain.js';
|
|
|
32
32
|
import { previewsOn } from './coolify-previews.js';
|
|
33
33
|
import { CORE_FILES_COLLECTION_NAME, FILES_CORE_COLLECTION_SCOPE_KEY, ZITADEL_FILES_PROJECT_SCOPE_KEY, } from './core-files.js';
|
|
34
34
|
import { waitForDeploymentFinished, waitForHealthyVersion, waitForNewDeployment, } from './deploy-health.js';
|
|
35
|
-
import { DESKTOP_AUTH_APP_SCOPE_KEY, DESKTOP_AUTH_DEPLOYED_SCOPE_KEY, DESKTOP_AUTH_DOCKERFILE, DESKTOP_AUTH_HOME, DESKTOP_AUTH_ORIGIN_SCOPE_KEY, DESKTOP_AUTH_READY_PATH, DESKTOP_AUTH_READY_SCOPE_KEY, DESKTOP_AUTH_REDIRECT_SCOPE_KEY, DESKTOP_AUTH_REVISION_SCOPE_KEY, desktopAuthCallbackUri, desktopAuthEnv, desktopAuthInputs, desktopAuthRedirectUnsupported, desktopAuthRevision, } from './desktop-auth.js';
|
|
35
|
+
import { DESKTOP_AUTH_APP_SCOPE_KEY, DESKTOP_AUTH_DB_SERVER_SCOPE_KEY, DESKTOP_AUTH_DEPLOYED_SCOPE_KEY, DESKTOP_AUTH_DOCKERFILE, DESKTOP_AUTH_HOME, DESKTOP_AUTH_ORIGIN_SCOPE_KEY, DESKTOP_AUTH_READY_PATH, DESKTOP_AUTH_READY_SCOPE_KEY, DESKTOP_AUTH_REDIRECT_SCOPE_KEY, DESKTOP_AUTH_REVISION_SCOPE_KEY, desktopAuthCallbackUri, desktopAuthEnv, desktopAuthInputs, desktopAuthRedirectUnsupported, desktopAuthRevision, } from './desktop-auth.js';
|
|
36
36
|
import { desktopCallbackUri, signInCallbackAppliedValue, signInRedirectUris, unionRedirectUris, zitadelAppDesktopCallbackAppliedScopeKey, } from './desktop-callback.js';
|
|
37
37
|
import { PLATFORM_NETWORK, companyNetworkName, ensureDestination, findDestination, onPlatformNetwork, placed, placedByScope, placedOnPlatform, } from './destinations.js';
|
|
38
38
|
import { DEFAULT_AI_LIMIT_MICROS } from './diff.js';
|
|
@@ -7747,6 +7747,12 @@ export class FoundryStepExecutor {
|
|
|
7747
7747
|
await this.addDesktopAuthCallback(org, context, desktopAuthCallbackUri(inputs.origin));
|
|
7748
7748
|
context.recordScopeId(DESKTOP_AUTH_ORIGIN_SCOPE_KEY, inputs.origin);
|
|
7749
7749
|
context.recordScopeId(DESKTOP_AUTH_REVISION_SCOPE_KEY, desktopAuthRevision(env));
|
|
7750
|
+
// foundry#1112: the database host itself is not part of `env`'s revision (it comes from a live
|
|
7751
|
+
// Coolify read, not from `desktopAuthEnv`'s inputs), so the server this env was built against is
|
|
7752
|
+
// tracked here instead -- a later change replans this step even when nothing else drifted.
|
|
7753
|
+
const dbServerId = recorded[ORG_POSTGRES_SERVER_SCOPE_KEY];
|
|
7754
|
+
if (dbServerId)
|
|
7755
|
+
context.recordScopeId(DESKTOP_AUTH_DB_SERVER_SCOPE_KEY, dbServerId);
|
|
7750
7756
|
return { resourceId: app.appId };
|
|
7751
7757
|
}
|
|
7752
7758
|
/** Whether the org's running Agora carries `AGORA_DESKTOP_AUTH_UPSTREAM`, read from its live env. */
|