Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jclem committed May 4, 2020
0 parents commit b3d375f
Show file tree
Hide file tree
Showing 257 changed files with 46,187 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"presets": [
[
"next/babel",
{
"preset-env": {},
"transform-runtime": {},
"styled-jsx": {},
"class-properties": {}
}
]
],
"plugins": ["inline-react-svg"]
}
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.next/
/node_modules/
1 change: 1 addition & 0 deletions .env.build.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GITHUB_CLIENT_ID=$LOCALHOST_GITHUB_CLIENT_ID
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
GITHUB_CLIENT_ID=$LOCALHOST_GITHUB_CLIENT_ID
GITHUB_CLIENT_SECRET=$LOCALHOST_GITHUB_CLIENT_SECRET
GITHUB_API_TOKEN=$GITHUB_PERSONAL_ACCESS_TOKEN_WITH_REPO_SCOPE
RUNNER_SHARED_SECRET=runner-shared-secret
RUNNER_CALLBACK_URL=$RUNNER_CALLBACK_PROXY_URL
CONTROL_REPO_NWO=covid-modeling/prod-covid19-control-plane
CONTROL_REPO_EVENT_TYPE=test-run-simulation
BLOB_STORAGE_ACCOUNT=$BLOB_STORAGE_ACCOUNT
BLOB_STORAGE_KEY=$BLOB_STORAGE_KEY
# Arbitrary session secret generated via `openssl rand -hex 32`
OAUTH_SECRET=9984beb4f8c53cea0dd4bb8c59c747f49bb5622d16dac8040228d2b0669c0385
# Arbitrary session secret generated via `openssl rand -hex 32`
SESSION_SECRET=4afd67b10fadfa8d4216425343120541c5c65f23b1d188230bf32a97d1a54e15
LOCAL_MODE=true
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
migrations/*.js linguist-generated=true
25 changes: 25 additions & 0 deletions .github/workflows/db-migrate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
repository_dispatch:
types: db-migrate

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
echo "Client Payload:"
echo '${{toJson(github.event.client_payload)}}'
- run: |
docker-compose -f docker-compose.yml -f docker-compose.db.yml run \
-e DB_USERNAME="${{secrets.DB_USERNAME}}" \
-e DB_PASSWORD="${{secrets.DB_PASSWORD}}" \
-e DB_HOST="${{secrets.DB_HOST}}" \
-e DB_DATABASE="${{secrets.DB_DATABASE}}" \
-e DB_USERNAME_STAGING="${{secrets.DB_USERNAME_STAGING}}" \
-e DB_PASSWORD_STAGING="${{secrets.DB_PASSWORD_STAGING}}" \
-e DB_HOST_STAGING="${{secrets.DB_HOST_STAGING}}" \
-e DB_DATABASE_STAGING="${{secrets.DB_DATABASE_STAGING}}" \
db-migrate ${{github.event.client_payload.direction}} \
--env ${{github.event.client_payload.env}} \
--count ${{github.event.client_payload.count}}
24 changes: 24 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
repository_dispatch:
types: deploy

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{runner.os}}-deploy-${{hashFiles('**/package-lock.json')}}
- run: npm ci
- run: |
mkdir .now
echo '{"projectId":"${{secrets.ZEIT_PROJECT_ID}}","orgId":"${{secrets.ZEIT_ORG_ID}}"}' > .now/project.json
- run: npx now --token ${{secrets.ZEIT_TOKEN}} -b GITHUB_SHA=${{github.sha}} --prod -A now.prod.json
- run: |
npx sentry-cli \
--auth-token "${{secrets.SENTRY_AUTH_TOKEN}}" \
releases --org github-disease-modelling \
deploys "${{github.sha}}" \
new -e production
39 changes: 39 additions & 0 deletions .github/workflows/fetch-recorded-data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on:
schedule:
# covidtracking.com updates at 4pm, we run at 5pm for some wiggle room.
- cron: '0 21 * * *'
repository_dispatch:
types: fetch-recorded-data

