Skip to content

How To Delete An Octopus Instance

pricejn2 edited this page Mar 3, 2017 · 23 revisions

Uninstalling your Aegir Octopus Instance

Adapted from Uninstalling Aegir: http://community.aegirproject.org/uninstalling

Wiki page created from following comments:
https://github.com/omega8cc/nginx-for-drupal/issues/75#issue/75/comment/432885
https://github.com/omega8cc/nginx-for-drupal/issues/#issue/233

For convenience, we will refer to octopus user as o1.

There is no formal method for uninstalling Octopus, but there is also no real mystery either since the system tries to keep itself together in one location, typically /data/disk/o1.

Below are the steps to completely remove all traces of Octopus from your server.

Ideally, you would delete all sites and all platforms from the system first. That would take care of deleting all databases and users. But this can take some time and is annoying, so we provide instructions on how to destroy everything.

WARNING

Obviously if you have any sites and platforms currently managed by Octopus, you would want to move them out of the /data/disk/o1 before you delete it! Ensure you have set up your sites and platforms elsewhere, with nginx conf files etc in their typical locations, or at least out of harm's way before attempting this.

WARNING: Performing these steps will remove the Octopus instance from your server and may result in loss of data. Use with caution.

Run these commands as a privileged user (such as root). We assume your Octopus installation resides in /data/disk/o1.

Backup

You probably want to backup everything up to /var/backups/ before trashing it,

Backup all you need to keep from the /data/disk/o1 directory.

Backup your database server, we'll be also destroying that.

Destroying the data

Octopus manages three types of data:

  • configuration files - yes, we consider those as data
  • site and platform files
  • site databases

Trashing configuration files

rm /var/aegir/config/server_master/nginx/platform.d/o1.conf
rm /var/aegir/config/server_master/nginx/pre.d/z_o1.*_ssl_proxy.conf
rm /opt/php70/etc/pool.d/o1.conf
rm /opt/php56/etc/pool.d/o1.conf
rm /opt/php55/etc/pool.d/o1.conf
rm /opt/php54/etc/pool.d/o1.conf
rm /opt/php53/etc/pool.d/o1.conf

(Check for other possible php versions in /opt/php* folders.)

Trashing site and platform files

chattr -i /data/disk/o1/.drush/php.ini
rm -r /data/disk/o1/
chattr -Ri /home/o1.ftp   # Ignore all warnings that may appear.
rm -r /home/o1.ftp/
chattr -Ri /home/o1.web   # Ignore all warnings that may appear.
rm -r /home/o1.web/

Drop the databases and db users

There are no generic instructions for this, since every system differs. Essentially you can perform this within a MySQL shell

mysql -u root -p

Use the DROP DATABASE $databasename; syntax to drop databases.

To see a list of GRANTs that Octopus has made for your database users, you can use a command like the following

USE mysql;
SELECT User,Host FROM user WHERE Host='localhost' AND User <> 'root' AND User <> 'debian-sys-maint';
SELECT Host,Db,User FROM db WHERE User <> '';

You can use the DROP USER $user syntax to delete these users and their privileges, depending on your version of MySQL.

In Debian, the following will remove all non-system users (which may include non-aegir users!!!).

WARNING: DO NOT RUN THIS BEFORE CHECKING WHAT WILL BE DELETE BY RUNNING THE SELECT ABOVE!!

DELETE FROM db WHERE User <> '';
DELETE FROM user WHERE Host='localhost' AND User <> 'root' AND User <> 'debian-sys-maint';
FLUSH PRIVILEGES;

Consult the GRANT and DROP documentation from MySQL for more information. Removing everything

Remove the Octopus user's crontab

crontab -r -u o1

Delete the Octopus user

userdel o1

This will also remove the user from the www-data group.

Delete the Octopus FTP and web user

userdel o1.ftp
userdel o1.web

Remove the user from sudoers

visudo

Remove the lines that look something like

o1 ALL=NOPASSWD: /etc/init.d/

Save and exit the file.

Restart nginx

service nginx restart

Remove the .o1.octopus.cnf

rm -f ~/.o1.octopus.cnf