Skip to content

Commit

Permalink
Merge branch 'main' into feat/331
Browse files Browse the repository at this point in the history
  • Loading branch information
paustint committed Mar 21, 2024
2 parents 88049fe + 7c4a3a4 commit 26b82e5
Show file tree
Hide file tree
Showing 1,944 changed files with 42,841 additions and 22,781 deletions.
39 changes: 38 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,48 @@
.editorconfig
.env
.env.example
.env.staging
.git
.github
.nx
.vscode
.workspace.code-workspace
app
# dist
apps/landing/.next
dist
electron-scripts
logs
node_modules
npm-debug.log
test-results
tmp
yarn-error.log

# System Files
.DS_Store
Thumbs.db

# Generated Docusaurus files
.docusaurus/
.cache-loader/

# Next.js
.next

# Playwright
**/test-results
**/playwright-report
**/playwright/.cache
.nx

# Not required for core jetstream
apps/cron-tasks
apps/docs
apps/electron
apps/jetstream-e2e
electron-scripts
*#
*~
.DS_Store
Thumbs.db

8 changes: 3 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SFDC_CONSUMER_KEY='3MVG9tSqyyAXNH5ItQtuplEg40Ks_MLSG37L1PV.TLDjsCbdp7EDonFUW0csS
SFDC_CONSUMER_SECRET='F77C1B4AF03CF51B290A591766F4C430E3136949A636D4AA5339F8EB6A40052A'

# API VERSION TO USE
NX_SFDC_API_VERSION='55.0'
SFDC_API_VERSION='58.0'

# If set to true, then authentication will be bypassed
# You will use a test account instead of a real account - only works if running locally
Expand All @@ -45,8 +45,6 @@ PRISMA_DEBUG='false'

NX_SFDC_CLIENT_ID_ELECTRON=''
NX_AUTH_AUDIENCE='http://getjetstream.app/app_metadata'

NX_AG_GRID_KEY=''
NX_ROLLBAR_KEY=''
NX_AMPLITUDE_KEY=''

Expand All @@ -72,8 +70,8 @@ GOOGLE_ENC_KEY=''
ROLLBAR_SERVER_TOKEN=''

# Algolia API key - used to index docs pages
APPLICATION_ID=''
API_KEY=''
ALGOLIA_APPLICATION_ID=''
ALGOLIA_API_KEY=''

