0
votes

We are using GAE with Ruby flexible environment, and we're trying to deploy a rails app with staging configurations (i.e. RAILS_ENV=staging).

According to https://cloud.google.com/appengine/docs/flexible/ruby/configuring-your-app-with-app-yaml we should be able to set the value of RAILS_ENV configuring an app.yaml with:

env_variables:
  RAILS_ENV: 'staging'

However, when we run:

gcloud app deploy

A (temporary) Dockerfile is generated with

# Temporary. Will be moved to base image later.
ENV RACK_ENV=production \
    RAILS_ENV=production \
    RAILS_SERVE_STATIC_FILES=true

Which results in a deployment in the PRODUCTION environment (default value for RAILS_ENV).

Is this a bug or am I missing something?

2
I don't know if StackOverflow is the best place to post this question, as such I also posted the question in "Server Fault": serverfault.com/questions/815750/…Vasco Andrade Silva

2 Answers

1
votes

The flexible environment sets RAILS_ENV by default to 'production'.

https://cloud.google.com/appengine/docs/flexible/ruby/runtime#environment_variables

0
votes

Environment variables set in app.yaml under env_variables should now override the defaults (which come from the generated Dockerfile).

I just deployed a sample application to App Engine with RAILS_ENV customized in my env_variables.

env_variables:
  APP_YAML_VAR: this was set in the app.yaml
  RAILS_ENV: overridden

When deployed, ENV["RAILS_ENV"] shows my customized, overridden value.

Screenshot of customized environment variable