mirror of
https://github.com/graphql-hive/console
synced 2026-04-21 14:37:17 +00:00
63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
import * as k8s from '@pulumi/kubernetes';
|
|
import * as pulumi from '@pulumi/pulumi';
|
|
import { DeploymentEnvironment } from '../types';
|
|
import { serviceLocalEndpoint } from '../utils/local-endpoint';
|
|
import { ServiceDeployment } from '../utils/service-deployment';
|
|
import { Redis } from './redis';
|
|
|
|
const commonConfig = new pulumi.Config('common');
|
|
const commonEnv = commonConfig.requireObject<Record<string, string>>('env');
|
|
|
|
export type Emails = ReturnType<typeof deployEmails>;
|
|
|
|
export function deployEmails({
|
|
deploymentEnv,
|
|
redis,
|
|
heartbeat,
|
|
email,
|
|
release,
|
|
image,
|
|
imagePullSecret,
|
|
}: {
|
|
release: string;
|
|
image: string;
|
|
deploymentEnv: DeploymentEnvironment;
|
|
redis: Redis;
|
|
heartbeat?: string;
|
|
email: {
|
|
token: pulumi.Output<string>;
|
|
from: string;
|
|
messageStream: string;
|
|
};
|
|
imagePullSecret: k8s.core.v1.Secret;
|
|
}) {
|
|
const { deployment, service } = new ServiceDeployment(
|
|
'emails-service',
|
|
{
|
|
imagePullSecret,
|
|
env: {
|
|
...deploymentEnv,
|
|
...commonEnv,
|
|
SENTRY: commonEnv.SENTRY_ENABLED,
|
|
RELEASE: release,
|
|
REDIS_HOST: redis.config.host,
|
|
REDIS_PORT: String(redis.config.port),
|
|
REDIS_PASSWORD: redis.config.password,
|
|
BULLMQ_COMMANDS_FROM_ROOT: 'true',
|
|
EMAIL_FROM: email.from,
|
|
EMAIL_PROVIDER: 'postmark',
|
|
EMAIL_PROVIDER_POSTMARK_TOKEN: email.token,
|
|
EMAIL_PROVIDER_POSTMARK_MESSAGE_STREAM: email.messageStream,
|
|
HEARTBEAT_ENDPOINT: heartbeat ?? '',
|
|
},
|
|
readinessProbe: '/_readiness',
|
|
livenessProbe: '/_health',
|
|
exposesMetrics: true,
|
|
image,
|
|
replicas: 1,
|
|
},
|
|
[redis.deployment, redis.service],
|
|
).deploy();
|
|
|
|
return { deployment, service, localEndpoint: serviceLocalEndpoint(service) };
|
|
}
|