Skip to content

Commit 67cac97

Browse files
committed
Add DEPLOY_REGISTRY_HOST to allow configuring the deploy registry via the server
1 parent 0f32dee commit 67cac97

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ COORDINATOR_SECRET=coordinator-secret # generate the actual secret with `openssl
5555
# ENABLE_REGISTRY_PROXY=true
5656
# DEPOT_TOKEN=<Depot org token>
5757
# DEPOT_PROJECT_ID=<Depot project id>
58+
# DEPLOY_REGISTRY_HOST=${APP_ORIGIN} # This is the host that the deploy CLI will use to push images to the registry
5859
# CONTAINER_REGISTRY_ORIGIN=<Container registry origin e.g. https://registry.digitalocean.com>
5960
# CONTAINER_REGISTRY_USERNAME=<Container registry username e.g. Digital ocean email address>
6061
# CONTAINER_REGISTRY_PASSWORD=<Container registry password e.g. Digital ocean PAT>

apps/webapp/app/env.server.ts

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const EnvironmentSchema = z.object({
8181
CONTAINER_REGISTRY_ORIGIN: z.string().optional(),
8282
CONTAINER_REGISTRY_USERNAME: z.string().optional(),
8383
CONTAINER_REGISTRY_PASSWORD: z.string().optional(),
84+
DEPLOY_REGISTRY_HOST: z.string().optional(),
8485
});
8586

8687
export type Environment = z.infer<typeof EnvironmentSchema>;

apps/webapp/app/routes/api.v1.deployments.ts

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ActionFunctionArgs, json } from "@remix-run/server-runtime";
2-
import { InitializeDeploymentRequestBody } from "@trigger.dev/core/v3";
2+
import { InitializeDeploymentRequestBody, InitializeDeploymentResponseBody } from "@trigger.dev/core/v3";
3+
import { env } from "~/env.server";
34
import { authenticateApiRequest } from "~/services/apiAuth.server";
45
import { logger } from "~/services/logger.server";
56
import { InitializeDeploymentService } from "~/v3/services/initializeDeployment.server";
@@ -31,15 +32,18 @@ export async function action({ request, params }: ActionFunctionArgs) {
3132

3233
const { deployment, imageTag } = await service.call(authenticatedEnv, body.data);
3334

35+
const responseBody: InitializeDeploymentResponseBody = {
36+
id: deployment.friendlyId,
37+
contentHash: deployment.contentHash,
38+
shortCode: deployment.shortCode,
39+
version: deployment.version,
40+
externalBuildData: deployment.externalBuildData as InitializeDeploymentResponseBody["externalBuildData"],
41+
imageTag,
42+
registryHost: env.DEPLOY_REGISTRY_HOST
43+
}
44+
3445
return json(
35-
{
36-
id: deployment.friendlyId,
37-
contentHash: deployment.contentHash,
38-
shortCode: deployment.shortCode,
39-
version: deployment.version,
40-
externalBuildData: deployment.externalBuildData,
41-
imageTag,
42-
},
46+
responseBody,
4347
{ status: 200 }
4448
);
4549
}

packages/cli-v3/src/commands/deploy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
228228
const deploymentSpinner = spinner();
229229

230230
deploymentSpinner.start(`Deploying version ${version}`);
231-
const registryHost = new URL(deploymentEnv.data.apiUrl).host;
231+
const registryHost = deploymentResponse.data.registryHost ?? options.registry ?? "registry.trigger.dev";
232232

233233
const buildImage = async () => {
234234
if (options.selfHosted) {

packages/core/src/v3/schemas/api.ts

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export const InitializeDeploymentResponseBody = z.object({
141141
version: z.string(),
142142
imageTag: z.string(),
143143
externalBuildData: ExternalBuildData.optional().nullable(),
144+
registryHost: z.string().optional(),
144145
});
145146

146147
export type InitializeDeploymentResponseBody = z.infer<typeof InitializeDeploymentResponseBody>;

0 commit comments

Comments
 (0)