Skip to content

Conversation

@adamzev
Copy link
Contributor

@adamzev adamzev commented Mar 28, 2025

Allow non-credentialed users to run ETL pipelines and support Application Default Credentials

feat: allow non-credentialed users and cloud env credentials

  • The ability to specify ports and passwords rather than a full url was added to better suit not having to duplicate secret management (POSTGRES_PASSWORD and VACANT_LOTS_DB)

  • Added additional logic to psql to user localhost in Cloud Run environments

  • Added a new bucket manager that should work in the following enviroments:

    • Cloud Run
    • with file credential
    • in read-only mode for non-credentialed users
  • Changed Slack reporters to not report with a message rather than throwing an error if no credentials exist

Related Issue(s)

This PR addresses issue #1125

Type of change

  • Bug fix
  • New feature
  • Breaking change

How Has This Been Tested?

I've tried this locally with credentials (to my own bucket), without credentials and within Cloud Run. I don't have Slack credentials so I haven't tried it with them.

@adamzev adamzev requested a review from Copilot March 28, 2025 17:38
@vercel
Copy link

vercel bot commented Mar 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vacant-lots-proj ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 27, 2025 8:03pm

This comment was marked as duplicate.

@adamzev
Copy link
Contributor Author

adamzev commented Mar 28, 2025

It looks like the PR Checks Backend are failing just because #1147 isn't in yet.

I want to double check things (there's one Slack message I may have missed) and try this out on different computers before switching it from a draft.

@adamzev adamzev marked this pull request as ready for review March 31, 2025 13:56
@cfreedman cfreedman self-requested a review April 1, 2025 15:48
@github-actions
Copy link
Contributor

github-actions bot commented Apr 9, 2025

This PR has been marked as stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Apr 9, 2025
@adamzev adamzev force-pushed the 1125-credential-handling branch 2 times, most recently from c81349f to db1890a Compare April 26, 2025 21:19
semantic-release-bot and others added 4 commits April 26, 2025 17:20
# 1.0.0 (2025-04-06)

### Bug Fixes

* **572:** fix webpack warnings + fix linting issues ([CodeForPhilly#574](https://github.com/adamzev/clean-and-green-philly/issues/574)) ([fbfd459](fbfd459))
* Add focus styling to header links ([a99065c](a99065c))
* Add href to dropdown items to increase link size ([2eb4667](2eb4667))
* closing tooltip popup on map closes property details ([432e8c0](432e8c0))
* correct the scrolling on the map page ([a850237](a850237))
* Remove nested link and button ([d93e8bd](d93e8bd))
* Update footer markup structure for accessibility ([d5c2a33](d5c2a33))

### Features

* **247:** make the mapbox legend more legible ([bcf6915](bcf6915))
* **293:** sort features by priority of high, medium, low ([8cd1058](8cd1058))
* **305:** expand the header width of single property table ([b25261e](b25261e))
* **395:** add white background to backbutton bar ([a65f052](a65f052))
* **395:** make property selection back button sticky ([6601201](6601201))
* **457:** add filter count to button ([b35145a](b35145a))
* **535:** add close download view button ([CodeForPhilly#579](https://github.com/adamzev/clean-and-green-philly/issues/579)) ([9bd2c53](9bd2c53))
* **544:** adjust remove property section ([CodeForPhilly#580](https://github.com/adamzev/clean-and-green-philly/issues/580)) ([900af8e](900af8e))
* **568:** restyle the property table ([CodeForPhilly#577](https://github.com/adamzev/clean-and-green-philly/issues/577)) ([2c8cc92](2c8cc92))
* Add arrow icon to link ([6bce3fa](6bce3fa))
* Add content to sidebar ([23d5c52](23d5c52))
* Add council district ([e576218](e576218))
* Add extra data to single detail page ([48e34fe](48e34fe))
* Add font ([c1a8b93](c1a8b93))
* Add font to map ([1491518](1491518))
* Add font to search field ([3b08069](3b08069))
* Add info cards ([8170944](8170944))
* Add missing data and atlas link; style table ([8c260d4](8c260d4))
* Add percentage, update column widths ([41caf77](41caf77))
* Add priority color square ([ad5a9fa](ad5a9fa))
* add redirect from map to find-properties ([439ed6c](439ed6c))
* Add row scope ([f945979](f945979))
* Add spacing below Back button ([7de48c5](7de48c5))
* Address a few more links ([b3b6733](b3b6733))
* Adjust table per requirements ([36e6cfa](36e6cfa))
* Change Find Properties and Learn More to links ([1de0b47](1de0b47))
* Close sidebar if clicking on empty map ([612117d](612117d))
* Navigate to map on click; show popups ([183b6a2](183b6a2))
* Open sidebar from map ([5474367](5474367))
* Pass selected property to map view ([663f142](663f142))
* underline links ([5f23d09](5f23d09))
* Update aria label and role ([765e5a4](765e5a4))
Allow creating db url by specifing port and password (to be used in Cloud Run
to avoid duplicate secret management of POSTGRES_PASSWORD and VACANT_LOTS_DB)

Add additional logic to psql to user localhost in Cloud Run environments

Add a new bucket manager that should work in Cloud Run, with file credentials
and in read-only mode for non-credentialed users

Changed slack reporters to not report with a message rather than
erroring if no credentials exist
Print rather than error is Slack credentials are missing
@adamzev adamzev force-pushed the 1125-credential-handling branch from db1890a to 7167ebc Compare April 26, 2025 21:20

if os.getenv("VACANT_LOTS_DB"):
# Use the provided database URL
url = os.getenv("VACANT_LOTS_DB")
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 probably should switch this back to

 os.environ["VACANT_LOTS_DB"].replace("localhost", "host.docker.internal")
    if is_docker()
    else os.environ["VACANT_LOTS_DB"]

in-case we're in docker and VACANT_LOTS_DB is defined.

sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/..")

from classes.slack_error_reporter import (
from new_etl.classes.slack_reporters import (
Copy link
Contributor Author

@adamzev adamzev Apr 26, 2025

Choose a reason for hiding this comment

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

Switch back to classes rather than new_etl

@adamzev adamzev marked this pull request as draft April 26, 2025 21:28
@adamzev
Copy link
Contributor Author

adamzev commented Apr 26, 2025

I rebased this but saw some things I need to change. I also want to expand this fix to the old ETL pipeline.

@github-actions github-actions bot removed the stale label Apr 27, 2025
The pipeline can be run locally but will not write changes to the bucket
and will not report errors to slack without credentials. Previously, the
code would error when credentials were missing.

Added BACKUP_SCHEMA=False and made FORCE_RELOAD=True as the default.
These are temporary fixes and will not be relevant once postgres is
removed.
@adamzev adamzev changed the base branch from staging to lebovits/issu717-store-streetview-imgs-in-subdirectory April 27, 2025 19:59
@adamzev adamzev changed the base branch from lebovits/issu717-store-streetview-imgs-in-subdirectory to staging April 27, 2025 19:59
@adamzev adamzev marked this pull request as ready for review April 27, 2025 20:01
@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2025

This PR has been marked as stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label May 5, 2025
@adamzev adamzev merged commit 9440f7a into CodeForPhilly:staging May 10, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants