GeezerVison is showing github.com — Added extraCACerts config to help with self signed/private ca cert chain · triggerdotdev/trigger.dev@9611fa8
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/cli-v3/src/Containerfile.prod +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -43,12 +43,14 @@ ARG TRIGGER_DEPLOYMENT_ID | 43 | 43 | ARG TRIGGER_DEPLOYMENT_VERSION | 44 | 44 | ARG TRIGGER_CONTENT_HASH | 45 | 45 | ARG TRIGGER_PROJECT_REF | | 46 | +ARG NODE_EXTRA_CA_CERTS | 46 | 47 |
| 47 | 48 | ENV TRIGGER_PROJECT_ID=${TRIGGER_PROJECT_ID} \ | 48 | 49 | TRIGGER_DEPLOYMENT_ID=${TRIGGER_DEPLOYMENT_ID} \ | 49 | 50 | TRIGGER_DEPLOYMENT_VERSION=${TRIGGER_DEPLOYMENT_VERSION} \ | 50 | 51 | TRIGGER_CONTENT_HASH=${TRIGGER_CONTENT_HASH} \ | 51 | 52 | TRIGGER_PROJECT_REF=${TRIGGER_PROJECT_REF} \ | | 53 | + NODE_EXTRA_CA_CERTS=${NODE_EXTRA_CA_CERTS} \ | 52 | 54 | NODE_ENV=production | 53 | 55 |
| 54 | 56 | USER node | |
Collapse file Copy file name to clipboardExpand all lines: packages/cli-v3/src/commands/deploy.ts +11Lines changed: 11 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -304,6 +304,7 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) { | 304 | 304 | pushImage: options.push, | 305 | 305 | selfHostedRegistry: !!options.registry, | 306 | 306 | noCache: options.noCache, | | 307 | + extraCACerts: resolvedConfig.config.extraCACerts?.replace(/^\./,"/app") ?? "", | 307 | 308 | }); | 308 | 309 | } | 309 | 310 |
| @@ -330,6 +331,7 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) { | 330 | 331 | loadImage: options.loadImage, | 331 | 332 | buildPlatform: options.buildPlatform, | 332 | 333 | noCache: options.noCache, | | 334 | + extraCACerts: resolvedConfig.config.extraCACerts?.replace(/^\./,"/app") ?? "", | 333 | 335 | }, | 334 | 336 | deploymentSpinner | 335 | 337 | ); | @@ -779,6 +781,7 @@ type BuildAndPushImageOptions = { | 779 | 781 | loadImage: boolean; | 780 | 782 | buildPlatform: string; | 781 | 783 | noCache: boolean; | | 784 | + extraCACerts: string; | 782 | 785 | }; | 783 | 786 |
| 784 | 787 | type BuildAndPushImageResults = | @@ -837,6 +840,8 @@ async function buildAndPushImage( | 837 | 840 | `TRIGGER_CONTENT_HASH=${options.contentHash}`, | 838 | 841 | "--build-arg", | 839 | 842 | `TRIGGER_PROJECT_REF=${options.projectRef}`, | | 843 | + "--build-arg", | | 844 | + `NODE_EXTRA_CA_CERTS=${options.extraCACerts}`, | 840 | 845 | "-t", | 841 | 846 | `${options.registryHost}/${options.imageTag}`, | 842 | 847 | ".", | @@ -961,6 +966,8 @@ async function buildAndPushSelfHostedImage( | 961 | 966 | `TRIGGER_CONTENT_HASH=${options.contentHash}`, | 962 | 967 | "--build-arg", | 963 | 968 | `TRIGGER_PROJECT_REF=${options.projectRef}`, | | 969 | + "--build-arg", | | 970 | + `NODE_EXTRA_CA_CERTS=${options.extraCACerts}`, | 964 | 971 | "-t", | 965 | 972 | imageRef, | 966 | 973 | ".", // The build context | @@ -1821,6 +1828,10 @@ export async function copyAdditionalFiles( | 1821 | 1828 | tempDir: string | 1822 | 1829 | ): Promise<AdditionalFilesReturn> { | 1823 | 1830 | const additionalFiles = config.additionalFiles ?? []; | | 1831 | + const extraCACerts = config.extraCACerts ?? ''; | | 1832 | + if (extraCACerts) { | | 1833 | + additionalFiles.push(extraCACerts); | | 1834 | + } | 1824 | 1835 | const noMatches: string[] = []; | 1825 | 1836 |
| 1826 | 1837 | if (additionalFiles.length === 0) { | |
Collapse file Copy file name to clipboardExpand all lines: packages/cli-v3/src/workers/prod/entry-point.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1485,6 +1485,7 @@ function gatherProcessEnv() { | 1485 | 1485 | TERM: process.env.TERM, | 1486 | 1486 | NODE_PATH: process.env.NODE_PATH, | 1487 | 1487 | HOME: process.env.HOME, | | 1488 | + NODE_EXTRA_CA_CERTS: process.env.NODE_EXTRA_CA_CERTS, | 1488 | 1489 | }; | 1489 | 1490 |
| 1490 | 1491 | // Filter out undefined values | |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/v3/schemas/schemas.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -206,6 +206,7 @@ export const Config = z.object({ | 206 | 206 | logLevel: z.string().optional(), | 207 | 207 | enableConsoleLogging: z.boolean().optional(), | 208 | 208 | postInstall: z.string().optional(), | | 209 | + extraCACerts: z.string().optional(), | 209 | 210 | }); | 210 | 211 |
| 211 | 212 | export type Config = z.infer<typeof Config>; | |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/v3/types/config.ts +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -82,4 +82,13 @@ export interface ProjectConfig { | 82 | 82 | * @example "prisma generate" | 83 | 83 | */ | 84 | 84 | postInstall?: string; | | 85 | + | | 86 | + /** | | 87 | + * CA Cert file to be added to NODE_EXTRA_CA_CERT environment variable in, useful in use with self signed cert in the trigger.dev environment. | | 88 | + * | | 89 | + * @example "./certs/ca.crt" | | 90 | + * Note: must start with "./" and be relative to the project root. | | 91 | + * | | 92 | + */ | | 93 | + extraCACerts?: string; | 85 | 94 | } |
|