A comprehensive refactor of OKCandidate based on feedback from users and our partners at the Virginian-Pilot.
Develop branch status |
---|
- Clone the project from GitHub (
git clone ...
) - Install Docker, using the steps for Docker CE for your specific OS and Edition/Distro via store.docker.com.
- NOTE: Don't just install docker from
brew
orapt-get
etc. You'll get an old or incomplete install. - From a shell in the project dir, start both the postgres and node containers with
docker-compose up
.- Add a
-d
to start in the background, e.g.docker-compose up -d
. - See how the "services" of this 2-tier app are setup in
docker-compose.yml
. We haveapp
anddb
. docker-compose --help
is your friend.- Use
docker-compose logs app
to see the node logs, for example. - Use
docker-compose exec app bash
to get a bash shell inside the running node container, for example. You can also do that againstdb
so you can use thepsql
tool against the database interactively. - To just run a one off psql command, you could do something like this from your host shell:
docker-compose exec postgres pg_dump -u postgres -d postgres > somefile.sql
- When you're done, you can
docker-compose stop
to exit the running containers, ordocker-compose down
to remove the containers, virtual network, and db data.
- Add a
In Summary:
clone repo
Install Docker
docker-compose up
That will get you started with OkCandidate!
In a development environment, some records are generated automatically.
These user/pass combinations can be used to login as user of various roles.
// config/dev-fixtures/user-fixtures.js
...
{
name: 'A. Voter',
emailAddress: 'user@gmail.com',
password: 'leafygreen'
},
{
name: 'A. Candidate',
emailAddress: 'candidate@gmail.com',
password: 'mashedpotato'
},
{
name: 'Anne Admin',
emailAddress: 'admin@okcandidate.org',
password: 'adminpass'
}
...
We use mocha and superagent for testing. See the trails.js documentation to learn more about writing tests for okcandidate.
Assuming you're using docker-compose
, if nothing is currently up, then you can run tests in a new container with docker-compose run app npm test
. If you've already started the containers with something like docker-compose up -d
then you can run tests in that same container with docker-compose exec app npm test
.
This project follows a loose interpretation of Git flow. Master is production, develop is staging. Each feature gets one branch. When opening a PR, please open it against the develop branch.