Skip to content

Commit 26c41bb

Browse files
committed
ci: migrate to application suite
1 parent 1c96d0b commit 26c41bb

File tree

10 files changed

+2580
-1097
lines changed

10 files changed

+2580
-1097
lines changed

.circleci/config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
tag: $CIRCLE_SHA1
5252
pulumi_preview:
5353
docker:
54-
- image: cimg/node:14.19
54+
- image: cimg/node:16.14
5555
steps:
5656
- checkout
5757
- pulumi/login
@@ -64,8 +64,9 @@ jobs:
6464
command: pulumi preview --suppress-outputs --stack dailydotdev/prod -c tag=$CIRCLE_SHA1
6565
working_directory: infra
6666
pulumi_up:
67+
circleci_ip_ranges: true
6768
docker:
68-
- image: cimg/node:14.19
69+
- image: cimg/node:16.14
6970
environment:
7071
USE_GKE_GCLOUD_AUTH_PLUGIN: 'True'
7172
steps:
File renamed without changes.
File renamed without changes.
File renamed without changes.

.infra/index.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import {Input} from '@pulumi/pulumi';
2+
import {
3+
config,
4+
createServiceAccountAndGrantRoles, deployApplicationSuite,
5+
getImageTag,
6+
nodeOptions,
7+
} from '@dailydotdev/pulumi-common';
8+
9+
const imageTag = getImageTag();
10+
const name = 'scraper';
11+
const image = `gcr.io/daily-ops/daily-${name}:${imageTag}`;
12+
13+
const {serviceAccount} = createServiceAccountAndGrantRoles(
14+
`${name}-sa`,
15+
name,
16+
`daily-${name}`,
17+
[
18+
{name: 'profiler', role: 'roles/cloudprofiler.agent'},
19+
{name: 'trace', role: 'roles/cloudtrace.agent'},
20+
{name: 'secret', role: 'roles/secretmanager.secretAccessor'},
21+
],
22+
);
23+
24+
const memory = 2048
25+
const limits: Input<{
26+
[key: string]: Input<string>;
27+
}> = {
28+
cpu: '1',
29+
memory: `${memory}Mi`,
30+
};
31+
32+
const namespace = 'daily';
33+
34+
const envVars = config.requireObject<Record<string, string>>('env');
35+
36+
deployApplicationSuite({
37+
name,
38+
namespace,
39+
image,
40+
imageTag,
41+
serviceAccount,
42+
secrets: envVars,
43+
apps: [{
44+
port: 3000,
45+
env: [nodeOptions(memory)],
46+
minReplicas: 3,
47+
maxReplicas: 10,
48+
limits,
49+
readinessProbe: {
50+
httpGet: {path: '/ready', port: 'http'},
51+
initialDelaySeconds: 10,
52+
},
53+
metric: {type: 'memory_cpu', cpu: 60},
54+
createService: true,
55+
}],
56+
})

0 commit comments

Comments
 (0)