Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2845 fleek aws #676

Merged
merged 7 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion infra/aws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
createLoadBalancerAlarms,
} from "../lib/scorer/loadBalancer";
import { createScheduledTask, createTask } from "../lib/scorer/scheduledTasks";
import { secretsManager } from "infra-libs";
import { secretsManager, amplify } from "infra-libs";

import * as op from "@1password/op-js";
import { createVerifierService } from "./verifier";
Expand Down Expand Up @@ -1757,3 +1757,62 @@ export const s3TriggeredECSTask = createS3InitiatedECSTask(
[secgrp.id],
createdTask.eventsStsAssumeRole.arn
);

const PASSPORT_APP_GITHUB_URL = "https://github.com/passportxyz/passport-scorer";
const PASSPORT_APP_GITHUB_ACCESS_TOKEN_FOR_AMPLIFY = op.read.parse(
`op://DevOps/passport-scorer-${stack}-secrets/interface/PASSPORT_SCORER_GITHUB_ACCESS_TOKEN_FOR_AMPLIFY`
);
const CLOUDFLARE_DOMAIN = stack === "production" ? `passport.xyz` : "";
const CLOUDFLARE_ZONE_ID = op.read.parse(
`op://DevOps/passport-scorer-${stack}-secrets/interface/CLOUDFLARE_ZONE_ID`
);

const passportBranches = Object({
review: "main",
staging: "staging-app",
production: "production-app",
});

const passportXyzAppEnvironment = secretsManager
.getEnvironmentVars({
vault: "DevOps",
repo: "passport-scorer",
env: stack,
section: "interface",
})
.reduce((acc, { name, value }) => {
acc[name] = value;
return acc;
}, {} as Record<string, string | pulumi.Output<any>>);

const amplifyAppInfo = coreInfraStack.getOutput("newPassportDomain").apply((domainName) => {
const prefix = "scorer";
const amplifyAppConfig: amplify.AmplifyAppConfig = {
name: `${domainName}`,
githubUrl: PASSPORT_APP_GITHUB_URL,
githubAccessToken: PASSPORT_APP_GITHUB_ACCESS_TOKEN_FOR_AMPLIFY,
domainName: domainName,
cloudflareDomain: CLOUDFLARE_DOMAIN,
cloudflareZoneId: CLOUDFLARE_ZONE_ID,
prefix: prefix,
branchName: passportBranches[stack],
environmentVariables: passportXyzAppEnvironment,
tags: { Name: `${prefix}.${domainName}` },
buildCommand: "yarn install && yarn build && yarn next export",
preBuildCommand: "nvm use 20.9.0",
artifactsBaseDirectory: "out",
customRules: [
{
source: "/",
status: "200",
target: "/index.html",
},
],
platform: "WEB",
monorepoAppRoot: "interface"
};

return amplify.createAmplifyApp(amplifyAppConfig);
});

export const amplifyAppHookUrl = pulumi.secret(amplifyAppInfo.webHook.url);
2 changes: 1 addition & 1 deletion infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"@pulumi/awsx": "^1.0.5",
"@pulumi/command": "^0.10.0",
"@pulumi/pulumi": "^3.79.0",
"infra-libs": "passportxyz/infra-libs#semver:^1.0.0"
"infra-libs": "passportxyz/infra-libs#semver:^1.1.0"
}
}
Loading
Loading