Add DEPLOY_REGISTRY_HOST to allow configuring the deploy registry via the server
This commit is contained in:
@@ -55,6 +55,7 @@ COORDINATOR_SECRET=coordinator-secret # generate the actual secret with `openssl
|
||||
# ENABLE_REGISTRY_PROXY=true
|
||||
# DEPOT_TOKEN=<Depot org token>
|
||||
# DEPOT_PROJECT_ID=<Depot project id>
|
||||
# DEPLOY_REGISTRY_HOST=${APP_ORIGIN} # This is the host that the deploy CLI will use to push images to the registry
|
||||
# CONTAINER_REGISTRY_ORIGIN=<Container registry origin e.g. https://registry.digitalocean.com>
|
||||
# CONTAINER_REGISTRY_USERNAME=<Container registry username e.g. Digital ocean email address>
|
||||
# CONTAINER_REGISTRY_PASSWORD=<Container registry password e.g. Digital ocean PAT>
|
||||
@@ -81,6 +81,7 @@ const EnvironmentSchema = z.object({
|
||||
CONTAINER_REGISTRY_ORIGIN: z.string().optional(),
|
||||
CONTAINER_REGISTRY_USERNAME: z.string().optional(),
|
||||
CONTAINER_REGISTRY_PASSWORD: z.string().optional(),
|
||||
DEPLOY_REGISTRY_HOST: z.string().optional(),
|
||||
});
|
||||
|
||||
export type Environment = z.infer<typeof EnvironmentSchema>;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { ActionFunctionArgs, json } from "@remix-run/server-runtime";
|
||||
import { InitializeDeploymentRequestBody } from "@trigger.dev/core/v3";
|
||||
import { InitializeDeploymentRequestBody, InitializeDeploymentResponseBody } from "@trigger.dev/core/v3";
|
||||
import { env } from "~/env.server";
|
||||
import { authenticateApiRequest } from "~/services/apiAuth.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
import { InitializeDeploymentService } from "~/v3/services/initializeDeployment.server";
|
||||
@@ -31,15 +32,18 @@ export async function action({ request, params }: ActionFunctionArgs) {
|
||||
|
||||
const { deployment, imageTag } = await service.call(authenticatedEnv, body.data);
|
||||
|
||||
const responseBody: InitializeDeploymentResponseBody = {
|
||||
id: deployment.friendlyId,
|
||||
contentHash: deployment.contentHash,
|
||||
shortCode: deployment.shortCode,
|
||||
version: deployment.version,
|
||||
externalBuildData: deployment.externalBuildData as InitializeDeploymentResponseBody["externalBuildData"],
|
||||
imageTag,
|
||||
registryHost: env.DEPLOY_REGISTRY_HOST
|
||||
}
|
||||
|
||||
return json(
|
||||
{
|
||||
id: deployment.friendlyId,
|
||||
contentHash: deployment.contentHash,
|
||||
shortCode: deployment.shortCode,
|
||||
version: deployment.version,
|
||||
externalBuildData: deployment.externalBuildData,
|
||||
imageTag,
|
||||
},
|
||||
responseBody,
|
||||
{ status: 200 }
|
||||
);
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
|
||||
const deploymentSpinner = spinner();
|
||||
|
||||
deploymentSpinner.start(`Deploying version ${version}`);
|
||||
const registryHost = new URL(deploymentEnv.data.apiUrl).host;
|
||||
const registryHost = deploymentResponse.data.registryHost ?? options.registry ?? "registry.trigger.dev";
|
||||
|
||||
const buildImage = async () => {
|
||||
if (options.selfHosted) {
|
||||
|
||||
@@ -141,6 +141,7 @@ export const InitializeDeploymentResponseBody = z.object({
|
||||
version: z.string(),
|
||||
imageTag: z.string(),
|
||||
externalBuildData: ExternalBuildData.optional().nullable(),
|
||||
registryHost: z.string().optional(),
|
||||
});
|
||||
|
||||
export type InitializeDeploymentResponseBody = z.infer<typeof InitializeDeploymentResponseBody>;
|
||||
|
||||
Reference in New Issue
Block a user