The Federal Election Commission (FEC) is the independent regulatory agency charged with administering and enforcing the federal campaign finance law. The FEC has jurisdiction over the financing of campaigns for the U.S. House, Senate, Presidency and the Vice Presidency.
This project will provide a web application for filling out FEC campaign finance information. The project code is distributed across these repositories:
- fecfile-web-app: this is the browser-based front-end developed in Angular
- fecfile-web-api: RESTful endpoint supporting the front-end
- fecfile-api-proxy: Reverse proxy for API for IP blocking and rate limiting
- fecfile-validate: data validation rules and engine
Software necessary to run the application locally:
You will need to define a DJANGO_SECRET_KEY. Locally you can just add something like this your rc file:
export DJANGO_SECRET_KEY="thisismykey"
By default EFO services (print/upload) will be mocked. To integrate with EFO, set the following environment variables:
# Test EFO Services (for test filings):
export MOCK_EFO_FILING=False
export EFO_FILING_API_KEY="EFO_get_this_from_team_member"
Note - the default PRODUCTION_OPEN_FEC_API_KEY and STAGE_OPEN_FEC_API_KEY key has a very low rate limit - for a better key, reach out to a team member or get one at https://api.open.fec.gov/developers/
When running docker compose you will need to be in the root directory of the project. The reason for this is that docker compose looks for docker-compose.yml to be in the same directory where it's run. You will also need at least 3GB of memory allocated for docker during the build.
docker compose up -d
docker compose down
docker ps
docker exec <container name> <command>
docker compose build [<container name>] [--no-cache]
Drop into the API container with:
docker exec -it fecfile-api bash -H
You can then run unit tests with:
python3 manage.py test [-k <test name>]
docker stats
View logs for a single container:
docker logs <container ID> [-f]
View logs for all containers:
docker compose logs [-f]
To view only the error logs:
docker logs <container ID> [-f] 1>/dev/null
To view only the access logs:
docker logs <container-id> [-f] 2>/dev/null
The -f (follow) flag causes the command to continue to output log messages as they occur until the user issues a break.
See also: Technical Design
Once the web API application is running, you may go to http://localhost:8080/ to see the API documentation.