Page MenuHomePhabricator

Define `NODE_ENV` and always define `NODE_PATH`
ClosedPublic

Authored by dduvall on Aug 23 2017, 6:14 PM.

Details

Maniphest Tasks
T174626: Optimized image builds for node applications
Reviewers
thcipriani
mobrovac
mmodell
Group Reviewers
Release-Engineering-Team
Commits
rGBLBR2a19f04679b0: Define `NODE_ENV` and always define `NODE_PATH`
Patch without arc
git checkout -b D759 && curl -L https://phabricator.wikimedia.org/D759?download=true | git apply
Summary

Define NODE_ENV based on the configuration and define NODE_PATH when
either npm.install or npm.env are true. The latter behavior is
necessary for final stages of multi-stage builds where npm modules are
not installed but the application requires node-related environment
variables to run.

Depends on D757
Ref T174626

Rename npm module/config to node

Renamed npm yaml entry to node and NpmConfig to NodeConfig.
Since we're dealing with general node builds and configuration, this
seems to make more sense.

Test Plan

Run go test ./... or arc unit. Run blubber against at least the
blubber.example.yaml.

Diff Detail

Repository
rGBLBR Blubber
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

dduvall created this revision.Aug 23 2017, 6:14 PM
Restricted Application added a reviewer: mmodell. · View Herald TranscriptAug 23 2017, 6:14 PM
Restricted Application added a reviewer: Release-Engineering-Team. · View Herald Transcript
Restricted Application added a project: Release-Engineering-Team. · View Herald Transcript
mobrovac edited edge metadata.Aug 24 2017, 2:28 PM

For testing and development, NODE_ENV should probably be set to development, but I don't see it being set, i.e. if we are not in a production setting, it's safe to assume we are in development mode :)

dduvall updated this revision to Diff 2030.Sep 5 2017, 5:34 PM

Rebased and modified to reflect changes in D756

For testing and development, NODE_ENV should probably be set to development, but I don't see it being set, i.e. if we are not in a production setting, it's safe to assume we are in development mode :)

Blubber will just set up a NODE_ENV environment variable for whatever you've set the node.env yaml config to, so it's up to you to set it according to your needs at the root level of the config or for a specific variant.

dduvall updated this revision to Diff 2032.Sep 5 2017, 5:47 PM
dduvall edited the summary of this revision. (Show Details)

Reference correct task

thcipriani accepted this revision.Sep 6 2017, 11:02 PM
This revision is now accepted and ready to land.Sep 6 2017, 11:02 PM
This revision was automatically updated to reflect the committed changes.