issue #92: inserting environment file to docker instance

This commit is contained in:
alexanderbeletsky committed 2013-07-19 09:17:41 +03:00
1 parent 36c4f37ad6
commit eef39c30d3
3 files changed
+24

No files matched your search

+1
View File
@@ -2,6 +2,7 @@
# This file lists all individuals having contributed content to the repository. # This file lists all individuals having contributed content to the repository.
# #
Alexander <iam.asm89@gmail.com> Alexander <iam.asm89@gmail.com>
Alexander Beletsky <alexander.beletsky@gmail.com>
Felipe Coury <felipe.coury@gmail.com> Felipe Coury <felipe.coury@gmail.com>
Jeff Lindsay <progrium@gmail.com> Jeff Lindsay <progrium@gmail.com>
Leo Unbekandt <leo@unbekandt.eu> Leo Unbekandt <leo@unbekandt.eu>
+11
View File
@@ -51,6 +51,17 @@ the Heroku Node.js sample app. All you have to do is add a remote to name the ap
You're done! You're done!
## Environment setup
Typically application requires some environment variables to be set up for proper run. Environment variables might contain some private date, like passwords and API keys, so it's not recommend to store them as part of source code.
To setup environment for your application, create file `/home/git/APP_NAME/ENV`. This file is a script that would expose all required environment variables, like:
export NODE_ENV=production
export MONGODB_PASSWORD=password
Next time the application is deployed, those variables would be exposed by `start` script.
## Advanced installation (for development) ## Advanced installation (for development)
If you plan on developing dokku, the easiest way to install from your own repository is cloning If you plan on developing dokku, the easiest way to install from your own repository is cloning
+12
View File
@@ -7,6 +7,9 @@ case "$1" in
echo "-----> Building $APP ..." echo "-----> Building $APP ..."
cat | dokku build $IMAGE cat | dokku build $IMAGE
echo "-----> Build complete!" echo "-----> Build complete!"
echo "-----> Setting up ..."
dokku setup $APP $IMAGE
echo "-----> Setup complete!"
echo "-----> Deploying $APP ..." echo "-----> Deploying $APP ..."
dokku deploy $APP $IMAGE dokku deploy $APP $IMAGE
echo "=====> Application deployed:" echo "=====> Application deployed:"
@@ -25,6 +28,15 @@ case "$1" in
docker commit $id $IMAGE > /dev/null docker commit $id $IMAGE > /dev/null
;; ;;
setup)
APP="$2"; IMAGE="$3"
if [[ -f "$HOME/$APP/ENV" ]]; then
id=$(cat "$HOME/$APP/ENV" | docker run -i -a stdin $IMAGE /bin/bash -c "cat > /app/.app-env")
test $(docker wait $id) -eq 0
docker commit $id $IMAGE > /dev/null
fi
;;
deploy) deploy)
APP="$2"; IMAGE="$3" APP="$2"; IMAGE="$3"
pluginhook pre-deploy $APP $IMAGE pluginhook pre-deploy $APP $IMAGE