-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overhaul technical docs, split in to multiple other docs
* Add operation docs * Extract "releasing" docs from development docs * Extract third party service docs from development docs * Update envvar docs
- Loading branch information
Showing
5 changed files
with
249 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
title: "Operation" | ||
--- | ||
|
||
This application is operated by NSIDC. In the NSIDC environment, all of the values | ||
needed are provisioned on to deployment hosts with Puppet. The secret values are pulled | ||
from our secrets management system. | ||
|
||
|
||
## Application version | ||
|
||
To pull the correct image from DockerHub, the application version must be passed. | ||
See [our environment variable reference][envvars-doc] for more. | ||
|
||
|
||
## Session security | ||
|
||
The application needs a randomized secret key to secure sessions. Generating a new one | ||
every time would break all sessions every time the app is re-deployed, so we store a | ||
persistent value and pass it in as an environment variable. This is a setting for Flask | ||
(`FLASK_SECRET_KEY`), not something we've implemented specifically for this app. | ||
See [our environment variable reference][envvars-doc] for more. | ||
|
||
|
||
## Proxy switch | ||
|
||
When the app is running, for example behind a proxy, at any path other than `/`, it | ||
needs to be told by request headers (`X-Forwarded-Prefix`) what that path is. To enable | ||
that behavior, set `USAON_BENEFIT_TOOL_PROXY` envvar to `true`. | ||
See [our environment variable reference][envvars-doc] for more. | ||
|
||
|
||
## TLS certificate | ||
|
||
The application expects a TLS certificate to be provided to it from the host. Our | ||
Compose YAML uses environment variables to find these files on the host. | ||
See [our environment variable reference][envvars-doc] for more. | ||
|
||
These files are passed in to the container as | ||
[secrets](https://docs.docker.com/compose/use-secrets/). | ||
|
||
> [!NOTE] | ||
> | ||
> If they expire and need to be regenerated, the application may need to be restarted to | ||
> pick up the change. | ||
|
||
## Single Sign On (SSO) | ||
|
||
Currently, we only support Google as an SSO provider. We pass in the needed values as | ||
environment variables. | ||
See [our environment variable reference][envvars-doc] for more. | ||
|
||
|
||
## Database connectivity | ||
|
||
This application expects a PostgreSQL database to be running. The connection | ||
information, including credentials, are passed in as environment variables. | ||
See [our environment variable reference][envvars-doc] for more. | ||
|
||
|
||
[envvars-doc]: /reference/envvars.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
title: "Releasing" | ||
--- | ||
|
||
"Releasing" means sharing a completed code package to the world. It does not mean | ||
running that code package! That would be "deployment", and can look different depending | ||
on who is doing the deployment on on to what system. | ||
|
||
|
||
## CHANGELOG | ||
|
||
Author a new changelog section titled `NEXT_VERSION`. The `bump-my-version` step will | ||
replace this magic string with a correct version identification. | ||
|
||
|
||
## Bump the version | ||
|
||
This application users [semver](https://semver.org). | ||
|
||
The version number must be updated in many places, so we use `bump-my-version` to | ||
automate the process. To increase the minor version number: | ||
|
||
```bash | ||
bump-my-version bump minor | ||
``` | ||
|
||
|
||
## Release | ||
|
||
After everything is merged, create a release in the GitHub UI. | ||
|
||
Releases that are labeled `alpha`, `beta`, or `rc` must be marked as | ||
pre-releases. | ||
|
||
After the release is created, GitHub Actions will start building the container images. | ||
Once GitHub Actions is done, you can deploy the app with the deploy script | ||
(`deploy/deploy`). | ||
|
||
> [!NOTE] | ||
> | ||
> At NSIDC, this deployment should be done with _Garrison_ after automations have | ||
> successfully completed. | ||
|
||
### Automations | ||
|
||
This will trigger [GitHub Actions](https://github.com/nsidc/usaon-benefit-tool/actions) | ||
to release new container images to Docker Hub and GitHub Packages. It should take at | ||
most 5-10 minutes. | ||
|
||
The ReadTheDocs `stable` page will also automatically update. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,47 @@ | ||
# Environment variables | ||
--- | ||
title: "Environment variables" | ||
--- | ||
|
||
|
||
## Deployment | ||
|
||
* `USAON_BENEFIT_TOOL_VERSION`: Which tag on Docker Hub to deploy. | ||
|
||
|
||
## Web | ||
|
||
* `FLASK_SECRET_KEY` (required): For securely signing session cookie and other security | ||
* `FLASK_SECRET_KEY`: For securely signing session cookie and other security | ||
needs ([doc](https://flask.palletsprojects.com/en/2.2.x/config/#SECRET_KEY)). | ||
* `USAON_BENEFIT_TOOL_PROXY`: True if we are deploying with a proxy to pass the header `X-Forwarded-Prefix`. | ||
* `USAON_BENEFIT_TOOL_PROXY`: "True" if we are deploying with a proxy to pass the header | ||
`X-Forwarded-Prefix`. | ||
|
||
|
||
### Transport Level Security (TLS) | ||
|
||
* `TLS_CERT_FILE`: Path to `.crt` file. | ||
* `TLS_KEY_FILE`: Path to `.key` file. | ||
|
||
|
||
## SSO | ||
|
||
* `OAUTHLIB_INSECURE_TRANSPORT=1` NOTE: Do not set this in production. | ||
* `OAUTHLIB_RELAX_TOKEN_SCOPE=1` Set in Compose YAML. | ||
* `USAON_BENEFIT_TOOL_GOOGLE_CLIENT_ID`: The google credential id. (stored in vault) | ||
* `USAON_BENEFIT_TOOL_GOOGLE_CLIENT_SECRET`: The google sso credential secret. (stored in vault) | ||
* `USAON_BENEFIT_TOOL_GOOGLE_CLIENT_ID`: The google credential id. | ||
* `USAON_BENEFIT_TOOL_GOOGLE_CLIENT_SECRET`: The google sso credential secret. | ||
* `OAUTHLIB_RELAX_TOKEN_SCOPE=1`: Should always be set; hardcoded in Compose YAML. | ||
|
||
|
||
### Development only | ||
|
||
> [!IMPORTANT] | ||
> | ||
> **Do not set in production.** | ||
* `OAUTHLIB_INSECURE_TRANSPORT=1`: Enable SSO when developing without HTTPS. | ||
|
||
|
||
## Database | ||
|
||
All of the below environment variables are required. | ||
* `USAON_BENEFIT_TOOL_DB_HOST`: The host on which the database is running (NOTE: Only postgres supported) | ||
* `USAON_BENEFIT_TOOL_DB_PORT`: The access port for the database | ||
* `USAON_BENEFIT_TOOL_DB_HOST`: The host on which the database is running. | ||
* `USAON_BENEFIT_TOOL_DB_PORT`: The access port for the database. | ||
* `USAON_BENEFIT_TOOL_DB_USER`: Username with permissions to create tables, delete tables, insert, update, | ||
delete | ||
* `USAON_BENEFIT_TOOL_DB_PASSWORD`: Password for the above user | ||
delete. | ||
* `USAON_BENEFIT_TOOL_DB_PASSWORD`: Password for the above user. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
title: "Third party services" | ||
--- | ||
|
||
## Google SSO | ||
|
||
A Google OAuth application is required for login to work. Our app requires a client ID | ||
and client secret to communicate with the Google OAuth application. | ||
|
||
|
||
### Initial setup | ||
|
||
_TODO_ | ||
|
||
|
||
### Redirect URIs | ||
|
||
> :warning: This configuration needs to be updated for every unique deployment URL of | ||
> this app. | ||
Our app's deployed URIs also must be registered with Google as ["Authorized redirect | ||
URIs"](https://console.cloud.google.com/apis/credentials) (from the link, click on your | ||
app under the "OAuth 2.0 Client IDs" section). The following URIs should be provided for | ||
local development: | ||
|
||
* `http://localhost:5000/google_oauth/google/authorized` | ||
* `http://127.0.0.1:5000/google_oauth/google/authorized` | ||
|
||
Add more URIs (substituting the protocol, hostname, and port number, and nothing else) | ||
for each separate deployment. |