Closed 67726e closed 3 months ago
And, of course, shortly after writing this post I found the environment variable documentation around METEOR_SETTINGS
When running your bundled application in production mode, pass a string of JSON containing your settings with
METEOR_SETTINGS='{ "server_only_setting": "foo", "public": { "client_and_server_setting": "bar" } }'.
See: https://docs.meteor.com/environment-variables#METEOR-SETTINGS
Adding a final comment for the future intrepid developer...
We've made two changes to the default experience offered in this repository.
First, we've created the optional startup.sh
script to export METEOR_SETTINGS
from a file on the filesystem:
#!/usr/bin/env sh
set -e
echo "Exporting METEOR_SETTINGS from (${METEOR_SETTINGS_PATH})"
export METEOR_SETTINGS=$(cat "${METEOR_SETTINGS_PATH}")
Of note, this is configured via an METEOR_SETTINGS_PATH
which we configure further up in our ECS Service definition - you can always substitute this variable for a hard-coded path or some other mechanism.
Second, we added a few lines to the final stage in the provided Dockerfile from the /examples
directory.
###### Copy Settings File(s) to Meteor Runtime Image
RUN mkdir -p /opt/COMPANY_NAME/settings
COPY ./app/settings/test-ecs.json /opt/COMPANY_NAME/settings
##### Copy Startup Script to Configure Pre-Runtime Dependencies
COPY ./startup.sh /docker/startup.sh
Hopefully that helps!
Asked about this at the Meteor
level, to gain more control over Meteor.settings
directly and define it within code versus passing environment variables at all: https://forums.meteor.com/t/use-npm-require-to-load-meteor-settings/2936/14?u=digitalextremist
Definitely watching this one and might even be feeling intrepid one day, but hoping to gain control over Meteor.settings
without environment variables and command line values being passed into the process.
Thanks for the workaround @67726e
Based on an earlier issue (See: https://github.com/disney/meteor-base/issues/98), I'd tried copying over my
app/settings
directory into the final Docker stage and adding arguments to the command for the image, like so:However, this appears to just give me a mess of errors regarding missing values in my application at runtime. Is there a good way to make
meteor --settings ./settings/configuration.json
work in conjunction with this Docker image and it'snode main.js
invocation?Thanks!