fedspendingtransparency / usaspending-api

Server application to serve U.S. federal spending data via a RESTful API
https://www.usaspending.gov
Creative Commons Zero v1.0 Universal
309 stars 112 forks source link

Updating README and local config #4211

Open sethstoudenmier opened 1 month ago

sethstoudenmier commented 1 month ago

Description: Update the README and other aspects of the usaspending-api codebase to support local development.

Technical details: Below is a brief list of changes going file by file in order to give a high-level reasoning of "why".

Requirements for PR merge:

  1. [x] Unit & integration tests updated
  2. [x] API documentation updated
  3. [x] Necessary PR reviewers:
    • [x] Backend
  4. [x] Matview impact assessment completed
  5. [x] Frontend impact assessment completed
  6. [x] Data validation completed
  7. N/A Appropriate Operations ticket(s) created
  8. N/A Jira Ticket

Area for explaining above N/A when needed:

aguest-kc commented 3 weeks ago

@sethstoudenmier What do you think about adding an init.sql script to run some common SQL commands when setting up the DB for the first time, since we're updating the docs? There are some common issues and their solutions don't seem to be documented publicly.

sethstoudenmier commented 3 weeks ago

@sethstoudenmier What do you think about adding an init.sql script to run some common SQL commands when setting up the DB for the first time, since we're updating the docs? There are some common issues and their solutions don't seem to be documented publicly.

  • ALTER USER usaspending SET SEARCH_PATH TO "public", "raw", "int", "temp", "rpt";

    • This prevents a common error about tables outside of the public schema not being found.
  • Create the etl_user

    • This user is needed for migrations to run.
  • Create the readonly user

    • This user is needed for migrations to run

Funny you should say that, I actually had that in place originally. The problem is that it conflicts with the Travis CI/CD build process when we use the --reuse-db flag because it attempts to create users that already exist. Instead I opted to document that in the README.

aguest-kc commented 3 weeks ago

Ahh.. that makes sense with the CI/CD process. I missed the changes to the README, because it was collapsed. I'm happy with those steps being documented!