This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds envconsul to inject secrets into container. allows container to …
…be run in "sidekiq" mode
- Loading branch information
Dann Bohn
committed
Sep 25, 2019
1 parent
16c6bd7
commit aa5aedf
Showing
5 changed files
with
44 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,28 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
rails db:create | ||
rails db:migrate | ||
# Vault init container will drop the token in /etc/vault/token; alternatively we can set the VAULT_TOKEN env variable | ||
if [ -f /vault/token ]; then | ||
export VAULT_TOKEN=$(cat /vault/token) | ||
fi | ||
|
||
rails s -b '0.0.0.0' | ||
function start_envconsul() { | ||
set -u | ||
envconsul \ | ||
-vault-addr=${VAULT_ADDR} \ | ||
-secret=${VAULT_PATH} \ | ||
-vault-token=${VAULT_TOKEN} \ | ||
-no-prefix=true \ | ||
-vault-renew-token=false \ | ||
-once \ | ||
-exec='bash start.sh' | ||
} | ||
|
||
|
||
if [ -n "${VAULT_TOKEN}" ]; then | ||
echo "have token. starting envconsul" | ||
start_envconsul | ||
else | ||
echo "starting the app" | ||
bash start.sh | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
|
||
if [ ${APP_ROLE:-app} == "sidekiq" ]; then | ||
echo "starting sidekiq" | ||
bundle exec sidekiq | ||
else | ||
echo "starting rails" | ||
rails db:create | ||
rails db:migrate | ||
rails s -b '0.0.0.0' | ||
fi |