Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update main Reaction app to use .env file #4826

Merged
merged 7 commits into from
Dec 8, 2018

Conversation

aldeed
Copy link
Contributor

@aldeed aldeed commented Nov 26, 2018

Resolves #4706
Impact: minor
Type: feature

Issue

Most services that make up the Reaction platform use a .env file in the root of the service folder to define environment variables that should be set while running. They also have a pre-build script that the reaction-platform tool runs to create or update the .env file from a .env.example file, which is committed.

The Reaction API service does not have these.

Solution

Add the .env-related files.

Also added two environment variables to .env.example, based on discussions elsewhere:

METEOR_DISABLE_OPTIMISTIC_CACHING=1
METEOR_WATCH_POLLING_INTERVAL_MS=10000

Breaking changes

If you run Reaction locally, such as for development, you will now need to be sure there is a .env file with correct environment variables set in it. The .env.example file, with no changes, should work for most people. When running with reaction-platform, this should happen automatically. But if you've already been developing locally and you pull in this change, you'll need to run bin/setup once. You can also run bin/setup anytime you pull in the future, to add any new ENV variables.

How to run locally outside of Docker

While we recommend always developing within Docker (as part of Reaction Platform) it is possible to run locally directly on your host machine (Linux or OSX). If you do this, you'll need a .env file with slightly different URLs. Copy .env to .env.local and update .env.local to look like this:

HYDRA_ADMIN_URL=http://localhost:4445
HYDRA_OAUTH2_INTROSPECT_URL=http://localhost:4445/oauth2/introspect
HYDRA_TOKEN_URL=http://localhost:4444/oauth2/token
MONGO_OPLOG_URL=mongodb://localhost:27017/local
MONGO_URL=mongodb://localhost:27017/reaction
OAUTH2_CLIENT_DOMAINS=http://localhost:4000
REACTION_AUTH=r3@cti0n
REACTION_EMAIL=admin@localhost
REACTION_SECURE_DEFAULT_ADMIN=false
REACTION_USER_NAME=admin
REACTION_USER=Admin
ROOT_URL=http://localhost:3000

We've simply changed hydra and mongo hostnames to localhost. Everything else is the same.

You can now run directly on your host machine, after starting mongo and hydra services in Docker, with this command:

export $(cat .env.local | xargs) && reaction

Testing

Follow the instructions for creating the .env, and then make sure that the app starts, and run some simple smoke tests.

@aldeed aldeed self-assigned this Nov 26, 2018
This was referenced Nov 26, 2018
@aldeed aldeed requested a review from spencern November 26, 2018 17:38
@aldeed
Copy link
Contributor Author

aldeed commented Nov 26, 2018

The one CI check failure is a known issue with feature deployment script that @griggheo is fixing separately.

Copy link
Member

@ticean ticean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @aldeed. This is good and it'll be easier to manage now. I made a comment on the setup script path. Not a blocker if you feel strongly about it but consistent paths to the common tooling scripts would be nice.

.reaction/scripts/setup Outdated Show resolved Hide resolved
.reaction/project-hooks/pre-build Outdated Show resolved Hide resolved
@impactmass impactmass changed the base branch from release-2.0.0-rc.7 to release-2.0.0-rc.8 November 30, 2018 16:14
Copy link
Contributor

@spencern spencern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can safely set the polling frequency to 10s and keep almost 100% of the performance improvements that we get at 60s
We might be able to go lower than that, but I haven't tested below 10000ms

.env.example Outdated Show resolved Hide resolved
.reaction/scripts/setup Outdated Show resolved Hide resolved
@aldeed aldeed dismissed spencern’s stale review December 4, 2018 22:58

All comments addressed

@aldeed
Copy link
Contributor Author

aldeed commented Dec 4, 2018

@spencern All comments resolved

Copy link
Contributor

@spencern spencern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will help quite a bit. 👍

@spencern spencern merged commit cf2c2ff into release-2.0.0-rc.8 Dec 8, 2018
@spencern spencern deleted the feat-4706-aldeed-env-file branch December 10, 2018 18:27
@spencern spencern mentioned this pull request Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants