You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some of the containers in my project require sensitive data (such as 3rd party API tokens) to be passed as environment variables. I understand that I can enumerate these without values in my fig.yml to be picked up from the host environment, but then I still need some way to get them there, meaning one of:
Passing these on every fig invocation (unacceptable due to the repetition), or
Yet another script to wrap fig and load these environment variables from disk.
Docker already provides support for loading a container environment from disk in the --env-file option to docker run. It would be nice if fig exposed this as environment_file as a parallel to the current environment option.
I'd be happy to submit a PR for this, but in order to do so I would need pointing in the right direction by someone who actually knows Python. I figure the implementation would likely be as easy as extending this constant and that I'd probably need a test similar to this one. Am I on the right track so far?
Attempting to setup my development environment, following the instructions here, I get this, suggesting the test dependencies aren't being installed:
➭ sudo python setup.py develop
running develop
running egg_info
writing requirements to fig.egg-info/requires.txt
writing fig.egg-info/PKG-INFO
writing top-level names to fig.egg-info/top_level.txt
writing dependency_links to fig.egg-info/dependency_links.txt
writing entry points to fig.egg-info/entry_points.txt
reading manifest file 'fig.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.un~' found anywhere in distribution
writing manifest file 'fig.egg-info/SOURCES.txt'
running build_ext
Creating /Library/Python/2.7/site-packages/fig.egg-link (link to .)
fig 0.5.2 is already the active version in easy-install.pth
Installing fig script to /usr/local/bin
Installed /Users/ben/code/fig
Processing dependencies for fig==0.5.2
Searching for six==1.7.3
Best match: six 1.7.3
Processing six-1.7.3-py2.7.egg
six 1.7.3 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages/six-1.7.3-py2.7.egg
Searching for docker-py==0.5.0
Best match: docker-py 0.5.0
Processing docker_py-0.5.0-py2.7.egg
docker-py 0.5.0 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages/docker_py-0.5.0-py2.7.egg
Searching for dockerpty==0.2.3
Best match: dockerpty 0.2.3
Processing dockerpty-0.2.3-py2.7.egg
dockerpty 0.2.3 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages/dockerpty-0.2.3-py2.7.egg
Searching for websocket-client==0.11.0
Best match: websocket-client 0.11.0
Processing websocket_client-0.11.0-py2.7.egg
websocket-client 0.11.0 is already the active version in easy-install.pth
Installing wsdump.py script to /usr/local/bin
Using /Library/Python/2.7/site-packages/websocket_client-0.11.0-py2.7.egg
Searching for texttable==0.8.1
Best match: texttable 0.8.1
Processing texttable-0.8.1-py2.7.egg
texttable 0.8.1 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages/texttable-0.8.1-py2.7.egg
Searching for requests==2.4.1
Best match: requests 2.4.1
Processing requests-2.4.1-py2.7.egg
requests 2.4.1 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages/requests-2.4.1-py2.7.egg
Searching for PyYAML==3.11
Best match: PyYAML 3.11
Processing PyYAML-3.11-py2.7-macosx-10.9-intel.egg
PyYAML 3.11 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages/PyYAML-3.11-py2.7-macosx-10.9-intel.egg
Searching for docopt==0.6.2
Best match: docopt 0.6.2
Processing docopt-0.6.2-py2.7.egg
docopt 0.6.2 is already the active version in easy-install.pth
Using /Library/Python/2.7/site-packages/docopt-0.6.2-py2.7.egg
Finished processing dependencies for fig==0.5.2
{15:35}~/code/fig:master ✓ [2.1.2]
➭ sudo ./script/test
./script/test: line 3: flake8: command not found
Activity
dnephin commentedon Sep 10, 2014
Sounds like you're on the right track, but I think there is more work involved. https://github.com/docker/fig/blob/ce8ef23c097995b7a9f295c9621b5f25e683c2c4/fig/service.py#L318 similar to how
environmentis handled here.Looking at https://github.com/docker/docker-py
create_container()doesn't accept aenvironment_file. I suspect this is because it's being handled by the docker client (not on the server), so you'll probably have to handle the param by actually reading the file and updating the environment in this method.benlangfeld commentedon Sep 10, 2014
It does seem you're right in that this is only supported client-side and so we'd have to implement it along the same lines.
I'll give it a shot tomorrow.
benlangfeld commentedon Sep 10, 2014
Attempting to setup my development environment, following the instructions here, I get this, suggesting the test dependencies aren't being installed:
Is there a step missing from the docs?
dnephin commentedon Sep 10, 2014
Personally I think those notes need to be updated, they didn't work for me, and they aren't really "standard" for python development.
I would do this:
tox -e py27to run tests and build a virtualenvsource .tox/py27/bin/activeSee also: http://virtualenv.readthedocs.org/en/latest/virtualenv.html#usage
dekked commentedon Sep 12, 2014
I made PR #481 for you :) comments are welcome, or if you would like to contribute with test.
benlangfeld commentedon Sep 12, 2014
Awesome, thanks @dekked. I'll see if I can figure out some tests over the weekend.
tomfotherby commentedon Oct 21, 2014
--env-filewould be a fantastic edition to fig - shame it didn't make the v1.0.0 release. Keep up the good work. 👍geovanisouza92 commentedon Oct 21, 2014
+1
albers commentedon Oct 23, 2014
+1
djdefi commentedon Oct 24, 2014
+1
JustinTulloss commentedon Oct 27, 2014
+1
kunday commentedon Nov 8, 2014
+1
benlangfeld commentedon Dec 5, 2014
Closing in favour of #665 where this is implemented.
bobcolner commentedon Jan 7, 2015
+1
benlangfeld commentedon Jan 7, 2015
That won't help, @bobcolner. See my last comment.