Skip to content

Commit

Permalink
added phases to volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
crisward committed Feb 21, 2018
1 parent cf4a12b commit 9c1d297
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ With the addition of a dokku section (see below).
}
```

## Plugins

The `"dokku":{"plugins":[]}` array can contain a list of plugin names, which
by default will be created with the app name and linked to your app.
This will only work with the official plugins which have `create` and `link` methods.
Expand Down Expand Up @@ -72,6 +74,25 @@ array will be run in sequence.
}
```

## Volumes

Volumes are shared folders between your app's container and the host machine.
By default these will be created in all phased (build,run,deploy) but you can optionally declaire this in your setup
ie.
```json
"volumes":[
{"host":"/var/lib/dokku/data/storage","app":"/storage","phases":"build,deploy"}
]
```
You can also use the `$APP` name in the paths, which will be replaced with your app name
```json
"volumes":[
{"host":"/mystorage/$APP/images","app":"/images","phases":"deploy"}
]
```



## Alternative Settings for Development and Testing

It's often neccessary to have different volumes or database configurations
Expand Down
7 changes: 5 additions & 2 deletions functions
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ require_add_volumes() {
while [[ "$COUNT" -lt "$TOTAL" ]]; do
HOSTPATH=$(require_get_app_plugins "[\"$DOKKU_REQUIRE_PREFIX\"][\"volumes\"][${COUNT}][\"host\"]" < "$APP_JSON_FILE" 2>&1)
APPPATH=$(require_get_app_plugins "[\"$DOKKU_REQUIRE_PREFIX\"][\"volumes\"][${COUNT}][\"app\"]" < "$APP_JSON_FILE" 2>&1)

PHASES=$(require_get_app_plugins "[\"$DOKKU_REQUIRE_PREFIX\"][\"volumes\"][${COUNT}][\"phases\"]" < "$APP_JSON_FILE" 2>&1)
if [[ -z "$PHASES" ]]; then
PHASES="build,deploy,run"
fi
if [[ $? -ne 0 ]] || [[ -z "$HOSTPATH" ]] || [[ -z "$APPPATH" ]]; then
break
fi
Expand All @@ -77,7 +80,7 @@ require_add_volumes() {
HOSTPATH="${HOSTPATH//\$APP/$APP}"
APPPATH="${APPPATH//\$APP/$APP}"
mkdir -p "$HOSTPATH"
dokku docker-options:add "$APP" build,deploy,run -v "$HOSTPATH:$APPPATH"
dokku docker-options:add "$APP" "$PHASES" -v "$HOSTPATH:$APPPATH"
let COUNT=COUNT+1
done
fi
Expand Down

0 comments on commit 9c1d297

Please sign in to comment.