# HONEYCOMBE - server analytics, only set to true on hosted server
HONEYCOMB_ENABLED=false
Expand Down
8 changes: 6 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,17 @@
{
"files": ["*.tsx"],
"rules": {
"@typescript-eslint/no-unused-vars": "off"
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": "warn"
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
"rules": {
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": "warn"
}
},
{
"files": ["*.js", "*.jsx"],
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
name: Checkout [master]
with:
fetch-depth: 0
Expand All @@ -30,21 +30,23 @@ jobs:
run: git branch --track main origin/main

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
uses: nrwl/nx-set-shas@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
cache: 'yarn'

- name: install dependencies
run: yarn install --frozen-lockfile --prefer-offline
run: yarn install --frozen-lockfile

- name: Build application
env:
NODE_OPTIONS: '--max_old_space_size=4096'
run: npx nx run-many --target=build --parallel=3 --projects=jetstream,api,download-zip-sw,landing --configuration=production

- name: Uploading artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist-artifacts
path: dist
Expand Down Expand Up @@ -78,7 +80,7 @@ jobs:
SFDC_CONSUMER_KEY: ${{ secrets.SFDC_CONSUMER_KEY }}
SFDC_CONSUMER_SECRET: ${{ secrets.SFDC_CONSUMER_SECRET }}
SFDC_ENC_KEY: ${{ secrets.SFDC_ENC_KEY }}
SFDC_API_VERSION: '57.0'
SFDC_API_VERSION: '58.0'

services:
postgres:
Expand All @@ -96,21 +98,21 @@ jobs:
- 5432:5432

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
name: Checkout [master]
with:
fetch-depth: 0

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
cache: 'yarn'

- name: install dependencies
run: yarn install --frozen-lockfile --prefer-offline
run: yarn install --frozen-lockfile

- name: Download artifacts from build
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: dist-artifacts
path: dist
Expand Down Expand Up @@ -139,7 +141,7 @@ jobs:

- name: Upload test results
if: always() # This ensures step will always run even if prior steps fail
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: |
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/deployment-monitor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Deployment
on:
push:
branches:
- release

jobs:
deploy:
name: Wait for Deploy
runs-on: ubuntu-latest
steps:
# https://github.com/marketplace/actions/render-github-action
- name: Wait for Render Deployment
uses: bounceapp/render-action@0.6.0
with:
render-token: ${{ secrets.RENDER_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
service-id: srv-cm55msocmk4c73cnddi0
# retries: 20
# wait: 16000
# sleep: 30000
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Init npm cache
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
cache: 'yarn'
- name: install dependencies
run: yarn install --frozen-lockfile
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ package-lock.json
**/test-results
**/playwright-report
**/playwright/.cache

.nx/cache
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/dist
/coverage
.docusaurus/

/.nx/cache
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"streetsidesoftware.code-spell-checker",
"eamodio.gitlens",
"ms-playwright.playwright",
"wayou.vscode-todo-highlight"
"wayou.vscode-todo-highlight",
"firsttris.vscode-jest-runner"
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
},
"files.exclude": {
"**/.git": true,
Expand Down
76 changes: 46 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,57 @@
# docker build -f Dockerfile . -t jetstream
# docker-compose up
# syntax = docker/dockerfile:1

# Login and run DB migrations (TODO: figure out how to automate this)
# https://medium.com/@sumankpaul/run-db-migration-script-in-docker-compose-ce8e447a77ba
# docker ps
# docker exec -it 791 bash
# npx prisma migrate deploy
ARG NODE_VERSION=20.10.0
ARG ENVIRONMENT=production

# TODO: auth redirect flow is broken, need to fix it
FROM node:${NODE_VERSION}-slim as base

FROM node:16
# App lives here
WORKDIR /app

WORKDIR /usr/src/app
# Set production environment
ENV NODE_ENV=production
ARG YARN_VERSION=1.22.21
RUN npm install -g yarn@$YARN_VERSION --force

# Copy application
COPY ./dist/apps/api ./dist/apps/api/
COPY ./dist/apps/jetstream ./dist/apps/jetstream/
COPY ./dist/apps/download-zip-sw ./dist/apps/download-zip-sw/
COPY ./dist/apps/landing ./dist/apps/landing/
# Throw-away build stage to reduce size of final image
FROM base as build

# Copy supporting files
COPY ./dist/apps/api/package.json .
COPY ./yarn.lock .
COPY ./.env .
COPY ./ecosystem.config.js .
COPY ./prisma ./prisma/
# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential node-gyp openssl pkg-config python-is-python3

# Install core dependencies
RUN yarn
# Install node modules
COPY --link package.json yarn.lock ./
RUN yarn install --frozen-lockfile --production=false

# Install other dependencies that were not calculated by nx, but are required
RUN yarn add dotenv prisma@^3.13.0
# Generate Prisma Client
COPY --link prisma .
RUN yarn run db:generate

# Generate prisma client - ensure that there are no OS differences
RUN npx prisma generate
# Copy application code
COPY --link . .

EXPOSE 3333
EXPOSE 9229
# Build application
RUN yarn build:core
RUN yarn build:landing

# Remove development dependencies
RUN yarn install --production=true


# Final stage for app image
FROM base

CMD [ "node", "--inspect=0.0.0.0", "dist/apps/api/main.js" ]
# Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y openssl && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

RUN npm install -g ts-node@10.9.1

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3333
CMD [ "yarn", "run", "start:prod" ]
11 changes: 0 additions & 11 deletions Dockerfile.db-migration

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile.e2e
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/playwright:v1.27.0-focal
FROM mcr.microsoft.com/playwright:v1.36.0

WORKDIR /usr/src/app

Expand Down
Loading

0 comments on commit 26b82e5

Please sign in to comment.