New command: dokku delete <app>
Two new hooks are implemented:
- pre-delete $APP
- post-delete $APP
The following are implemented in the `post-delete` hook:
- `$APP` directory deletion (00_dokku-standard)
- nginx reload (nginx-vhosts)
The following command can be executed by either the `dokku` or `git` user as `sudo`:
sudo /etc/init.d/nginx reload
Refs #124
Closes #186
This commit is contained in:
@@ -1,5 +1,26 @@
|
||||
#!/bin/bash
|
||||
set -e; case "$1" in
|
||||
delete)
|
||||
if [[ -z $2 ]]; then
|
||||
echo "Please specify an app to delete"
|
||||
exit 1
|
||||
fi
|
||||
APP="$2"; IMAGE="app/$APP";
|
||||
if [[ ! -d "/home/git/$APP" ]]; then
|
||||
echo "App does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pluginhook pre-delete $APP
|
||||
ID=$(< "/home/git/$APP/CONTAINER")
|
||||
|
||||
docker stop $ID > /dev/null
|
||||
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &
|
||||
docker rm $ID > /dev/null
|
||||
|
||||
pluginhook post-delete $APP
|
||||
;;
|
||||
|
||||
logs)
|
||||
CONTAINER=$(</home/git/$2/CONTAINER)
|
||||
docker logs $CONTAINER | tail -n 100
|
||||
@@ -33,6 +54,7 @@ set -e; case "$1" in
|
||||
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
delete <app> Delete an application
|
||||
logs <app> Show the last logs for an application
|
||||
run <app> <cmd> Run a command in the environment of an application
|
||||
url <app> Show the URL for an application
|
||||
|
||||
@@ -17,4 +17,3 @@ script
|
||||
sudo -i -u git /usr/local/bin/dokku deploy:all
|
||||
end script
|
||||
EOF
|
||||
|
||||
|
||||
3
plugins/00_dokku-standard/post-delete
Executable file
3
plugins/00_dokku-standard/post-delete
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
[[ -n $1 ]] && rm -r "/home/git/$1" > /dev/null
|
||||
3
plugins/nginx-vhosts/post-delete
Executable file
3
plugins/nginx-vhosts/post-delete
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
sudo /etc/init.d/nginx reload > /dev/null
|
||||
Reference in New Issue
Block a user