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

README.md update for docker #166

Merged
merged 3 commits into from
Jul 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 22 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,28 @@ A comprehensive refactor of [OKCandidate](https://github.com/Code4HR/okcandidate

# Setup

## Docker

A few setup steps need to happen before you can run everything in Docker.
First, copy `.env-example` to `.env` to configure the application, then run
`./gen-dev-cert` to create a development certificate chain so you can test
everything over https.

Then you can run `docker-compose up` and you just have to wait for everything to
get started.

Summary:

cp .env-example .env
./gen-dev-cert
## This Project Uses Docker and Docker Compose

1. Clone the project from GitHub (`git clone ...`)
1. Install Docker, using the steps for **Docker CE** for your specific OS and Edition/Distro via [store.docker.com](https://store.docker.com).
1. NOTE: Don't just install docker from `brew` or `apt-get` etc. You'll get an old or incomplete install.
1. 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`.
1. See how the "services" of this 2-tier app are setup in `docker-compose.yml`. We have `app` and `db`.
1. `docker-compose --help` is your friend.
1. Use `docker-compose logs app` to see the node logs, for example.
1. 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.
1. 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`
1. 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!

## Database
A local postgres database will need to be created to run okcandidate-platform. PgAdmin can be used to do this.

## Environment
The following environment variables are expected to be available to the shell in which okcandidate-platform is running.
```bash
export OKC_DB_USER=blaine
export OKC_DB_PASS=''
export OKC_DB_NAME=okcandidate_platform_dev
export OKC_DB_HOST=localhost
export OKC_SESSION_SECRET_KEY=someGobbledygookThatIsAtLeast32CharactersLong
```

## Installation
Clone the project from GitHub and install dependencies.
```bash
git clone [email protected]:Code4HR/okcandidate-platform.git && cd okcandidate-platform
npm install
```

Afterwards, use
```bash
npm start
```
to begin running application locally.

# Fixture Data
In a development environment, some records are generated automatically.

Expand Down Expand Up @@ -83,17 +61,13 @@ These user/pass combinations can be used to login as user of various roles.

# Testing

We use mocha and superagent for testing. See the [trails.js](https://trailsjs.io/doc/en/test/) documentation to learn more about writing tests for okcandidate.

## In Docker
## Creating Tests

If installed with Docker and docker-compose run tests from npm using ` docker-compose exec app npm run test`. This can be run after running `docker-compose up -d` and having the container `app` running the background.

## On Host Machine

Run using `npm test` as usual
We use mocha and superagent for testing. See the [trails.js](https://trailsjs.io/doc/en/test/) 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.