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

Add CFGOV Helm Charts for Local Deployment to K8s #8683

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

Conversation

cooldragontattoo
Copy link
Contributor

@cooldragontattoo cooldragontattoo commented Dec 11, 2024

This PR adds a CFGOV Helm chart that allow for deployment to a local K8s cluster.

Additions

  • A CFGOV Helm Chart that includes:
    • 2 init containers:
      • A Busybox container to ensure that the Postgresql and Opensearch Services are running
      • A data migration container that loads test data into the Postgresql Service and indexes that data to the Opensearch service.
    • 2 containers:
      • The CFGOV application (running on PORT 8000)
      • The Apache server that proxies to to that web application (running on PORT 80)
  • Adds index.sh and test.sql.gz to the CFGOV docker image.
  • A helm deployment guide to the master docs
  • A helm-init.sh script to deploy the helm chart effortlessly.
  • A helm-uninstall.sh script that tears down everything related to the CFGOV Helm deployment.
  • A Helm notes script that outputs instructions for accessing the CFGOV deployment when deployed locally.

How to test this PR

  1. Make sure you have a local K8s cluster running.
  2. Clone the PR.
  3. Run: docker build . -t cfgov
  4. Run: helm-init.sh
  5. Port forward the cfgov-apache container to a local port.
  6. Access your application at localhost:<local_port>
  7. Ensure the home page is displaying.
  8. Visit localhost:<local_port>/about_us/blog to make sure the Open Search index is working.

Notes and todos

Checklist

  • PR has an informative and human-readable title
    • PR titles are used to generate the change log in releases; good ones make that easier to scan.
    • Consider prefixing, e.g., "Mega Menu: fix layout bug", or "Docs: Update Docker installation instructions".
  • Changes are limited to a single goal (no scope creep)
  • Code follows the standards laid out in the CFPB development guidelines
  • Future todos are captured in comments and/or tickets
  • Project documentation has been updated, potentially one or more of:
    • This repo’s docs (edit the files in the /docs folder) – for basic, close-to-the-code docs on working with this repo
    • CFGOV/platform wiki on GHE – for internal CFPB developer guidance
    • CFPB/hubcap wiki on GHE – for internal CFPB design and content guidance

Front-end testing

Browser testing

Check the current browser support cutoff list](https://cfpb.github.io/consumerfinance.gov/browser-support#current-browser-support-metrics) for browsers that are advisable
to prioritize for testing.

Accessibility

  • Keyboard friendly (navigable with tab, space, enter, arrow keys, etc.)
  • Screen reader friendly
  • Does not introduce new errors or warnings in WAVE

Other

  • Is useable without CSS
  • Is useable without JS
  • Does not introduce new lint warnings
  • Flexible from small to large screens

Copy link
Member

@willbarton willbarton left a comment

Choose a reason for hiding this comment

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

As a question about best-practices, should the helm/charts/postgresql-16.2.3.tgz and helm/charts/opensearch-1.31.3.tgz files be committed to the repo?

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
cfgov/apache/dockerfile Outdated Show resolved Hide resolved
@cooldragontattoo
Copy link
Contributor Author

@willbarton, I made your changes. @chosak, do you also want to review?

Copy link
Member

@willbarton willbarton left a comment

Choose a reason for hiding this comment

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

We need to get the tests running and passing, and it looks like they're failing on OpenSearch.

@@ -360,6 +360,7 @@
os.getenv("ES_USER", "admin"),
os.getenv("ES_PASS", "admin"),
),
"use_ssl": True,
Copy link
Member

@willbarton willbarton Dec 19, 2024

Choose a reason for hiding this comment

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

It looks like this setting is causing a problem running the unit tests and functional tests in GHA.

I think we'll need to add a OPENSEARCH_DSL["default"]["use_ssl"] = False override to cfgov/settings/test.py for unit tests to work.

For the functional tests... the GitHub Action just calls manage.py runserver, which defaults to cfgov/settings/local.py, which... I don't think it is right. But changing that is out of scope here, so we'd need to add the same override to that file as well.

Alternatively, find a different way to solve the problem running in Kubernetes that this setting fixes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I disabled use_ssl in both local.py and and test.py. Appears that both tests are passing now.

@chosak
Copy link
Member

chosak commented Dec 19, 2024

@cooldragontattoo yes, please, I'd still like to review.

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.

3 participants