-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Kittyhawk for Deployment Config (#128)
* 🎉 Set-up * 🐛 Rename DOMAIN -> DOMAINS * ⬆️ Bump * 🔥 Bye Jest
- Loading branch information
Showing
12 changed files
with
4,672 additions
and
127 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
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,4 @@ | ||
*.d.ts | ||
*.js | ||
node_modules | ||
dist/ |
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,2 @@ | ||
language: typescript | ||
app: node main.js |
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,102 @@ | ||
import { Construct } from 'constructs'; | ||
import { App } from 'cdk8s'; | ||
import { CronJob, DjangoApplication, PennLabsChart, ReactApplication } from '@pennlabs/kittyhawk'; | ||
|
||
const cronTime = require('cron-time-generator'); | ||
|
||
export class MyChart extends PennLabsChart { | ||
constructor(scope: Construct) { | ||
super(scope); | ||
|
||
const domain = "platform.pennlabs.org" | ||
const devDomain = "platform-dev.pennlabs.org" | ||
|
||
const frontendImage = "pennlabs/platform-frontend" | ||
const backendImage = "pennlabs/platform-backend" | ||
const devImage = "pennlabs/platform-dev" | ||
|
||
const secret = "platform" | ||
const devSecret = "platform-dev" | ||
|
||
new DjangoApplication(this, 'django', { | ||
port: 443, | ||
deployment: { | ||
image: backendImage, | ||
secret, | ||
secretMounts: [ | ||
{ | ||
name: "platform", | ||
subPath: "SHIBBOLETH_CERT", | ||
mountPath: "/etc/shibboleth/sp-cert.pem", | ||
}, | ||
{ | ||
name: "platform", | ||
subPath: "SHIBBOLETH_KEY", | ||
mountPath: "/etc/shibboleth/sp-key.pem", | ||
} | ||
] | ||
}, | ||
domains: [{ | ||
host: domain, | ||
paths: [ | ||
"/admin", | ||
"/accounts", | ||
"/assets", | ||
"/identity", | ||
"/s", | ||
"/options", | ||
"/openapi", | ||
"/documentation", | ||
"/Shibboleth.sso", | ||
], | ||
isSubdomain: true, | ||
}], | ||
ingressProps: { | ||
annotations: { | ||
["ingress.kubernetes.io/protocol"]: "http" | ||
}, | ||
}, | ||
djangoSettingsModule: 'Platform.settings.production', | ||
}); | ||
|
||
new ReactApplication(this, 'react', { | ||
deployment: { | ||
image: frontendImage, | ||
replicas: 2, | ||
}, | ||
domain: { | ||
host: domain, | ||
paths: ["/"] | ||
}, | ||
}) | ||
|
||
new DjangoApplication(this, 'dev', { | ||
port: 8080, | ||
deployment: { | ||
image: devImage, | ||
secret: devSecret, | ||
env: [{ | ||
name: "DEV_LOGIN", | ||
value: "true" | ||
}] | ||
}, | ||
domains: [{ | ||
host: devDomain, | ||
paths: ["/"], | ||
isSubdomain: true, | ||
}], | ||
djangoSettingsModule: 'Platform.settings.production', | ||
}); | ||
|
||
new CronJob(this, 'clear-expired-tokens', { | ||
schedule: cronTime.everySundayAt(5), | ||
image: backendImage, | ||
secret, | ||
cmd: ["python3", "manage.py", "cleartokens"], | ||
}); | ||
} | ||
} | ||
|
||
const app = new App(); | ||
new MyChart(app); | ||
app.synth(); |
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,29 @@ | ||
{ | ||
"name": "k8s", | ||
"version": "1.0.0", | ||
"main": "main.js", | ||
"types": "main.ts", | ||
"license": "Apache-2.0", | ||
"private": true, | ||
"scripts": { | ||
"import": "cdk8s import", | ||
"synth": "cdk8s synth", | ||
"compile": "tsc", | ||
"watch": "tsc -w", | ||
"build": "npm run compile && npm run synth", | ||
"upgrade": "npm i cdk8s@latest cdk8s-cli@latest", | ||
"upgrade:next": "npm i cdk8s@next cdk8s-cli@next" | ||
}, | ||
"dependencies": { | ||
"@pennlabs/kittyhawk": "^1.1.4", | ||
"cdk8s": "^2.2.63", | ||
"constructs": "^10.0.119" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^26.0.24", | ||
"@types/node": "^14.18.12", | ||
"jest": "^26.6.3", | ||
"ts-jest": "^26.5.6", | ||
"typescript": "^4.6.3" | ||
} | ||
} |
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,33 @@ | ||
{ | ||
"compilerOptions": { | ||
"alwaysStrict": true, | ||
"charset": "utf8", | ||
"declaration": true, | ||
"experimentalDecorators": true, | ||
"inlineSourceMap": true, | ||
"inlineSources": true, | ||
"lib": [ | ||
"es2016" | ||
], | ||
"module": "CommonJS", | ||
"noEmitOnError": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"resolveJsonModule": true, | ||
"strict": true, | ||
"strictNullChecks": true, | ||
"strictPropertyInitialization": true, | ||
"stripInternal": true, | ||
"target": "ES2017" | ||
}, | ||
"include": [ | ||
"**/*.ts" | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} |
Oops, something went wrong.