refactor: allow the scheduler to decide if an app is deployed
Without moving this to the scheduler, all applications are assumed to not be deployed unless the scheduler is set to docker-local. Closes #3531
This commit is contained in:
1 parent
2f83b29f1a
commit
5373cf2989
3 files changed
+45
-8
No files matched your search
@@ -1320,6 +1320,24 @@ DOKKU_SCHEDULER="$1"; APP="$2";
|
|||||||
# TODO
|
# TODO
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `scheduler-is-deployed`
|
||||||
|
|
||||||
|
> Warning: The scheduler plugin trigger apis are under development and may change
|
||||||
|
> between minor releases until the 1.0 release.
|
||||||
|
|
||||||
|
- Description: Allows you to check if an app has been deployed
|
||||||
|
- Invoked by: `dokku ps:rebuild`
|
||||||
|
- Arguments: `$DOKKU_SCHEDULER $APP`
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
DOKKU_SCHEDULER="$1"; APP="$2";
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
```
|
||||||
### `scheduler-logs`
|
### `scheduler-logs`
|
||||||
|
|
||||||
> Warning: The scheduler plugin trigger apis are under development and may change
|
> Warning: The scheduler plugin trigger apis are under development and may change
|
||||||
|
|||||||
@@ -450,14 +450,10 @@ get_app_running_container_types() {
|
|||||||
is_deployed() {
|
is_deployed() {
|
||||||
declare desc="return 0 if given app has a running container"
|
declare desc="return 0 if given app has a running container"
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] || [[ $(
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
ls "$DOKKU_ROOT/$APP"/CONTAINER.* &>/dev/null
|
|
||||||
echo $?
|
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
|
||||||
) -eq 0 ]]; then
|
plugn trigger scheduler-is-deployed "$DOKKU_SCHEDULER" "$APP"
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is_container_running() {
|
is_container_running() {
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
scheduler-docker-local-scheduler-is-deployed() {
|
||||||
|
declare desc="checks if an app is deployed"
|
||||||
|
declare DOKKU_SCHEDULER="$1" APP="$2"
|
||||||
|
|
||||||
|
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] || [[ $(
|
||||||
|
ls "$DOKKU_ROOT/$APP"/CONTAINER.* &>/dev/null
|
||||||
|
echo $?
|
||||||
|
) -eq 0 ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
scheduler-docker-local-scheduler-is-deployed "$@"
|
||||||
Reference in new issue
Block a user