mirror of
https://github.com/graphql-hive/console
synced 2026-05-23 00:58:36 +00:00
* Use 5432 as default port of pg * Fix ssl * fix: only set heartbeat env variable if heartbeat is enabled (#446) * fix: only set heartbeat env variable if heartbeat is enabled * fix: default port Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com> * POSTGRES_SSL everywhere * oh come on * Fix Kafka connection * Fix DOCS_URL * Fix docs url * But I can feel your heartbeat I can feel your heartbeat (he said to me) 'I can feel your heartbeat' (running through me) Feel your heartbeat She said, 'I can feel your heartbeat' (she said to me) 'I can feel your heartbeat' (she said to me) 'I can feel your heartbeat' (running through me) Your heartbeat, feel your heartbeat * Your heartbeat, your heartbeat Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
55 lines
2.1 KiB
TypeScript
55 lines
2.1 KiB
TypeScript
import * as pulumi from '@pulumi/pulumi';
|
|
import * as azure from '@pulumi/azure';
|
|
import { parse } from 'pg-connection-string';
|
|
import { DbMigrations } from './db-migrations';
|
|
import { RemoteArtifactAsServiceDeployment } from '../utils/remote-artifact-as-service';
|
|
import { DeploymentEnvironment } from '../types';
|
|
import { PackageHelper } from '../utils/pack';
|
|
const commonConfig = new pulumi.Config('common');
|
|
const apiConfig = new pulumi.Config('api');
|
|
|
|
const commonEnv = commonConfig.requireObject<Record<string, string>>('env');
|
|
|
|
export type Tokens = ReturnType<typeof deployTokens>;
|
|
|
|
export function deployTokens({
|
|
deploymentEnv,
|
|
dbMigrations,
|
|
storageContainer,
|
|
packageHelper,
|
|
heartbeat,
|
|
}: {
|
|
storageContainer: azure.storage.Container;
|
|
packageHelper: PackageHelper;
|
|
deploymentEnv: DeploymentEnvironment;
|
|
dbMigrations: DbMigrations;
|
|
heartbeat?: string;
|
|
}) {
|
|
const rawConnectionString = apiConfig.requireSecret('postgresConnectionString');
|
|
const connectionString = rawConnectionString.apply(rawConnectionString => parse(rawConnectionString));
|
|
|
|
return new RemoteArtifactAsServiceDeployment(
|
|
'tokens-service',
|
|
{
|
|
storageContainer,
|
|
readinessProbe: '/_readiness',
|
|
livenessProbe: '/_health',
|
|
exposesMetrics: true,
|
|
packageInfo: packageHelper.npmPack('@hive/tokens'),
|
|
env: {
|
|
...deploymentEnv,
|
|
...commonEnv,
|
|
SENTRY: commonEnv.SENTRY_ENABLED,
|
|
POSTGRES_HOST: connectionString.apply(connection => connection.host ?? ''),
|
|
POSTGRES_PORT: connectionString.apply(connection => connection.port ?? '5432'),
|
|
POSTGRES_PASSWORD: connectionString.apply(connection => connection.password ?? ''),
|
|
POSTGRES_USER: connectionString.apply(connection => connection.user ?? ''),
|
|
POSTGRES_DB: connectionString.apply(connection => connection.database ?? ''),
|
|
POSTGRES_SSL: connectionString.apply(connection => (connection.ssl ? '1' : '0')),
|
|
RELEASE: packageHelper.currentReleaseId(),
|
|
HEARTBEAT_ENDPOINT: heartbeat ?? '',
|
|
},
|
|
},
|
|
[dbMigrations]
|
|
).deploy();
|
|
}
|