Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using secrets #80

Merged
merged 6 commits into from
Nov 13, 2020
Merged

Using secrets #80

merged 6 commits into from
Nov 13, 2020

Conversation

dannylamb
Copy link
Member

This approach lets you use secrets for running in production. For an environment variable that should be secret, instead of directly entering its value into config, replace it with secret:/path/to/the/secret. This little init script will scan the container environment for variables that follow that pattern, read the contents of that file, and replace the variable's value with the file's contents.

There will be an analagous pull on isle-dc to demonstrate how to use secrets in the docker-compose file. I'm trying to work this in such that if integrating with other things like etcd, vault or aws's secrets solution, that this won't get in the way. It's specifically for the env backend of confd and if you don't pattern your variables this way, nothing will change.

demo/Dockerfile Outdated
@@ -22,7 +22,6 @@ RUN --mount=type=cache,target=/root/.composer/cache \
drupal/facets:^1.3 \
drupal/matomo:^1.7 \
drupal/pdf:1.x-dev \
drupal/rdfui:^1.0-beta1 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is fine, just thought I'd bring attention to it if it was intended for another branch or commit.

set -e

# Read any secret files specified in environment variables.
echo "$(env | grep '=secret:')" | while read line
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you put instructions into the README? It looks like you have to do a specific thing with a filename to make this work, and we shouldn't assume people will go read the code to figure it out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And can you add your SECRETfile as a template to this repo?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you scroll to "By .env technique" here you can see how to load a second .yml file by changing your COMPOSE_FILE declaration in your .env file https://stackoverflow.com/questions/55650342/import-docker-compose-file-in-another-compose-file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put example secret files in Islandora-Devops/isle-dc#123

@dannylamb
Copy link
Member Author

I've made an associated pull to isle-dc: Islandora-Devops/isle-dc#123

I'll try to document it in the README as best I can here.

@dannylamb
Copy link
Member Author

I decided it fit better in isle-dc than here. I updated the PR to include a secrets chunk in the README.

@dannylamb
Copy link
Member Author

@nigelgbanks Any chance we can get this in to help with Islandora-Devops/isle-dc#126?

@g7morris
Copy link
Contributor

@dannylamb per your request here Islandora-Devops/isle-dc#126 (comment) I merged this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants