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

Feature: AWS cloud infrastructure 🚀 #921

Open
wants to merge 22 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3e71515
Github action for cloud code checks (#816)
chriswilty Feb 5, 2024
51dd566
385: CDK API stack with Fargate / ALB (#817)
chriswilty Feb 13, 2024
73177d0
807: CDK auth stack (AWS Cognito) (#818)
chriswilty Feb 13, 2024
8940d62
388: Add UI stack and hook up CORS origin (#819)
chriswilty Feb 13, 2024
062f12b
385: Put APIGateway in front of private loadbalancer (#834)
chriswilty Feb 20, 2024
e5d6cc2
Start/stop fargate service at start/end of day (#854)
chriswilty Mar 6, 2024
bebfec8
807: Authentication for UI in production mode (#851)
chriswilty Mar 6, 2024
1cb0bae
806, 809: Route 53 and Certificates for spylogic.ai (#860)
chriswilty Mar 15, 2024
dc681f8
808: Authenticate backend via cloudfront function (#904)
chriswilty Apr 25, 2024
1f0d637
909: Enable SSO Sign-in in cloud templates and (opt-in) in UI (#910)
chriswilty May 3, 2024
32495a2
Prepare for prod-stage deployments (#914)
chriswilty Jul 3, 2024
696df2c
Switch to Linux2023 AMI for NAT instance
chriswilty Jul 16, 2024
324649a
Bump package version to 1.0.3, fix package vulnerabilities
chriswilty Jul 16, 2024
d997ba3
Add pipeline for deployment on push
chriswilty Jul 22, 2024
08450d6
Update all READMEs
chriswilty Jul 25, 2024
58c487b
Change pipeline trigger branch to main
chriswilty Jul 26, 2024
c303852
Add another CDK app to test synth and deploy
chriswilty Jul 26, 2024
45bf540
Correct auth header generation, log API access
chriswilty Aug 9, 2024
f7a5c5d
Assign least-privilege IAM policies to pipeline
chriswilty Sep 11, 2024
d60df3d
Correct hard-coded ParameterStore region: read from env
chriswilty Sep 13, 2024
9873ce2
Make SSO login in UI opt-in: only basic by default
chriswilty Sep 13, 2024
978df68
Correct run order of UI deployment steps
chriswilty Sep 13, 2024
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
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
**/dist/
**/test/
**/jest*
**/tsconfig.test.json
**/vitest*
**/.env*
**/.eslint*
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/backend-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches:
- main
- dev
- 'feature/**'
paths:
- 'backend/**'

Expand All @@ -20,7 +21,6 @@ jobs:
strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -30,19 +30,21 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "./backend/package-lock.json"
- name: Run job
cache: 'npm'
cache-dependency-path: './backend/package-lock.json'
- name: Install dependencies
run: |
npm ci
- name: Run job
run: |
npx eslint .
npx prettier . --check

build-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 18.x ]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -52,10 +54,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "./backend/package-lock.json"
- name: Run job
cache: 'npm'
cache-dependency-path: './backend/package-lock.json'
- name: Install dependencies
run: |
npm ci
- name: Run job
run: |
npm run build
npm test
41 changes: 41 additions & 0 deletions .github/workflows/cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Cloud Code Checks

on:
workflow_dispatch:
pull_request:
branches:
- main
- dev
- 'feature/**'
paths:
- 'cloud/**'

defaults:
run:
working-directory: ./cloud

jobs:
lint-format:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
sparse-checkout: |
.prettierrc
cloud
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: './cloud/package-lock.json'
- name: Install dependencies
run: |
npm ci
- name: Run job
run: |
npm run codecheck
20 changes: 12 additions & 8 deletions .github/workflows/frontend-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches:
- main
- dev
- 'feature/**'
paths:
- 'frontend/**'

Expand All @@ -20,7 +21,6 @@ jobs:
strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -30,20 +30,22 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "./frontend/package-lock.json"
- name: Run job
cache: 'npm'
cache-dependency-path: './frontend/package-lock.json'
- name: Install dependencies
run: |
npm ci
- name: Run job
run: |
npx eslint .
npx stylelint '**/*.css'
npx prettier . --check

build-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 18.x ]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -53,10 +55,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "./frontend/package-lock.json"
- name: Run job
cache: 'npm'
cache-dependency-path: './frontend/package-lock.json'
- name: Install dependencies
run: |
npm ci
- name: Run job
run: |
npm run build
npm test
9 changes: 5 additions & 4 deletions .github/workflows/k6-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -30,10 +29,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "./k6/package-lock.json"
- name: Run job
cache: 'npm'
cache-dependency-path: './k6/package-lock.json'
- name: Install dependencies
run: |
npm ci
- name: Run job
run: |
npx eslint .
npx prettier . --check
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ pids
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
# Coverage and test output
lib-cov
coverage
*.lcov
reports

# node-waf configuration
.lock-wscript
Expand Down
1 change: 1 addition & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
build
reports
test
.env*
.eslintrc.cjs
Expand Down
2 changes: 1 addition & 1 deletion backend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.json', './test/tsconfig.json'],
project: ['./tsconfig.json', 'test/tsconfig.json'],
},
plugins: ['@typescript-eslint', 'jest'],
ignorePatterns: ['build', 'coverage', 'node_modules'],
Expand Down
1 change: 0 additions & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM node:lts-alpine
ENV NODE_ENV=production

WORKDIR /usr/app
COPY package*.json ./
Expand Down
2 changes: 1 addition & 1 deletion backend/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# prompt-injection-api
# SpyLogic : API

This is the backend module of the SpyLogic app. We are using [Express](https://expressjs.com/) to serve the API.

Expand Down
9 changes: 6 additions & 3 deletions backend/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ const jestConfig: JestConfigWithTsJest = {
'^@src/(.*)': '<rootDir>/src/$1',
importMetaUtils$: '<rootDir>/test/importMetaUtils.mock.ts',
},
modulePathIgnorePatterns: ['build', 'coverage', 'node_modules'],
testEnvironment: 'node',
transform: {
'^.+\\.ts$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
tsconfig: '<rootDir>/test/tsconfig.json',
useESM: true,
},
],
},
silent: true,
setupFiles: ['./test/setupEnvVars.ts'],
setupFiles: ['<rootDir>/test/setupEnvVars.ts'],
reporters:
process.env.CI === 'true'
? ['default', ['jest-junit', { outputDirectory: 'reports' }]]
: ['default'],
};

export default jestConfig;
Loading
Loading