The Richmond Sunlight website.
This is the front-end of the website. See also: rs-machine, the collection of scrapers and parsers that provide the site's third-party data, rs-api, the API that powers (some of) the website, and rs-video-processor, the on-demand legislative-video-processing system.
Richmond Sunlight started in 2005 as a little RSS-based bill tracker, updating every few hours. In 2006 it was built out as Richmond Sunlight, launching publicly in January of 2007. It's remained a hobby site ever since. The code base hasn’t been overhauled in all that time, and it shows — the site’s tech stack shows the growth rings of being developed over the course of many years. But it continues to function, and has been modernized in some ways, e.g. by adding a CI/CD pipeline, moving to SOA, etc.
main: The staging site.deploy: The production site.The site can be run locally, in Docker:
./docker-run.sh.http://localhost:8000.Tests can be run with ./docker-tests.sh.
The local database has these accounts, from deploy/mysql/test-users.sql. Each one's password is password123. Log in at http://localhost:8000/account/login/.
| What it's for | |
|---|---|
testuser@example.com | Portfolios. It's an organization's account, with a private portfolio, "Test Portfolio," and a public one. Both have HB2049. |
trusted@example.com | A trusted user, who can delete bills' tags. |
legislator@example.com | A legislator's account (linked to legislator 269), with public portfolios that rs-api's tests use. |
tester@example.com | Logging in. |
If an account stops working (after the database is rebuilt, say, or a test changes it), load the accounts again: docker compose exec -T db mysql -u ricsun -ppassword richmondsunlight < deploy/mysql/test-users.sql.
There are additional tests, in tests/local/, that run against a larger sample of the database than is stored in GitHub. They load every bill, legislator, committee, and minutes page in the sample, failing on any page that doesn't load or that raises a PHP warning, and check every legislator's video clips, every video's captions, and every bill's fiscal impact statements. This test data is not publicly available, and is provided only to trusted contributors.
deploy/mysql/local-test-records.sql (which is ignored by Git): aws s3 cp s3://deploy.richmondsunlight.com/test-data/local-test-records.sql.gz - | gunzip > deploy/mysql/local-test-records.sql. It's a few hundred bills from the two most recent sessions, chosen to cover every type and status of bill, plus a dozen videos. rs-machine exports it from the production database with deploy/database_export.sh (nightly during the session, and weekly otherwise)../docker-tests.sh --local, or just the local tests, with docker compose exec web /var/www/htdocs/includes/vendor/bin/phpunit --configuration /var/www/phpunit.xml --testsuite local.The "Production Data Tests" GitHub Actions workflow runs these on the same schedule, against the latest sample, and reports failures to Slack. They don't block deployment, because what they find is mostly problems in the data.
Without the sample, the local tests are skipped, except for those in LocalDataTest, which fail to say that it's missing. In Docker, PHP logs errors to logs/php-errors.log, rather than to Apache's log, which is how the tests find them.
When you are done, run ./docker-stop.sh (or quit Docker).
The database is initialized from SQL dumps when the MariaDB container is first created. If any SQL files under deploy/mysql/ change (including when you download a new local sample), those changes won't take effect until you delete the database and load it again:
./docker-run.sh --fresh
That deletes the db_data volume and rebuilds the database's image, which holds a copy of the SQL files, so that MariaDB loads them again.
flowchart LR
subgraph AWS
CD[CodeDeploy]
MACH["Machine (rs-machine)"]
RDS[(RDS)]
SQS[(SQS)]
VP[Video Processor]
S3[(Video S3)]
FE["Front-End (this site)"]
API["API (rs-api)"]
CF[CloudFront]
end
Users["Users/Browsers"]
CD --> MACH
CD --> FE
CD --> API
CD --> VP
MACH -->|reads/writes| RDS
MACH -->|enqueue videos| SQS
MACH -->|upload clips| S3
SQS --> VP
VP -->|transcoded video| S3
FE <-->|cached| CF
CF <-->|serves| Users
FE <-->|app data| RDS
FE <-->|calls| API
API <-->|data| RDS
Bill history summaries use language that will become dated
https://github.com/openva/richmondsunlight.com/issues/997
Labels: Machine
Create a way to see retired legislators
https://github.com/openva/richmondsunlight.com/issues/991
Labels: 없음
Bill text is indented inconsistently
https://github.com/openva/richmondsunlight.com/issues/988
Labels: Front End, Quick
Senate YouTube videos aren't embedding correctly
https://github.com/openva/richmondsunlight.com/issues/967
Labels: Front End
Finish video cleanup
https://github.com/openva/richmondsunlight.com/issues/964
Labels: Front End, Video Processor
Rescope database dumps
https://github.com/openva/richmondsunlight.com/issues/962
Labels: Video Processor
Private photosynthesis page listing is janky and bad
https://github.com/openva/richmondsunlight.com/issues/944
Labels: Front End
Make dynamic portfolios public
https://github.com/openva/richmondsunlight.com/issues/943
Labels: Front End
Change full text URL slug to "text"
https://github.com/openva/richmondsunlight.com/issues/942
Labels: Front End, Quick
Make bill-tracking button less goofy
https://github.com/openva/richmondsunlight.com/issues/932
Labels: enhancement, Front End, Quick
No CONTRIBUTING document was found. Please check the README and open issues.