Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Code4HR/okcandidate-platform

Repository files navigation

okcandidate-platform

A comprehensive refactor of OKCandidate based on feedback from users and our partners at the Virginian-Pilot.

Develop branch status
Codeship Status for Code4HR/okcandidate-platform

Setup

This Project Uses Docker and Docker Compose

  1. Clone the project from GitHub (git clone ...)
  2. Install Docker, using the steps for Docker CE for your specific OS and Edition/Distro via store.docker.com.
  3. NOTE: Don't just install docker from brew or apt-get etc. You'll get an old or incomplete install.
  4. From a shell in the project dir, start both the postgres and node containers with docker-compose up.
    1. Add a -d to start in the background, e.g. docker-compose up -d.
    2. See how the "services" of this 2-tier app are setup in docker-compose.yml. We have app and db.
    3. docker-compose --help is your friend.
    4. Use docker-compose logs app to see the node logs, for example.
    5. Use docker-compose exec app bash to get a bash shell inside the running node container, for example. You can also do that against db so you can use the psql tool against the database interactively.
    6. 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
    7. When you're done, you can docker-compose stop to exit the running containers, or docker-compose down to remove the containers, virtual network, and db data.

In Summary:

clone repo
Install Docker
docker-compose up

That will get you started with OkCandidate!

Fixture Data

In a development environment, some records are generated automatically.

User Records

These user/pass combinations can be used to login as user of various roles.

  // config/dev-fixtures/user-fixtures.js

  ...

  {
    name: 'A. Voter',
    emailAddress: '[email protected]',
    password: 'leafygreen'
  },
  {
    name: 'A. Candidate',
    emailAddress: '[email protected]',
    password: 'mashedpotato'
  },
  {
    name: 'Anne Admin',
    emailAddress: '[email protected]',
    password: 'adminpass'
  }

  ...

Testing

Creating Tests

We use mocha and superagent for testing. See the trails.js documentation to learn more about writing tests for okcandidate.

Running Tests In Docker

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.

Contributing

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.

Releases

No releases published

Packages

No packages published

Languages