From 60db48b963b5b9d00c592c6078b464b6e7d66174 Mon Sep 17 00:00:00 2001 From: josmas Date: Thu, 2 Jun 2016 21:52:50 +0100 Subject: [PATCH] simplification of Envs for docker setup. Closes #199 --- README.md | 46 +++++++++++++++++++++------------------------- default.env | 8 ++++---- docker-compose.yml | 2 -- env.test | 19 ------------------- 4 files changed, 25 insertions(+), 50 deletions(-) delete mode 100644 env.test diff --git a/README.md b/README.md index 1f3b440..5508f7d 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. diff --git a/default.env b/default.env index f740e4e..032246e 100644 --- a/default.env +++ b/default.env @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 173f33d..a96fec5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/env.test b/env.test deleted file mode 100644 index a106163..0000000 --- a/env.test +++ /dev/null @@ -1,19 +0,0 @@ -# Copy this file to .env or just set these environment variables - -# default port is 5000 -export PORT=5000 -export SESSION_SECRET=USE_SOMETHING_GOOD_LIKE_puUJjfE6QtUnYryb - -# Badges -export BADGES_ENDPOINT=http://example.com -export BADGES_KEY=master -export BADGES_SECRET=test_secret -export BADGES_SYSTEM=badgekit - -# ORCID Auth -export ORCID_AUTH_CLIENT_ID=test_client -export ORCID_AUTH_CLIENT_SECRET=0eafb938-020e-45a6-a148-3c222171d9d8 -export ORCID_AUTH_SITE=http://example.com -export ORCID_AUTH_TOKEN_PATH=http://api.example.com/oauth/token -export ORCID_REDIRECT_URI=http://localhost:5000/orcid_auth_callback -