Skip to content

Commit

Permalink
simplification of Envs for docker setup. Closes #199
Browse files Browse the repository at this point in the history
  • Loading branch information
josmas committed Jun 3, 2016
1 parent e90ba12 commit 60db48b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 50 deletions.
46 changes: 21 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,10 @@ Are you ready to contribute to Paper Badger? This section will help you set up y

Clone (or Fork) PaperBadger and enter the directory: `git clone https://github.com/mozillascience/PaperBadger && cd PaperBadger`

#### Run using Docker

You can use Docker to bring up a quick instance of the app to develop against. This way you don't need to have node, MongoDB, and redis installed on your host.

* Make sure you have [Docker](https://www.docker.com/) (>=1.10) and docker-compose (>=1.6) installed.
* Setup your environment variables, or copy over the test file
```bash
sed 's/export //' env.test > env.docker
```
* start the service
```bash
docker-compose up
```
* visit the running service
* If on Linux host: http://localhost:5000
* If not Linux: http://(docker host ip):5000 (You can find your docker IP with `docker-machine ip default`)


#### Run locally

* Install PaperBadger's Node dependencies: `npm install`
* Make sure MongoDB and redis are running and locally accessible.
* If you would like to override the default configuration, create `.env` file in your favourite text editor, or use _default.env_ as a template.
#### Environment variables
If you would like to override the default configuration, create an `.env` file in your favourite text editor and use _default.env_ as a template (do not delete or modify _default.env_).

`PORT`, `SESSION_SECRET`, `BADGES_ENDPOINT`, `BADGES_KEY`, `BADGES_SECRET`, `BADGES_SYSTEM`, `ORCID_AUTH_CLIENT_ID`, `ORCID_AUTH_CLIENT_SECRET`, `ORCID_AUTH_SITE`, `ORCID_AUTH_TOKEN_PATH` and `ORCID_REDIRECT_URI` environment variables are set to the correct values. `PORT` can be any available port.
If you would like to develop against the hosted custom badgekit-api we have running specificaly for PaperBadger testing, your environment values should look this:
If you would like to develop against the hosted custom badgekit-api we have running specifically for PaperBadger testing, your environment values should look this:

# default port is 5000
export PORT=5000
Expand All @@ -79,7 +57,25 @@ If you would like to develop against the hosted custom badgekit-api we have runn
export ORCID_REDIRECT_URI=#############

Ask [@acabunoc](http://github.com/acabunoc) for ones marked `###########`. Our custom BadgeKit API code can be found [here](https://github.com/acabunoc/badgekit-api).
Feel free to change `PORT` to any available port.

#### Run using Docker

You can use Docker to bring up a quick instance of the app to develop against. This way you don't need to have node, MongoDB, and redis installed on your host.

* Make sure you have [Docker](https://www.docker.com/) (>=1.10) and docker-compose (>=1.6) installed.
* Setup your environment variables as explained in the previous section
* start the service with `docker-compose up`
* visit the running service
* If on Linux host: http://localhost:5000
* If not Linux: http://(docker_host_ip):5000 (You can find your docker IP with `docker-machine ip default`)


#### Run locally

* Install PaperBadger's Node dependencies: `npm install`
* Make sure MongoDB and redis are running and locally accessible.
* Setup your environment variables as explained in a previous section
* Run `npm start`, and open up `http://localhost:5000/` in your favourite web browser!

To run the application successfully you need to have [mongodb](https://www.mongodb.org/) server and [redis-server](http://redis.io/download) running locally. You can install these from their official website or use your favorite package manager.
Expand Down
8 changes: 4 additions & 4 deletions default.env
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export BADGES_SECRET=#############
export BADGES_SYSTEM=badgekit

# ORCID Auth
export ORCID_AUTH_CLIENT_ID=
export ORCID_AUTH_CLIENT_SECRET=
export ORCID_AUTH_SITE=https://sandbox.orcid.org
export ORCID_AUTH_TOKEN_PATH=https://sandbox.orcid.org/oauth/token
export ORCID_AUTH_CLIENT_ID=#############
export ORCID_AUTH_CLIENT_SECRET=#############
export ORCID_AUTH_SITE=https://orcid.org
export ORCID_AUTH_TOKEN_PATH=https://orcid.org/oauth/token
export ORCID_REDIRECT_URI=http://localhost:5000/orcid_auth_callback

# MongoDB
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ services:
- 5000:5000
volumes:
- .:/src
env_file:
- env.docker
environment:
- MONGOLAB_URI=mongodb://mongo:27017/test
- REDISCLOUD_URL=redis://redis:6379/0
Expand Down
19 changes: 0 additions & 19 deletions env.test

This file was deleted.

0 comments on commit 60db48b

Please sign in to comment.