Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra protection to databases during package purge #52

Merged
merged 1 commit into from
Oct 3, 2019

Conversation

rnewson
Copy link
Member

@rnewson rnewson commented Sep 3, 2019

Overview

Using apt-get --purge removes all CouchDB databases. This is surprising as --purge is
defined as removing config files. Other database packages (like mysql) have an additional
debconf property for data destruction beyond config files. This PR follows the mysql package
in adding that property and defaulting it to false. This allows a purge with complete data removal if desired.

Testing recommendations

Install CouchDB, create databases, then purge the package. The .couch files should remain
in /var/lib/couchdb.

GitHub issue number

N/A

Related Pull Requests

N/A

Checklist

  • Code is written and works correctly;
  • Changes are covered by tests;
  • Documentation reflects the changes;

@rnewson
Copy link
Member Author

rnewson commented Sep 3, 2019

(I haven't ticked any of the checklist because I've genuinely not gotten that far.)

fi

pkill -u couchdb >/dev/null 2>&1 || true
db_reset couchdb/mode
db_reset couchdb/nodename
db_reset couchdb/cookie
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably unrelated entirely but why do we forcibly reset the debconf settings after purge? I think we should not reset the couchdb/nodename parameter if we're not purging the databases, but I don't know about the rest.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sequence of events should be possible, and not result in a surprise:

apt install couchdb
# configure as single node with an admin user for testing, password "admin"
# do some testing, create some DBs
apt purge couch
apt install couchdb
# re-configure couchdb for a cluster with a real admin user/password combo

Have you tried this? I should test it myself before I +1 this.

Copy link
Member

@wohali wohali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to actually test an install/purge/install sequence myself on this branch. Have you done so?

debian/couchdb.postrm Show resolved Hide resolved
fi

pkill -u couchdb >/dev/null 2>&1 || true
db_reset couchdb/mode
db_reset couchdb/nodename
db_reset couchdb/cookie
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sequence of events should be possible, and not result in a surprise:

apt install couchdb
# configure as single node with an admin user for testing, password "admin"
# do some testing, create some DBs
apt purge couch
apt install couchdb
# re-configure couchdb for a cluster with a real admin user/password combo

Have you tried this? I should test it myself before I +1 this.

debian/couchdb.postrm Outdated Show resolved Hide resolved
debian/couchdb.templates Outdated Show resolved Hide resolved
@wohali
Copy link
Member

wohali commented Sep 24, 2019

@rnewson ping, minor comments

@rnewson rnewson merged commit 71015bc into master Oct 3, 2019
@rnewson rnewson deleted the postrm_remove_databases branch October 3, 2019 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants