Skip to content

Commit

Permalink
Initial commit of old codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Shpigford committed Jan 10, 2024
0 parents commit d18d5ba
Show file tree
Hide file tree
Showing 1,210 changed files with 137,730 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Ignores everything except dist/ prisma/ apps/ and yarn.lock
# apps/ is needed so that CDK (in /aws/maybe-app) has access to the per-app Dockerfile
*
!apps/
!dist/
!prisma/
!yarn.lock
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
15 changes: 15 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Used by `prisma` commands
NX_DATABASE_URL=postgresql://maybe:maybe@localhost:5432/maybe_local

# If using free ngrok account for webhooks
NGROK_AUTH_TOKEN=

# Required for Auth0 deploy client (see `yarn auth0:deploy` command)
AUTH0_ENV=development
AUTH0_DEPLOY_CLIENT_SECRET=
POSTMARK_SMTP_PASS=

# If you want to test any code that utilizes the AWS SDK locally, add temporary STAGING credentials (can be retrieved from SSO dashboard)
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_SESSION_TOKEN=
95 changes: 95 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"root": true,
"ignorePatterns": ["**/*", "**/*.png"],
"plugins": ["@nrwl/nx", "eslint-plugin-json"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "scope:shared",
"onlyDependOnLibsWithTags": ["scope:shared"]
},
{
"sourceTag": "scope:app",
"onlyDependOnLibsWithTags": ["*"]
},
{
"sourceTag": "scope:client-shared",
"onlyDependOnLibsWithTags": ["scope:client-shared", "scope:shared"]
},
{
"sourceTag": "scope:server-shared",
"onlyDependOnLibsWithTags": ["scope:server-shared", "scope:shared"]
},
{
"sourceTag": "scope:server",
"onlyDependOnLibsWithTags": [
"scope:server",
"scope:server-shared",
"scope:shared"
]
},
{
"sourceTag": "scope:client",
"onlyDependOnLibsWithTags": [
"scope:client",
"scope:client-shared",
"scope:shared"
]
},
{
"sourceTag": "scope:advisor",
"onlyDependOnLibsWithTags": [
"scope:advisor",
"scope:client-shared",
"scope:shared"
]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{ "fixStyle": "inline-type-imports" }
]
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
},
{
"files": ["*.tsx", "*.jsx"],
"rules": {
"jsx-a11y/anchor-is-valid": [
"error",
{
"components": ["Link"],
"specialLink": ["hrefLeft", "hrefRight"],
"aspects": ["invalidHref", "preferButton"]
}
]
}
}
]
}
23 changes: 23 additions & 0 deletions .github/workflows/deploy-auth0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Deploys the configuration stored in /auth0/tenant.yaml
name: Deploy Auth0
on:
workflow_dispatch:
inputs:
deploy_env:
required: true
description: The environment to deploy to
type: choice
options:
- staging
- production
default: staging

jobs:
deploy:
uses: ./.github/workflows/template.auth0-deploy.yml
with:
auth0_env: ${{ github.event.inputs.deploy_env }}
secrets:
client_secret: ${{ (github.event.inputs.deploy_env == 'production' && secrets.PROD_AUTH0_CLIENT_SECRET) || (github.event.inputs.deploy_env == 'staging' && secrets.STAGING_AUTH0_CLIENT_SECRET) }}
postmark_secret: ${{ secrets.POSTMARK_SMTP_PASS }}
apple_secret: ${{ secrets.APPLE_SIGN_IN_SECRET_KEY }}
58 changes: 58 additions & 0 deletions .github/workflows/deploy-services-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This workflow serves two purposes:
# 1. Allows us to deploy a specific PR to staging for testing
# 2. Allows us to re-deploy production off the `main` branch
name: MANUAL | Deploy services
on:
workflow_dispatch:
inputs:
deploy_env:
description: The environment to deploy to
type: choice
options:
- staging
- production
default: staging
required: true
deploy_shared_stack:
description: Deploy shared AWS resources?
type: boolean
required: false
default: true
deploy_server_stack:
description: Deploy server to ECS Fargate?
type: boolean
required: false
default: false
deploy_workers_stack:
description: Deploy Bull workers to ECS Fargate?
type: boolean
required: false
default: false
deploy_tools_stack:
description: Deploy tools stack? (CI/CD resources)
type: boolean
required: false
default: false
deploy_vercel_client:
description: Deploy Vercel client?
type: boolean
required: false
default: false

