console/deployment/services/proxy.ts
renovate[bot] 1afe0ec73a
Update dependency @theguild/prettier-config to v1 (#676)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com>
2022-11-24 10:00:41 +00:00

97 lines
2.1 KiB
TypeScript

import * as pulumi from '@pulumi/pulumi';
import { Proxy } from '../utils/reverse-proxy';
import { CertManager } from '../utils/cert-manager';
import { GraphQL } from './graphql';
import { LandingPage } from './landing-page';
import { App } from './app';
import { Usage } from './usage';
import { Docs } from './docs';
const commonConfig = new pulumi.Config('common');
export function deployProxy({
appHostname,
docsHostname,
rootDns,
graphql,
app,
docs,
usage,
landingPage,
}: {
appHostname: string;
docsHostname: string;
rootDns: string;
graphql: GraphQL;
app: App;
usage: Usage;
docs: Docs;
landingPage: LandingPage;
}) {
const { tlsIssueName } = new CertManager().deployCertManagerAndIssuer();
return new Proxy(tlsIssueName, {
address: commonConfig.get('staticIp'),
})
.deployProxy({ replicas: 2 })
.registerService({ record: rootDns, apex: true }, [
{
name: 'landing-page',
path: '/',
service: landingPage.service,
},
])
.registerService(
{
record: docsHostname,
},
[
{
name: 'docs',
path: '/',
service: docs.service,
},
],
)
.registerService({ record: appHostname }, [
{
name: 'app',
path: '/',
service: app.service,
},
{
name: 'server',
path: '/server',
service: graphql.service,
timeoutInSeconds: 60,
},
{
name: 'registry-api-health',
path: '/registry/_health',
customRewrite: '/_health',
service: graphql.service,
},
{
name: 'registry-api',
path: '/registry',
customRewrite: '/graphql',
service: graphql.service,
timeoutInSeconds: 60,
retryOnReset: true,
},
{
name: 'graphql-api',
path: '/graphql',
customRewrite: '/graphql',
service: graphql.service,
timeoutInSeconds: 60,
retryOnReset: true,
},
{
name: 'usage',
path: '/usage',
service: usage.service,
retryOnReset: true,
},
])
.get();
}