Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Latest commit

 

History

History
80 lines (62 loc) · 2.97 KB

README.md

File metadata and controls

80 lines (62 loc) · 2.97 KB

FEC's regulations

When there are new regulations available in GPO website (e.g. due to modifications in the parser, new Federal Register notices, etc.), that data must be sent to the regulations /api endpoint before it will be visible to users on the website.

If any new regulation parts have been added, add those parts to the list located in load_regs/fec_reg_parts.txt.

Install cf-service-connect plugin on MAC

After CLI upgrade, run the following command to install cf-service-connect plugin.

cf install-plugin https://github.com/cloud-gov/cf-service-connect/releases/download/v1.1.3/cf-service-connect_darwin_amd64

Load FEC's regulations on cloud.gov space

  1. Parse FEC's regulations locally Follow Wiki Parse regulations on local

  2. Generate local eregs database dump file Note: Verify the location of db client command(pg_dump and pg_restore) on local before generating database dump file (e.g. /opt/homebrew/opt/postgresql@13/bin/ or /usr/local/opt/postgresql@13/bin`)

/opt/homebrew/opt/postgresql@13/bin/pg_dump -F c --no-acl --no-owner -f /<path to the dumpfile>/<dump_file_name>.dump postgres://<username>:<password>@localhost:<port>/<dbname>
or
/usr/local/opt/postgresql@13/bin/pg_dump -F c --no-acl --no-owner -f /<path to the dumpfile>/<dump_file_name>.dump postgres://<username>:<password>@localhost:<port>/<dbname>
  1. Create new eregs database service
$ cf unbind-service eregs fec-eregs-db-rdn
$ cf rename-service fec-eregs-db-rdn fec-eregs-db-rdn-<YEAR>
$ cf create-service aws-rds micro-psql fec-eregs-db-rdn
  1. Setup SSH connection and get eregs database service credentials
$ cf connect-to-service -no-client eregs fec-eregs-db-rdn
  1. Restore eregs database dump file to database service on space
/opt/homebrew/opt/postgresql@13/bin/pg_restore --dbname postgres://<username>:<password>@localhost:<port>/<hostname> --no-acl --no-owner /<path to the dumpfile>/<dump_file_name>.dump
or 
/usr/local/opt/postgresql@13/bin/pg_restore --dbname postgres://<username>:<password>@localhost:<port>/<hostname> --no-acl --no-owner /<path to the dumpfile>/<dump_file_name>.dump
  1. Bind eregs app to the database service on space
$ cf bind-service eregs fec-eregs-db-rdn
  1. Restage eregs app
$ cf restage eregs (or rebuild fec-eregs on circleci)
  1. Reload regulations to elasticsearch service (to be able to perform a keyword search on Regulations page)
cf run-task api --command "python cli.py initialize_legal_data ao_index" -m 4G --name initialize_legal_data_ao
  1. Open api log terminal to verify regulations load successfully.
cf logs api |grep "<task_name>"
  1. Delete old eregs db service
# Get service key
cf sk fec-eregs-db-rdn-<YEAR>
cf delete-service-key fec-eregs-db-rdn-<YEAR> <service_key>
cf delete-service fec-eregs-db-rdn-<YEAR>