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

Update prod #233

Merged
merged 35 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
540bdbf
Production (#203)
xHayden Nov 5, 2024
a2e495f
Fix issues (#205)
xHayden Nov 5, 2024
6e6739b
Fix issues (#206)
xHayden Nov 5, 2024
1b60b10
test route
xHayden Nov 5, 2024
5f664bd
fix test debug
xHayden Nov 5, 2024
1367518
temporary logging of env
xHayden Nov 5, 2024
98bcc56
Remove insecure route
xHayden Nov 5, 2024
4a452ae
Added game updater GitHub actions
samarth52 Nov 5, 2024
0922952
Merge pull request #207 from GTBitsOfGood/samarth/migrate-workflow
samarth52 Nov 5, 2024
2d3b595
nit
samarth52 Nov 5, 2024
a25b0ec
nit2
samarth52 Nov 5, 2024
6cd0b56
nit3
samarth52 Nov 5, 2024
c4a769b
nit4
samarth52 Nov 5, 2024
bb92404
nit5
samarth52 Nov 5, 2024
1a65dd2
nit6
samarth52 Nov 5, 2024
7666e64
nit7
samarth52 Nov 5, 2024
d1916fc
nit8
samarth52 Nov 5, 2024
56bd9a6
nit9
samarth52 Nov 5, 2024
37e0986
Merge pull request #208 from GTBitsOfGood/samarth/migrate-workflow
samarth52 Nov 5, 2024
bc51634
Fixed notes bug (#218)
Duckierstone42 Nov 15, 2024
af24a81
fixed bug by changing lessonPlan to lesson (#219)
Duckierstone42 Nov 15, 2024
ae79eb4
remove unallowed chars from xlsx sheet titles (#220)
aakashg00 Nov 15, 2024
904c52a
handle tag overflow in game gallery (#224)
yolanda-y-li Nov 15, 2024
09acbc5
Aakash/hits to page change (#225)
aakashg00 Nov 15, 2024
3808367
add option to edit role for admins (#223)
yolanda-y-li Nov 16, 2024
d160297
fix create game rerouting (#226)
03hchen Nov 16, 2024
3366e87
Fix CRON Job (#227)
samarth52 Nov 18, 2024
8faacd1
use current environment when fetching from analytics (#229)
aakashg00 Nov 19, 2024
e1b59ef
Helen/console errors (#222)
03hchen Dec 6, 2024
0abef25
Yolanda/home general design (#200)
xHayden Dec 6, 2024
5520977
Responsiveness (#231)
xHayden Dec 6, 2024
153699a
Added priv policy content, component and page; added socmed links (#232)
minimatime Dec 20, 2024
065ef51
Update README.md
xHayden Dec 20, 2024
42ac412
filter out local urls from cms dashboard
xHayden Dec 20, 2024
2d506a9
merge prod into dev
xHayden Dec 20, 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
7 changes: 0 additions & 7 deletions .github/workflows/game-popularity-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ jobs:
- uses: actions/checkout@v4
- uses: gautamkrishnar/[email protected]

run-dev-game-popularity-updater:
name: Update Game Popularity for Development Environment
uses: ./.github/workflows/reusable-game-popularity-updater.yml
with:
environment: "Development"
secrets: inherit

run-prod-game-popularity-updater:
name: Update Game Popularity for Production Environment
uses: ./.github/workflows/reusable-game-popularity-updater.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable-game-popularity-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
node-version: "18"
cache: "npm"

- name: Install dependencies
run: npm ci
Expand Down
8 changes: 4 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"plugins": ["prettier-plugin-tailwindcss"],
"endOfLine": "lf"
}
{
"plugins": ["prettier-plugin-tailwindcss"],
"endOfLine": "lf"
}
Empty file added NUL
Empty file.
31 changes: 12 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Jennifer Ann's Group is a nonprofit organization dedicated to preventing teen da
If you are unable to use the commands to retrieve the `.env` file, you can download or visit [Bitwarden](https://bitwarden.com/) and login using `[email protected]` and the master password. The `.env` file will be available within the vault.

- To setup the db with example data, run:

```sh
npm run add-initial-data
```
Expand Down Expand Up @@ -66,21 +67,7 @@ The Dockerized application will have live-reloading of changes made on the host
npm run add-initial-data
```

Note: You cannot have another mongo instance running at `mongodb://localhost:27017`, Docker will spin up the db inside of
I would fight atlas for you
5:36
Natasha Valluri
email: [email protected]
5:36
Natasha Valluri
password: Password123!
5:37
Natasha Valluri
I’m pretty sure
Hayden Carpenter
Hayden Carpenter 5:47 PMstions/40452508/docker-error-on-an-entrypoint-script-no-such-file-or-directory) to fix it.
Note: You cannot have another mongo instance running at `mongodb://localhost:27017`, Docker will spin up the db, interally and expose it, instead.

## Major Technologies

Expand All @@ -89,11 +76,14 @@ Hayden Carpenter 5:47 PMstions/40452508/docker-error-on-an-entrypoint-script-no
- [Tailwind CSS](https://tailwindcss.com)

## Documentation

### Secrets

- Production secrets: `.env` in Bitwarden.
- Local secrets: `.env.local` in Bitwarden. Used when setting up local container with the Bitwarden CLI.
- Local secrets: `.env.local` in Bitwarden. Used when setting up local container with the Bitwarden CLI.

### Databases

Production Database: We're planning to spin up Mongo in Azure, but we've had issues with Azure giving us permission to. The NP is aware of this problem and we're trying to sort it out, but we have been unable to do so before DRB. We have temporarily spinned up a cluster on Atlas using the DRB test email.

Local Database: MongoDB on Atlas on the Jennifer Ann's Mongo Account (Sign in with our Gmail located in Bitwarden).
Expand All @@ -103,11 +93,13 @@ Local Database: MongoDB on Atlas on the Jennifer Ann's Mongo Account (Sign in wi
We use mongoose for our schemas. Updating database objects requires updating those schemas in `server/db/models` and altering the actions in the `server/db/actions` directory accordingly. The connection strings are in the environment files store in Bitwarden. There should be no problem creating a new Mongo database, updating the connection string, and running `npm run add-initial-data` if you want to re-create the database.

### File Storage

For accessing both `application-files` (images, pdfs, etc) and `webgl-builds`, we use Backblaze B2 for hosting and Cloudflare as a bridge to connect to it. Cloudflare allows us to reduce the costs on data transfer.

There is only __one__ Cloudflare account and only __one__ Backblaze account. The same Cloudflare worker is used for both production and development, as all it really does is mitigate our costs and isn't responsible for any data storage. There are __two__ versions of the buckets on the Backblaze account. One is for dev and one is for prod, and those buckets are selected at runtime based on the `NODE_ENV` variable. The `B2_BUCKET_ID_BUILD` and `B2_BUCKET_ID_APPLICATION` env variables have to be updated accordingly as well, corresponding to the production/development bucket they are using. Each set of buckets are only used for their respective environments.
There is only **one** Cloudflare account and only **one** Backblaze account. The same Cloudflare worker is used for both production and development, as all it really does is mitigate our costs and isn't responsible for any data storage. There are **two** versions of the buckets on the Backblaze account. One is for dev and one is for prod, and those buckets are selected at runtime based on the `NODE_ENV` variable. The `B2_BUCKET_ID_BUILD` and `B2_BUCKET_ID_APPLICATION` env variables have to be updated accordingly as well, corresponding to the production/development bucket they are using. Each set of buckets are only used for their respective environments.

#### Reconfiguring

Any data can be put in the Backblaze buckets. The `cloudflare-b2` package inside of this repository can be used to update the configuration of the Cloudflare worker. Simply update the `src/index.js` file and run `npm run deploy`. To update the CORS policy for Backblaze, you have to use the [B2 CLI tool](https://www.backblaze.com/docs/cloud-storage-command-line-tools). Our CORS policy is kept traack of in the `b2-cors.json` file and then we update the actual policy with `b2-tools`.

### Juno
Expand All @@ -116,12 +108,13 @@ We use [Juno](https://github.com/GTBitsOfGood/juno) for email services. Juno cur

### Analytics

We use [bog-analytics](https://github.com/GTBitsOfGood/bog-analytics) for analytics. This will always be hosted on BoG infrastructure and we have no plans to move it. The actual data API is only used from the server, and we use internal `api/events/log` and `api/events/view` routes to access it. There is an useAnalytics hook that calls this API with the same syntax as the npm package.
We use [bog-analytics](https://github.com/GTBitsOfGood/bog-analytics) for analytics. This will always be hosted on BoG infrastructure and we have no plans to move it. The actual data API is only used from the server, and we use internal `api/events/log` and `api/events/view` routes to access it. There is an useAnalytics hook that calls this API with the same syntax as the npm package.

### Cron Jobs

We have a few cron jobs that run periodically for updating data.

- Every day, we check if data should be deleted following GDPR (user data should be deleted 30 days after deleting an account).
- Every day, we recalculate 'popularity' values for games to decide rankings.

These jobs have verification keys as specified in the .env and can be run from wherever. We're using Github Actions to run them.
These jobs have verification keys as specified in the .env and can be run from wherever. We're using Github Actions to run them.
6 changes: 5 additions & 1 deletion cloudflare-b2/b2-cors.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[
{
"allowedHeaders": ["*"],
"allowedOperations": ["b2_upload_file", "b2_download_file_by_id", "b2_download_file_by_name"],
"allowedOperations": [
"b2_upload_file",
"b2_download_file_by_id",
"b2_download_file_by_name"
],
"allowedOrigins": [
"http://localhost:3000",
"https://jennifer-anns.netlify.app",
Expand Down
2 changes: 1 addition & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"components": "@/components",
"utils": "@/lib/utils"
}
}
}
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.8'
version: "3.8"

services:
app:
Expand Down Expand Up @@ -46,4 +46,4 @@ networks:

volumes:
mongodb-data:
node_modules:
node_modules:
5 changes: 4 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const nextConfig = {
images: {
domains: ["cloudflare-b2.bogjenniferanns.workers.dev"],
},
productionBrowserSourceMaps: process.env.NEXT_PUBLIC_ENV !== "production"
productionBrowserSourceMaps: process.env.NEXT_PUBLIC_ENV !== "production",
experimental: {
middlewarePrefetch: "strict",
},
};

module.exports = nextConfig;
Loading
Loading