concurrency:
group: deployments
cancel-in-progress: false

jobs:
deploy:
uses: ./.github/workflows/template.deploy-services.yml
# Production can only be deployed from `main` manually, while staging can be deployed from any branch
if: ${{ (github.event.inputs.deploy_env == 'production' && github.ref == 'refs/heads/main') || github.event.inputs.deploy_env == 'staging' }}
with:
deploy_env: ${{ github.event.inputs.deploy_env }}
deploy_shared_stack: ${{ github.event.inputs.deploy_shared_stack == 'true' }}
deploy_server_stack: ${{ github.event.inputs.deploy_server_stack == 'true' }}
deploy_workers_stack: ${{ github.event.inputs.deploy_workers_stack == 'true' }}
deploy_tools_stack: ${{ github.event.inputs.deploy_tools_stack == 'true' }}
deploy_vercel_client: ${{ github.event.inputs.deploy_vercel_client == 'true' }}
secrets: inherit
61 changes: 61 additions & 0 deletions .github/workflows/deploy-services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy services

on:
push:
branches:
- 'main'

concurrency:
group: deployments
cancel-in-progress: false

jobs:
get_affected_apps:
name: Get affected apps
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0 # NX needs the entire repo history to run affected commands

- name: Set NX commit SHAs for affected commands
uses: nrwl/nx-set-shas@v2 # derive appropriate SHAs for base and head for `nx affected` commands

# Only install nx affected command requirements, no need for a full dependency install
- name: Install requirements for nx
run: |
NX_REPO_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@nrwl/workspace'])")
TS_REPO_VERSION=$(node -e "console.log(require('./package.json').devDependencies['typescript'])")
yarn add -D @nrwl/workspace@$NX_REPO_VERSION --prefer-offline
yarn add -D typescript@$TS_VERSION --prefer-offline
./node_modules/.bin/nx affected:apps --plain
- name: Set affected outputs
id: set_affected_outputs
shell: bash
run: ./tools/scripts/getAffectedApps.sh

- name: Verify outputs
run: |
echo "Will deploy client? ${{ steps.set_affected_outputs.outputs.client_affected == 'true' && 'yes' || 'no' }}"
echo "Will deploy server? ${{ steps.set_affected_outputs.outputs.server_affected == 'true' && 'yes' || 'no' }}"
echo "Will deploy workers? ${{ steps.set_affected_outputs.outputs.workers_affected == 'true' && 'yes' || 'no' }}"
outputs:
should_deploy_client: ${{ steps.set_affected_outputs.outputs.client_affected }}
should_deploy_server: ${{ steps.set_affected_outputs.outputs.server_affected }}
should_deploy_workers: ${{ steps.set_affected_outputs.outputs.workers_affected }}

deploy_production:
name: Deploy production services
needs: [get_affected_apps]
uses: ./.github/workflows/template.deploy-services.yml
with:
deploy_env: production
deploy_shared_stack: true
deploy_vercel_client: ${{ needs.get_affected_apps.outputs.should_deploy_client == 'true' }}
deploy_server_stack: ${{ needs.get_affected_apps.outputs.should_deploy_server == 'true' }}
deploy_workers_stack: ${{ needs.get_affected_apps.outputs.should_deploy_workers == 'true' }}
secrets: inherit
37 changes: 37 additions & 0 deletions .github/workflows/template.auth0-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Deploys the configuration stored in /auth0/tenant.yaml
name: TEMPLATE | Deploy Auth0
on:
workflow_call:
inputs:
auth0_env:
description: Tenant to deploy to. Valid values are `staging | production`
type: string
required: true
secrets:
client_secret:
required: true
postmark_secret:
required: true
apple_secret:
required: true

concurrency:
group: auth0_deployments
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18'
- run: yarn install --frozen-lockfile
- name: Deploy Auth0 resources
env:
AUTH0_DEPLOY_CLIENT_SECRET: ${{ secrets.client_secret }}
POSTMARK_SMTP_PASS: ${{ secrets.postmark_secret }}
APPLE_SIGN_IN_SECRET_KEY: ${{ secrets.apple_secret }}
AUTH0_ENV: ${{ inputs.auth0_env }}
run: yarn auth0:deploy
Loading

0 comments on commit d18d5ba

Please sign in to comment.