Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring API startup process in docker
- Enable reading configuration from git, to be able to support Mesos and Kubernetes, see Haufe-Lexware/wicked.haufe.io#34
- Loading branch information
1 parent
4eb19e4
commit daecd31
Showing
3 changed files
with
57 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
runtimeEnv=$(uname) | ||
|
||
if [ "$runtimeEnv" != "Linux" ] || [ ! -f /.dockerenv ]; then | ||
echo "Do not use this script in non-dockerized environments." | ||
echo "Detected non-Linux runtime $runtimeEnv, or /.dockerenv is not present." | ||
echo "Use 'node bin/api' or 'npm start'.'" | ||
exit 1 | ||
fi | ||
|
||
exit 1 | ||
|
||
if [ ! -z "$GIT_CREDENTIALS" ] && [ ! -z "$GIT_REPO" ]; then | ||
|
||
tmpDir=$(mktemp -d) | ||
|
||
echo "Cloning configuration repository from $GIT_REPO into $tmpDir..." | ||
pushd $tmpDir | ||
|
||
if [ -z "$GIT_BRANCH" ]; then | ||
echo "Checking out branch 'master'..." | ||
git clone https://${GIT_CREDENTIALS}@${GIT_REPO} --depth 1 . | ||
else | ||
echo "Checking out branch '$GIT_BRANCH'..." | ||
git clone https://${GIT_CREDENTIALS}@${GIT_REPO} --depth 1 --branch ${GIT_BRANCH} . | ||
fi | ||
|
||
if [ ! -d "$tmpDir/static" ]; then | ||
echo "====================================================================================" | ||
echo "ERROR: Could not find directory 'static' in $tmpDir, wrong repository?" | ||
echo "====================================================================================" | ||
exit 1 | ||
fi | ||
|
||
echo "Cleaning up old configuration (if applicable)" | ||
rm -rf /var/portal-api/static | ||
echo "Copying configuration to /var/portal-api/static" | ||
cp -R static /var/portal-api | ||
echo "Done." | ||
|
||
popd | ||
|
||
echo "Cleanining up temp dir." | ||
rm -rf $tmpDir | ||
|
||
else | ||
echo "Assuming /var/portal-api/static is prepopulated, not cloning configuration repo." | ||
fi | ||
|
||
echo "Starting API..." | ||
|
||
npm start |
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,5 +1,5 @@ | ||
{ | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"private": true, | ||
"dependencies": { | ||
"chai": "3.5.0", | ||
|