jobs:
fetch-recorded-data:
name: Fetch recorded case and intervention data
runs-on: ubuntu-latest
env:
NODE_ENV: production
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{runner.os}}-deploy-${{hashFiles('**/package-lock.json')}}
- uses: actions/setup-node@v1
with:
node-version: 13.x
- run: npm ci
- run: |
echo "Updating recorded data in staging database..."
script/fetch-recorded-data
env:
DB_USERNAME: ${{ secrets.DB_USERNAME_STAGING }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD_STAGING }}
DB_HOST: ${{ secrets.DB_HOST_STAGING }}
DB_DATABASE: ${{ secrets.DB_DATABASE_STAGING }}
- run: |
echo "Updating recorded data in production database..."
script/fetch-recorded-data
env:
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_DATABASE: ${{ secrets.DB_DATABASE }}
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint

on:
pull_request:
branches: master

jobs:
lint:
name: Run lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{runner.os}}-deploy-${{hashFiles('**/package-lock.json')}}
- uses: actions/setup-node@v1
with:
node-version: 13.x
- run: npm ci
- run: npx tsc --noEmit
- run: git fetch --no-tags --prune --depth=1 origin +refs/heads/master
- run: npx eslint $(git diff-index --name-only --diff-filter=AM origin/master -- "*.js" "*.jsx" "*.ts" "*.tsx")
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test

on:
pull_request:
branches: master

jobs:
lint:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{runner.os}}-deploy-${{hashFiles('**/package-lock.json')}}
- uses: actions/setup-node@v1
with:
node-version: 13.x
- run: npm ci
- run: npx tsc --noEmit
- run: git fetch --no-tags --prune --depth=1 origin +refs/heads/master
- run: npm test
21 changes: 21 additions & 0 deletions .github/workflows/validate-models.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Validate Models

on:
push: {branches: master}
pull_request: {branches: master}

jobs:
validate_models:
name: Validate Models
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{runner.os}}-deploy-${{hashFiles('**/package-lock.json')}}
- run: npm ci
- run: |
npx ts-json-schema-generator -p lib/models.ts -t ModelMap -o schema.json
npx js-yaml models.yml > models.json
npx ajv validate -s schema.json -d models.json
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.next/
/node_modules/
!/.vscode/
.now
.env
.env.build
now.local.json
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"editor.formatOnSave": true,
"files.exclude": {
"**/.next": true
},
"search.exclude": {
"**/.next": true
},
"files.watcherExclude": {},
"prettier.semi": false,
"prettier.singleQuote": true,
"prettier.bracketSpacing": false
}
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[email protected].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html].

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq]. Translations are available at
[https://www.contributor-covenant.org/translations].
35 changes: 35 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Contributing

[fork]: https://github.com/covid-modeling/web/fork
[pr]: https://github.com/covid-modeling/web/compare
[style]: https://github.com/google/gts
[code-of-conduct]: CODE_OF_CONDUCT.md

Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.

Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [MIT license](LICENSE).

Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms.

## Submitting a pull request

0. [Fork][fork] and clone the repository
1. Configure and install the dependencies.
2. Make sure the tests pass on your machine.
3. Create a new branch: `git checkout -b my-branch-name`
4. Make your change, add tests, and make sure the tests still pass
5. Push to your fork and [submit a pull request][pr]
6. Pat your self on the back and wait for your pull request to be reviewed and merged.

Here are a few things you can do that will increase the likelihood of your pull request being accepted:

- Follow the [style guide][style].
- Write tests.
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).

## Resources

- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
- [GitHub Help](https://help.github.com)
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:13-alpine

WORKDIR /app
COPY script script
COPY package*.json ./
RUN npm ci

CMD ["npm", "run", "dev"]
Loading

1 comment on commit b3d375f

@vercel
Copy link

@vercel vercel bot commented on b3d375f May 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.