diff --git a/.github/READMEFIRST.md b/.github/READMEFIRST.md index 841a410b8..c00402181 100644 --- a/.github/READMEFIRST.md +++ b/.github/READMEFIRST.md @@ -12,8 +12,8 @@ This directory holds the Codebloom infrastructure code. That includes workflows ├── ai-review.yml # Qodo review agent (includes custom logic to inject Notion task context to AI agent) ├── approval.yml # DEPRECATED - used to handle custom approval rules not natively supported by GitHub ├── ci-cd.yml # Main CI/CD pipeline that runs tests, builds images, triggers deployments, and more. -├── copy-db.yml # command to copy prod db to staging db -├── deploy-stg.yml # command to deploy to staging +├── copy-command.yml # command to copy prod db to staging db +├── e2e.yml # daily E2E tests ├── help-command.yml # one-time command on PR launch to show all available slash commands ├── pr-verifications.yml # validates PR & commits against Notion └── slash.yml # helper workflow to trigger slash command invocations to the right workflow @@ -30,7 +30,7 @@ This directory holds the Codebloom infrastructure code. That includes workflows All PRs must be tested in our staging environment to make sure that it won't break anything (if there's a reason it cannot be tested in staging, it must be indicated in the PR description). -To trigger deployment to staging, you just have to comment `/deploy` as a comment in the PR. +`/deploy` is registered, but its target `deploy-command.yml` workflow is missing from this checkout, so it cannot currently trigger staging deployment. > [!NOTE] > It should be a regular comment inside of the first page of the PR; writing the command as a review on a file or line(s) will not trigger deployment. diff --git a/.github/scripts/README.md b/.github/scripts/README.md index 838430543..0c43bf26f 100644 --- a/.github/scripts/README.md +++ b/.github/scripts/README.md @@ -12,7 +12,7 @@ This directory contains helper scripts that are used in our CI/CD workflows. The ├── load-secrets # used to load environment variables (and automatically mask them in GitHub Actions) as a JS object. ├── notion # notion-specific logic (includes helper functions that can be shared as well as a `main()` function to directly run Notion verification checks against PR & commits) ├── patches # bun patches applied to certain packages to fulfill our need -├── redeploy # redeployment logic (db migrations, DigitalOcean, Coolify) +├── redeploy # redeployment logic (db migrations and Kubernetes manifest PRs) ├── test # includes multiple different test flows (backend, frontend, compile checks only) ├── types.ts # shared types ├── utils # shared utils @@ -33,18 +33,6 @@ This directory contains helper scripts that are used in our CI/CD workflows. The ## Run -To run a script, simply use the following snippet below: +Run scripts from the repository root with Bun. Each script declares its required arguments in its `yargs` configuration. -```bash -bun run .github/scripts/redeploy/index.ts - -# or use shorthand since it's an index.ts file - -bun run .github/scripts/redeploy - -# you do not need to call `dotenvx run --` before calling Bun Shell scripts. they already have a way to -# parse env files and use them as a JS object at runtime (masked in GitHub Actions). - -# if you need to explicitly pass in an environment variable, do it like so -ENVIRONMENT=staging bun run .github/scripts/redeploy -``` +For deployment, `redeploy/index.ts` requires `--sha` (or `GITHUB_SHA`) and GitHub App credentials in the process environment. Select the environment with `--environment staging|production`. Running the script locally does not automatically load environment files. diff --git a/Justfile b/Justfile index af3ccdfac..e80c1e6be 100644 --- a/Justfile +++ b/Justfile @@ -77,7 +77,7 @@ email-gen *args: # Run the dev servers (backend & frontend) dev *args: - cp internal/pre-commit .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit && npx concurrently "just backend-dev" "just frontend-dev" {{args}} + npx concurrently "just backend-dev" "just frontend-dev" {{args}} # Run the dev servers (backend & frontend) but the backend will launch a debugger server. devd *args: diff --git a/README.md b/README.md index 181d7a58f..880dc6cf5 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Codebloom is a leaderboard system that game-ifies the aspect of solving LeetCode ## Features -_Last updated: 02/14/2026_ +_Last updated: 09/03/2026_ Codebloom features include @@ -86,12 +86,12 @@ Please go to [`docs/setup/README.md`](./docs/local/README.md) to begin setup ins ## Authors -The current lead developer of the Codebloom development team is Arshadul Monir. If you have any inquires or questions, please direct them to him. +The current lead developers of the Codebloom development team are Tahmid Ahmed and Angela Yu. If you have any inquires or questions, please direct them to them. - - - +The current members of the core development team are: + +- Nancy Huang > [!NOTE] > Codebloom is open-source and happily accepts contributions from the community. However, all pull requests are subject to review by the development team. Please click [here](./CONTRIBUTING.md) to learn more. @@ -100,11 +100,9 @@ The current lead developer of the Codebloom development team is Arshadul Monir. Thank you to all the previous members of the Codebloom development team that have helped make Codebloom possible <3 -- Tahmid Ahmed (Previous lead developer, founding member) - Alfardil Alam (Previous developer, founding member) - Alisha Zaman (Previous developer, founding member) -- Angela Yu (Previous developer) -- Nancy Huang (Previous developer) +- Arshadul Monir (Previous developer) ## Patina Network diff --git a/docs/features/DISCORD-INTEGRATIONS.md b/docs/features/DISCORD-INTEGRATIONS.md index 0f34232be..41239b850 100644 --- a/docs/features/DISCORD-INTEGRATIONS.md +++ b/docs/features/DISCORD-INTEGRATIONS.md @@ -73,7 +73,6 @@ This slash command will return a refreshed leaderboard embed (similar to the aut Current restrcitions: -- We cannot currently update the leaderboard via Discord (though we are working on that now!) - If the club requested a leaderboard update before 5 minutes have elapsed, the command will then fail & indicate how long to wait until you can request a new update. - **NOTE**: it will not show the fail response to every user, but only to the user who triggered the command. diff --git a/docs/local/DEV-COMMANDS.md b/docs/local/DEV-COMMANDS.md index 0e5503f19..fcaf4dab1 100644 --- a/docs/local/DEV-COMMANDS.md +++ b/docs/local/DEV-COMMANDS.md @@ -18,13 +18,9 @@ > [!WARNING] > Should be used sparingly -`just copy-stg` - Will pull credentials from `infra/.env.production` and do the following: +`just migrate-stg` - Migrate staging using `.env.staging` and versioned migrations only. -1. Drop all tables from staging db -2. Copy all data from production db to staging db -3. Scrub/sanitize all records/tables that should not be allowed in staging db. - > [!WARNING] - > Should be used sparingly +`just copy-stg` currently references the missing `infra/copy-prod-db.sh` and does not work. The implemented production-to-staging copy is the `/copy` PR command, backed by [copy-command.yml](../../.github/workflows/copy-command.yml) and [copy-prod-db/index.ts](../../.github/scripts/copy-prod-db/index.ts). It replaces staging data and then sanitizes it. # Frontend @@ -34,7 +30,7 @@ `just frontend-dev` - Will only start the frontend Vite dev server. -`just types-gen` - Regenerate the `schema.ts` file. +`just type-gen` - Regenerate the `schema.ts` file. > [!WARNING] > The backend must be running @@ -49,9 +45,9 @@ `just backend-dev-debug` - Will only start the backend Spring dev server, but will wait for a JVM debugger to attach to port 5005 first. -`just backend-test` - Run Checkstyle and then the full test suite. +`just backend-test` - Check Spotless formatting, then run Checkstyle and Maven verification with the `ci` profile, loading `.env` and `.env.shared`. -`just backend-coverage` - Runs `just backend-test` and opens up the JaCoCo test coverage page in your default browser. +After `just backend-test`, view the JaCoCo report at `target/site/jacoco/index.html`. There is currently no `backend-coverage` recipe. `just backend-spotless` - Runs the backend formatter (currently Spotless with Palantir Java Formatter) and indicates whether or not you need to run the formatter on any files. diff --git a/docs/local/SETUP.md b/docs/local/SETUP.md index 837e96530..c1e4ddf79 100644 --- a/docs/local/SETUP.md +++ b/docs/local/SETUP.md @@ -8,7 +8,7 @@ The following general software needs to be installed on your local machine: 1. `dotenvx` - Used to load environment variables from the root `.env` file. 1. `node` - Javascript runtime to run our frontend TypeScript code. 1. `corepack` - A package manager for package managers (???) to help us set a consistent `pnpm` version across all devs. -1. `pnpm@9` - Package manager that works faster than the default npm package manager. +1. `pnpm@10.24.0` - Package manager that works faster than the default npm package manager. ## MacOS @@ -196,7 +196,7 @@ You can feel free to use any viewer you want, but we would recommend [DataGrip]( # Secrets -You can speed up the setup process by making a copy of `.env.example` to `.env`. +You can speed up the setup process by making a copy of `example.env` to `.env`. You will also find explanations and documentation about how to source the value for each key. If there is a key specific to an environment (such as `CI` or `staging` environment), please consult the tech docs within the `CI` group. diff --git a/docs/observability/README.md b/docs/observability/README.md index aead236ca..4b1c789b1 100644 --- a/docs/observability/README.md +++ b/docs/observability/README.md @@ -2,7 +2,7 @@ Grafana -Codebloom uses Spring Boot Actuator and Prometheus to provide operational insights into the running application. We also collect logs via OpenSearch, which is setup through the DigitalOcean App Platform [(view app spec here)](../../.do/specs.ts). Both of these data sources are then fed to a Grafana instance hosted on [monitor.tahmid.io](https://monitor.tahmid.io) +Codebloom uses Spring Boot Actuator and Prometheus to provide operational insights into the running application. The application deployment now targets Kubernetes; see [infrastructure documentation](../../infra/README.md). OpenSearch and Grafana infrastructure configuration is not stored in this repository. Both of these data sources are then fed to a Grafana instance hosted on [monitor.tahmid.io](https://monitor.tahmid.io) ## Grafana @@ -17,20 +17,13 @@ Spring Boot Actuator exposes operational information about the running applicati ### Security -All actuator endpoints are protected with HTTP Basic Authentication to prevent unauthorized access to sensitive operational data. - -**Authentication Details:** - -- **Authentication Type:** HTTP Basic Auth -- **Role Required:** `ACTUATOR` -- **Credentials:** Stored in environment variables - - `ACTUATOR_USERNAME` - Username for actuator endpoints - - `ACTUATOR_PASSWORD` - Password for actuator endpoints (generate with `openssl rand -base64 48 | head -c 64`) +The checked-in [SecurityConfig.java](../../src/main/java/org/patinanetwork/codebloom/api/auth/security/SecurityConfig.java) permits these requests and does not configure HTTP Basic authentication or an `ACTUATOR` role. `ACTUATOR_USERNAME` and `ACTUATOR_PASSWORD` are not wired into the application configuration. Any access restrictions applied by deployment infrastructure must be checked in that infrastructure separately. ### Available Endpoints Currently exposed endpoints: +- **`/actuator/health`** - Application health - **`/actuator/prometheus`** - Prometheus-formatted metrics endpoint for scraping ## Prometheus Metrics @@ -45,7 +38,7 @@ Prometheus metrics provide detailed insights into application performance, JVM s http://localhost:8080/actuator/prometheus ``` -(Requires HTTP Basic Auth with actuator credentials) + **Staging:** @@ -63,12 +56,10 @@ https://codebloom.patinanetwork.org/actuator/prometheus To test the actuator endpoint locally: -1. Ensure your `.env` file has `ACTUATOR_USERNAME` and `ACTUATOR_PASSWORD` set -2. Start the application (`just dev`) -3. Access the endpoint using curl: +1. Start the application (`just dev`). +2. Request an exposed endpoint: ```bash -curl -u actuator:your_password http://localhost:8080/actuator/prometheus +curl http://localhost:8080/actuator/prometheus +curl http://localhost:8080/actuator/health ``` - -Or use a browser and enter the username/password when prompted. diff --git a/email/README.md b/email/README.md index f243cf4ac..22c4d6c48 100644 --- a/email/README.md +++ b/email/README.md @@ -12,7 +12,7 @@ These templates are then built into `*.html` files which are then loaded at runt ### Run 1. Run `pnpm i` to install all dependencies -1. Run `just dev` from the root directory to run the React Email dev server with sane defaults +1. Run `just email-dev` from the root directory to run the React Email dev server with sane defaults 1. Run `pnpm build` to build all React Email files under `emails/` 1. If you would like to build & copy all template files to the backend, run `just email-gen` from the root directory diff --git a/infra/README.md b/infra/README.md index 28b9c6ffe..e9ad78325 100644 --- a/infra/README.md +++ b/infra/README.md @@ -1,12 +1,12 @@ # `infra/` > [!NOTE] -> Our staging to production migration script is located [here](https://github.com/tahminator/codebloom/tree/main/.github/scripts/copy-prod-db/index.ts#L28). +> Our production to staging copy script is located [here](https://github.com/tahminator/codebloom/tree/main/.github/scripts/copy-prod-db/index.ts#L28). [`clean-stg-db.SQL`](./clean-stg-db.SQL) is a SQL script used to clean and scramble staging data after copying the production database. -This directory contains the Dockerfile used to build the main Codebloom image, which is then uploaded to [hub.docker.com/r/tahminator/codebloom](https://hub.docker.com/r/tahminator/codebloom). +This directory contains the Dockerfile used to build the main Codebloom image, which is then uploaded to [hub.docker.com/r/patinanetwork/codebloom](https://hub.docker.com/r/patinanetwork/codebloom). -The image is then deployed to our Kubernetes cluster (docs WIP). +The redeploy script opens an image-tag PR in `Patina-Network/k8s-manifests` for deployment to our Kubernetes cluster. There is a Bun Shell script which helps us manage the workflow for deployments across production and staging, which can be found at [`.github/scripts/redeploy/index.ts`](../.github/scripts/redeploy/index.ts). diff --git a/src/README.md b/src/README.md index 2573cf3e0..3d0833b44 100644 --- a/src/README.md +++ b/src/README.md @@ -133,7 +133,7 @@ src/main ### Security Details -- **CSRF Protection** - Automatically managed by Spring Security, so no additional configuration is required. +- **CSRF Protection** - Disabled in the main OAuth security chain. - **Auth Validator / Session Token Cookie Setter** - Managed by the `CustomAuthenticationSuccessHandler`. - Cookie Settings: - Name: `session_token` @@ -229,10 +229,10 @@ The [`LeetcodeClient.java`](https://github.com/tahminator/codebloom/blob/main/sr We have a scheduled task at [`LeetcodeAuthStealer.java`](https://github.com/tahminator/codebloom/blob/main/src/main/java/org/patinanetwork/codebloom/scheduled/auth/LeetcodeAuthStealer.java) that: -- Runs every 30 minutes to refresh session cookies +- Runs hourly and reuses database session cookies less than four hours old - Uses Playwright to automate GitHub OAuth login flow - Stores the `LEETCODE_SESSION` cookie in our database -- Falls back to email alerts if authentication fails +- Supports asynchronous cookie reloads when authentication needs refreshing This is necessary because leetcode.com requires authenticated requests for most API calls.