Skip to content

Commit cf20484

Browse files
committed
🎉 V0 of PingMobile
0 parents  commit cf20484

File tree

15 files changed

+5689
-0
lines changed

15 files changed

+5689
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
# ========================================
3+
# Note: If you make changes to this CI/CD, please include someone from DevOps in the list of reviewers for the PR.
4+
# ========================================
5+
name: Build and Deploy Labs Analytics Server
6+
7+
on: push
8+
9+
jobs:
10+
backend-check:
11+
name: "Backend Check"
12+
uses: pennlabs/shared-actions/.github/workflows/django.yaml@8785a7d7b9158d8d5705a0202f5695db2c0beb97
13+
with:
14+
projectName: penn-mobile-notification-backend
15+
path: .
16+
flake: true
17+
black: true
18+
pythonVersion: 3.11-buster
19+
skipDjangoCheck: true
20+
21+
publish-backend:
22+
uses: pennlabs/shared-actions/.github/workflows/[email protected]
23+
with:
24+
# Inputs
25+
imageName: "notification-backend"
26+
githubRef: ${{ github.ref }}
27+
gitSha: ${{ github.sha }}
28+
29+
# Optional inputs
30+
31+
# Path to the docker context
32+
path: .
33+
34+
# Path to the dockerfile (relative to `path` variable)
35+
dockerfile: Dockerfile
36+
37+
# If enabled, will cache_from the latest version of the docker image.
38+
cache: true
39+
40+
secrets:
41+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
42+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
43+
44+
# Deploy
45+
46+
deploy:
47+
name: "Deploy"
48+
uses: pennlabs/shared-actions/.github/workflows/[email protected]
49+
50+
with:
51+
githubRef: ${{ github.ref }}
52+
gitSha: ${{ github.sha }}
53+
54+
secrets:
55+
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
56+
GH_AWS_ACCESS_KEY_ID: ${{ secrets.GH_AWS_ACCESS_KEY_ID }}
57+
GH_AWS_SECRET_ACCESS_KEY: ${{ secrets.GH_AWS_SECRET_ACCESS_KEY }}
58+
59+
needs:
60+
- publish-backend

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.d.ts
2+
*.js
3+
node_modules
4+
dist/
5+
*.pem
6+
*.crt
7+
__pycache__

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM python:3.11-buster
2+
3+
LABEL maintainer="Penn Labs"
4+
5+
# Install build dependencies
6+
RUN apt-get update && apt-get install --no-install-recommends -y gcc libpq-dev libc-dev \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
# Install pipenv
10+
RUN pip install pipenv
11+
12+
WORKDIR /app/
13+
14+
# Copy project dependencies
15+
COPY Pipfile* /app/
16+
17+
# Install project dependencies
18+
RUN pipenv install --deploy --system
19+
20+
# Copy project files
21+
COPY . /app/
22+
23+
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "80"]

Pipfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[requires]
7+
python_version = "3"
8+
9+
[packages]
10+
cryptography = ">=44.0.0"
11+
fastapi = ">=0.115.8"
12+
pyjwt = ">=2.10.1"
13+
requests = ">=2.32.3"
14+
uvicorn = ">=0.34.0"

README.md

Whitespace-only changes.

k8s/cdk8s.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
language: typescript
2+
app: node main.js

k8s/main.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { Construct } from 'constructs';
2+
import { App } from 'cdk8s';
3+
import { Application, PennLabsChart } from '@pennlabs/kittyhawk';
4+
5+
6+
export class MyChart extends PennLabsChart {
7+
constructor(scope: Construct) {
8+
super(scope);
9+
10+
const backendImage = 'pennlabs/penn-mobile-notification-backend';
11+
const secret = "penn-mobile";
12+
13+
const ingressProps = {
14+
annotations: {
15+
['ingress.kubernetes.io/content-security-policy']: "frame-ancestors 'none';",
16+
["ingress.kubernetes.io/protocol"]: "https",
17+
["traefik.ingress.kubernetes.io/router.middlewares"]: "default-redirect-http@kubernetescrd"
18+
}
19+
}
20+
21+
new Application(this, 'backend', {
22+
deployment: {
23+
image: backendImage,
24+
secret,
25+
replicas: 1,
26+
},
27+
ingress: {
28+
rules: [{
29+
host: "pennmobile.org",
30+
paths: ["/notifications"],
31+
isSubdomain: true,
32+
}],
33+
...ingressProps,
34+
}
35+
});
36+
}
37+
}
38+
39+
const app = new App();
40+
new MyChart(app);
41+
app.synth();

k8s/package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "k8s",
3+
"version": "1.0.0",
4+
"main": "main.js",
5+
"types": "main.ts",
6+
"license": "Apache-2.0",
7+
"private": true,
8+
"scripts": {
9+
"import": "cdk8s import",
10+
"synth": "cdk8s synth",
11+
"compile": "tsc",
12+
"watch": "tsc -w",
13+
"test": "jest",
14+
"build": "npm run compile && npm run synth",
15+
"upgrade": "npm i cdk8s@latest cdk8s-cli@latest",
16+
"upgrade:next": "npm i cdk8s@next cdk8s-cli@next"
17+
},
18+
"dependencies": {
19+
"@pennlabs/kittyhawk": "^1.1.11",
20+
"cdk8s": "^2.2.63",
21+
"constructs": "^10.0.119",
22+
"ts-dedent": "^2.2.0"
23+
},
24+
"devDependencies": {
25+
"@types/jest": "^26.0.24",
26+
"@types/node": "^14.18.12",
27+
"jest": "^26.6.3",
28+
"ts-jest": "^26.5.6",
29+
"typescript": "^4.6.3"
30+
}
31+
}

k8s/tsconfig.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"compilerOptions": {
3+
"alwaysStrict": true,
4+
"charset": "utf8",
5+
"declaration": true,
6+
"experimentalDecorators": true,
7+
"inlineSourceMap": true,
8+
"inlineSources": true,
9+
"lib": [
10+
"es2016"
11+
],
12+
"module": "CommonJS",
13+
"noEmitOnError": true,
14+
"noFallthroughCasesInSwitch": true,
15+
"noImplicitAny": true,
16+
"noImplicitReturns": true,
17+
"noImplicitThis": true,
18+
"noUnusedLocals": true,
19+
"noUnusedParameters": true,
20+
"resolveJsonModule": true,
21+
"strict": true,
22+
"strictNullChecks": true,
23+
"strictPropertyInitialization": true,
24+
"stripInternal": true,
25+
"target": "ES2017"
26+
},
27+
"include": [
28+
"**/*.ts"
29+
],
30+
"exclude": [
31+
"node_modules"
32+
]
33+
}

0 commit comments

Comments
 (0)