-
Notifications
You must be signed in to change notification settings - Fork 0
/
chart.ts
61 lines (57 loc) · 1.65 KB
/
chart.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { Construct } from "constructs";
import {
BackgroundWorker,
createDockerHubSecretFromEnv,
getDockerTag,
ResqueWeb,
TalisChart,
TalisChartProps,
} from "../../lib";
import { Quantity } from "../../imports/k8s";
export class BackgroundWorkerChart extends TalisChart {
constructor(scope: Construct, props: TalisChartProps) {
const release = getDockerTag("RELEASE", props.environment, "v1.0");
super(scope, { app: "worker", release, ...props });
const redisUrl = "redis.cache.svc.cluster.local:6379:1";
const dockerHubSecret = createDockerHubSecretFromEnv(this);
new ResqueWeb(this, "resque", {
externalUrl: "https://resque.example.com",
tlsDomain: "*.example.com",
imagePullSecrets: [{ name: dockerHubSecret.name }],
env: [
{
name: "RAILS_RESQUE_REDIS",
value: redisUrl,
},
],
});
new BackgroundWorker(this, "php-worker-example", {
image: `docker.io/organization/my-app:worker-${release}`,
imagePullSecrets: [{ name: dockerHubSecret.name }],
release,
command: ["php", "vendor/resque/php-resque/bin/resque"],
stopSignal: "QUIT",
terminationGracePeriodSeconds: 300,
env: [
{
name: "WORKER_NUM",
valueFrom: { fieldRef: { fieldPath: "metadata.name" } },
},
{
name: "REDIS_BACKEND",
value: redisUrl,
},
{
name: "QUEUE",
value: "my-app:example:jobs",
},
],
resources: {
requests: {
cpu: Quantity.fromString("50m"),
memory: Quantity.fromString("100Mi"),
},
},
});
}
}