progrium/dokku — pull request #262 by josegonzalez (2013-10-25 07:27:18+00:00)
Title: App deletion

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 commands can be executed by either the `dokku` or `git` user as `sudo`:

# * can be any argument or command modifier
sudo /var/lib/dokku/plugins/00_dokku-standard/bin/delete-app*

# just reload of nginx, nothing dangerous
sudo /etc/init.d/nginx reload

This is used to actually remove the directory on disk. It is performed as a plugin-hook to simplify implementation.

If more should be done in the plugin hook - ie. docker orchestration - then the logic should be moved to the `bin/delete-app` shell script.

IMPORTANT: Any user that has access to the `dokku` or `git` user will be able to delete any application on the node. If this is undesirable, you will need to:

- use `visudo` to remove permission from the `delete-app` bin to the two users
- figure out a way to disable remote access of the `delete` command, as it will be broken by the above

This isn't a major concern, as you should not allow untrusted users ssh access to your server.

Refs #124
Superscedes and closes #186. Thanks @Kloadut for the initial implementation! :+1: