allow tagging and deployment of tagged app images

This commit is contained in:
Michael Hobbs
2015-06-10 14:21:47 -07:00
parent 03165ee3f8
commit 04a4da7fc5
16 changed files with 300 additions and 102 deletions

View File

@@ -20,8 +20,8 @@ source "$PLUGIN_PATH/common/functions"
case "$1" in
hello)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2";
APP="$2"; TAG=$(get_running_image_tag $APP)
verify_app_name "$2" "$TAG"
echo "Hello $APP"
;;

View File

@@ -244,7 +244,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using buildpacks.
- Invoked by: `dokku release`
- Arguments: `$APP`
- Arguments: `$APP $TAG`
- Example:
```shell
@@ -252,8 +252,9 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# Installs the graphicsmagick package into the container
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"
APP="$1"; TAG=$(get_running_image_tag $APP)
verify_app_name "$APP" "$TAG"
dokku_log_info1" Installing GraphicsMagick..."
@@ -270,7 +271,7 @@ docker commit $ID $IMAGE > /dev/null
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using buildpacks.
- Invoked by: `dokku release`
- Arguments: `$APP`
- Arguments: `$APP $TAG`
- Example:
```shell
@@ -278,8 +279,9 @@ docker commit $ID $IMAGE > /dev/null
# Installs a package specified by the `CONTAINER_PACKAGE` env var
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"
APP="$1"; TAG=$(get_running_image_tag $APP)
verify_app_name "$APP" "$TAG"
dokku_log_info1" Installing $CONTAINER_PACKAGE..."
@@ -296,13 +298,16 @@ docker commit $ID $IMAGE > /dev/null
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
- Invoked by: `dokku release`
- Arguments: `$APP`
- Arguments: `$APP $TAG`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
APP="$1"; TAG=$(get_running_image_tag $APP)
verify_app_name "$APP" "$TAG"
# TODO
```
@@ -311,13 +316,16 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
- Invoked by: `dokku release`
- Arguments: `$APP`
- Arguments: `$APP $TAG`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
APP="$1"; TAG=$(get_running_image_tag $APP)
verify_app_name "$APP" "$TAG"
# TODO
```
@@ -352,7 +360,7 @@ fi
- Description: Allows the running of code before the container's process is started.
- Invoked by: `dokku deploy`
- Arguments: `$APP`
- Arguments: `$APP $TAG`
- Example:
```shell
@@ -360,11 +368,9 @@ fi
# Runs gulp in our container
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"
APP="$1"
IMAGE="dokku/$APP"
APP="$1"; TAG=$(get_running_image_tag $APP)
verify_app_name "$APP" "$TAG"
dokku_log_info1 "Running gulp"
id=$(docker run -d $IMAGE /bin/bash -c "cd /app && gulp default")
@@ -401,8 +407,11 @@ curl "http://httpstat.us/200"
# Clears out the gulp asset build cache for applications
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
APP="$1"; IMAGE="dokku/$APP"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"
APP="$1"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"
TAG=$(get_running_image_tag $APP)
verify_app_name "$APP" "$TAG"
if [[ -d $GULP_CACHE_DIR ]]; then
docker run --rm -v "$GULP_CACHE_DIR:/gulp" "$IMAGE" find /gulp -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
@@ -447,13 +456,16 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
- Description:
- Invoked by: `dokku deploy`
- Arguments: `$APP`
- Arguments: `$APP $TAG`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
APP="$1"; TAG=$(get_running_image_tag $APP)
verify_app_name "$APP" "$TAG"
# TODO
```
@@ -462,13 +474,16 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
- Description:
- Invoked by: `dokku run`
- Arguments: `$APP`
- Arguments: `$APP $TAG`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
APP="$1"; TAG=$(get_running_image_tag $APP)
verify_app_name "$APP" "$TAG"
# TODO
```

View File

@@ -42,3 +42,57 @@ dokku ps:scale app_name web=1 worker=2
## The web proctype
Like Heroku, we handle the `web` proctype differently from others. The `web` proctype is the only proctype that will invoke custom checks as defined by a CHECKS file. It is also the only proctype that will be launched in a container that is either proxied via nginx or bound to an external port.
## Image tagging
The dokku tag plugin allows you to add docker image tags to the currently deployed app image for versioning and subsequent deployment.
```
tag:add <app> <tag> Add tag to latest running app image
tag:deploy <app> <tag> Deploy tagged app image
tag:list <app> List all app image tags
tag:rm <app> <tag> Remove app image tag
```
Example:
```
root@dokku:~# dokku tag:list node-js-app
=====> Image tags for dokku/node-js-app
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
dokku/node-js-app latest 936a42f25901 About a minute ago 1.025 GB
root@dokku:~# dokku tag:add node-js-app v0.9.0
=====> Added v0.9.0 tag to dokku/node-js-app
root@dokku:~# dokku tag:list node-js-app
=====> Image tags for dokku/node-js-app
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
dokku/node-js-app latest 936a42f25901 About a minute ago 1.025 GB
dokku/node-js-app v0.9.0 936a42f25901 About a minute ago 1.025 GB
root@dokku:~# dokku tag:deploy node-js-app v0.9.0
-----> Releasing node-js-app (dokku/node-js-app:v0.9.0)...
-----> Deploying node-js-app (dokku/node-js-app:v0.9.0)...
-----> Running pre-flight checks
For more efficient zero downtime deployments, create a file CHECKS.
See http://progrium.viewdocs.io/dokku/checks-examples.md for examples
CHECKS file not found in container: Running simple container check...
-----> Waiting for 10 seconds ...
-----> Default container check successful!
=====> node-js-app container output:
Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
Recommending WEB_CONCURRENCY=1
> node-js-sample@0.1.0 start /app
> node index.js
Node app is running at localhost:5000
=====> end node-js-app container output
-----> Running post-deploy
-----> Configuring node-js-app.dokku.me...
-----> Creating http nginx.conf
-----> Running nginx-pre-reload
Reloading nginx
-----> Shutting down old containers in 60 seconds
=====> 025eec3fa3b442fded90933d58d8ed8422901f0449f5ea0c23d00515af5d3137
=====> Application deployed:
http://node-js-app.dokku.me
```