Skip to content

Commit

Permalink
Add env vars to kubernetes config for production (#53620)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachmari authored Dec 16, 2024
1 parent cdc91ff commit 8de7574
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,14 @@ COPY --chown=node:node --from=builder $APP_HOME/next.config.js ./
COPY --chown=node:node --from=builder $APP_HOME/tsconfig.json ./

# - - -
# Environment variables
# Environment variables are set in the Moda
# configuration: config/moda/configuration/*/env.yaml
# - - -

# This makes it possible to set `--build-arg BUILD_SHA=abc123`
# and it then becomes available as an environment variable in the docker run.
ARG BUILD_SHA
ENV BUILD_SHA=$BUILD_SHA
# We should always be running in production mode
ENV NODE_ENV=production
# Preferred port for server.js
ENV PORT=4000
# Include all languages
ENV ENABLED_LANGUAGES="en,zh,es,pt,ru,ja,fr,de,ko"

EXPOSE $PORT

# Entrypoint to start the server
# Note: Currently we have to use tsx because we have a mix of `.ts` and `.js` files with multiple import patterns
Expand Down
4 changes: 4 additions & 0 deletions config/kubernetes/production/deployments/webapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ spec:
name: vault-secrets
- configMapRef:
name: kube-cluster-metadata
# application-config is crated at deploy time from
# configuration set in config/moda/configuration/*/env.yaml
- configMapRef:
name: application-config
# Zero-downtime deploys
# https://thehub.github.com/engineering/products-and-services/internal/moda/feature-documentation/pod-lifecycle/#required-prestop-hook
# https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks
Expand Down
8 changes: 8 additions & 0 deletions config/moda/configuration/production/env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
data:
NODE_ENV: production
NODE_OPTIONS: '--max-old-space-size=4096'
PORT: '4000'
ENABLED_LANGUAGES: 'en,zh,es,pt,ru,ja,fr,de,ko'
HEROKU_APP_NAME: help-docs
HEROKU_PRODUCTION_APP: 'true'
RATE_LIMIT_MAX: '21'

0 comments on commit 8de7574

Please sign in to comment.