-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial Emails service * Fix yarn.lock * Metrics * Fixes
- Loading branch information
1 parent
52969c0
commit d02f9ef
Showing
46 changed files
with
1,881 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import * as pulumi from '@pulumi/pulumi'; | ||
import * as azure from '@pulumi/azure'; | ||
import { RemoteArtifactAsServiceDeployment } from '../utils/remote-artifact-as-service'; | ||
import { DeploymentEnvironment } from '../types'; | ||
import { Redis } from './redis'; | ||
import { PackageHelper } from '../utils/pack'; | ||
|
||
const commonConfig = new pulumi.Config('common'); | ||
const commonEnv = commonConfig.requireObject<Record<string, string>>('env'); | ||
|
||
export type Emails = ReturnType<typeof deployEmails>; | ||
|
||
export function deployEmails({ | ||
storageContainer, | ||
packageHelper, | ||
deploymentEnv, | ||
redis, | ||
heartbeat, | ||
email, | ||
}: { | ||
storageContainer: azure.storage.Container; | ||
packageHelper: PackageHelper; | ||
deploymentEnv: DeploymentEnvironment; | ||
redis: Redis; | ||
heartbeat?: string; | ||
email: { | ||
token: pulumi.Output<string>; | ||
from: string; | ||
messageStream: string; | ||
}; | ||
}) { | ||
return new RemoteArtifactAsServiceDeployment( | ||
'emails-service', | ||
{ | ||
storageContainer, | ||
env: { | ||
...deploymentEnv, | ||
...commonEnv, | ||
HEARTBEAT_ENDPOINT: heartbeat ?? '', | ||
METRICS_ENABLED: 'true', | ||
RELEASE: packageHelper.currentReleaseId(), | ||
REDIS_HOST: redis.config.host, | ||
REDIS_PORT: String(redis.config.port), | ||
REDIS_PASSWORD: redis.config.password, | ||
BULLMQ_COMMANDS_FROM_ROOT: 'true', | ||
EMAIL_PROVIDER: 'postmark', | ||
EMAIL_FROM: email.from, | ||
POSTMARK_TOKEN: email.token, | ||
POSTMARK_MESSAGE_STREAM: email.messageStream, | ||
}, | ||
readinessProbe: '/_readiness', | ||
livenessProbe: '/_health', | ||
exposesMetrics: true, | ||
packageInfo: packageHelper.npmPack('@hive/emails'), | ||
replicas: 1, | ||
}, | ||
[redis.deployment, redis.service] | ||
).deploy(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
npm install -g file:emails.tgz | ||
emails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as utils from 'dockest/test-helper'; | ||
import axios from 'axios'; | ||
|
||
const emailsAddress = utils.getServiceAddress('emails', 3011); | ||
|
||
export interface Email { | ||
to: string; | ||
subject: string; | ||
body: string; | ||
} | ||
|
||
export async function history() { | ||
const res = await axios.get<Email[]>(`http://${emailsAddress}/_history`, { | ||
responseType: 'json', | ||
}); | ||
|
||
return res.data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.