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

[Issue #3474] Doc updates for auth #3491

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

acouch
Copy link
Collaborator

@acouch acouch commented Jan 10, 2025

Summary

Fixes #3474

Time to review: 10 mins

Changes proposed

documentation/api/development.md

This doesn't remove anything, moves some of the local setup initially at the top under the ## Local (non-Docker) section, adds some of the recent commands added including local stack and the oauth mock, and user auth setup

frontend/README.md

Removes detail on docker and other setup for the frontend development doc.

documentation/frontend/development.md

Reorganizes and consolidates frontend dev setup and aligns some of the headers with the API development doc.

@acouch acouch marked this pull request as ready for review January 13, 2025 17:10
Base automatically changed from feature/nextjs-auth to main January 13, 2025 17:14
@acouch acouch force-pushed the acouch/issue-3474-dev-doc-auth-updates branch from 7ec7e79 to 84828d9 Compare January 13, 2025 17:17
@doug-s-nava

This comment was marked as resolved.

Copy link
Collaborator

@doug-s-nava doug-s-nava left a comment

Choose a reason for hiding this comment

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

a lot of these are nits but I couldn't help myself.

Curious if we want to provide any more detail on the auth process, around things like token usage and cookie management, or if that is a case where we need to be careful not to overshare


## OpenSearch setup
Run `make init && make run logs` to start the local containers. The application will be available at `http://localhost:8080/docs`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like directing to the docs site is a little confusing here. Would just saying "http://localhost:8080" make more sense?

* Flask API (http://localhost:8080)
* Postgres database
* OpenSearch node
* OpenSearchdashboard (http://localhost:5601)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* OpenSearchdashboard (http://localhost:5601)
* OpenSearch Dashboard (http://localhost:5601)

* Postgres database
* OpenSearch node
* OpenSearchdashboard (http://localhost:5601)
* localstack
Copy link
Collaborator

Choose a reason for hiding this comment

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

would be nice to have a brief note on what localstack is used for in this context. I had to look it up but seems like s3?

* **Localstack (local s3)**
* Run `make init-localstack`
* **Mock OAuth server**
* Run `make init-mock-oath2`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Run `make init-mock-oath2`
* Run `make init-mock-oauth2`


* **Localstack (local s3)**
* Run `make init-localstack`
* **Mock OAuth server**
Copy link
Collaborator

Choose a reason for hiding this comment

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

this doesn't seem to be mentioned in any other documentation. Is it worth mentioning in this file what this is for and how / when to use it, maybe in the "User Authentication" section?

1. Download the VS Code extension described in these [Playwright docs](https://playwright.dev/docs/running-tests#run-tests-in-vs-code)
2. Follow the [instructions](https://playwright.dev/docs/getting-started-vscode#running-tests) Playwright provides

Playwright E2E tests run "local-to-local", requiring both the frontend and the API to be running for the tests to pass - and for the database to be seeded with data.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've been confused by this - I actually get an error if I try to run e2e tests locally in VS code while running a dev server. If I have a built application in the .next directory, though, it seems to work without starting an actual server, and seems to start its own automatically


Playwright E2E tests run "local-to-local", requiring both the frontend and the API to be running for the tests to pass - and for the database to be seeded with data.

In CI, the "Front-end Checks" workflow (`.github/workflows/ci-frontend-e2e.yml`) summary will include an "Artifacts" section where there is an attached "playwright-report". [Playwright docs](https://playwright.dev/docs/ci-intro#html-report) describe how to view HTML Report in more detail.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
In CI, the "Front-end Checks" workflow (`.github/workflows/ci-frontend-e2e.yml`) summary will include an "Artifacts" section where there is an attached "playwright-report". [Playwright docs](https://playwright.dev/docs/ci-intro#html-report) describe how to view HTML Report in more detail.
In CI, the "Frontend Checks" workflow (`.github/workflows/ci-frontend-e2e.yml`) runs Playwright tests, and will include a summary when complete, with an "Artifacts" section where there is an attached "playwright-report". [Playwright docs](https://playwright.dev/docs/ci-intro#html-report) describe how to view the HTML Report in more detail.


### Search and Opportunity Pages

The `/search` and opportunity pages rely on the application API. The API endpoint and authenticaion token are defined in `.env.development` and can be overwritten in an `.env.ocal` file.
Copy link
Collaborator

@doug-s-nava doug-s-nava Jan 14, 2025

Choose a reason for hiding this comment

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

Suggested change
The `/search` and opportunity pages rely on the application API. The API endpoint and authenticaion token are defined in `.env.development` and can be overwritten in an `.env.ocal` file.
The `/search` and opportunity pages rely on the application API. The API endpoint and authentication token are defined in `.env.development` and can be overwritten in an `.env.local` file.


The `/search` and opportunity pages rely on the application API. The API endpoint and authenticaion token are defined in `.env.development` and can be overwritten in an `.env.ocal` file.

Update the `API_URL` can be set to connect to prod (`https://api.simpler.grants.gov`) or lower environment URLs to quickly develop using production or development data. This requires the correct `API_AUTH_TOKEN` variable to be set correctly.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Update the `API_URL` can be set to connect to prod (`https://api.simpler.grants.gov`) or lower environment URLs to quickly develop using production or development data. This requires the correct `API_AUTH_TOKEN` variable to be set correctly.
The `API_URL` environment variable can be set to connect to prod (`https://api.simpler.grants.gov`) or lower environment URLs to quickly develop using production or development data. To successfully connect to a deployed API, the `API_AUTH_TOKEN` variable must be set correctly for the environment.


Update the `API_URL` can be set to connect to prod (`https://api.simpler.grants.gov`) or lower environment URLs to quickly develop using production or development data. This requires the correct `API_AUTH_TOKEN` variable to be set correctly.

To connect to the development version of the API, run `make init && db-seed-local && populate-search-opportunities` in the `/api` folder.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
To connect to the development version of the API, run `make init && db-seed-local && populate-search-opportunities` in the `/api` folder.
To start a local development version of the API, run `make init && db-seed-local && populate-search-opportunities` in the `/api` folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update developer documentation for auth updates
2 participants