Wednesday, October 27, 2021

[SOLVED] Is it wise to use Debian (.deb) packages to distribute our software to production servers?

Issue

We have various programs and scripts that we create that we need to deploy on production Ubuntu servers after testing. We are considering packaging our software as Debian (.deb) files and using something like apt-get or aptitude to install the software.

This is straightforward, but it is not clear to me how one would rollback or uninstall new versions that prove undesirable. An obvious choice is apt-get remove new-pkg followed by apt-get install old-pkg, but is that the right approach?

Are there special rules to follow (or things to avoid) in postinst, prerm, or postrm to help make things go smoothly?

Note that all our software and servers are private, and we have complete control over everything, if that helps.


Solution

In the Debian scheme, automatic downgrades are usually not considered. The preferred way would be a new and higher version number for a fixed build (even if "fixed" means "all new features removed").

If you absolutely have to roll back an upgrade, you might consider using a Debian epoch number to declare a new start in version numbers, beginning with the roll-back version. For an example, suppose the version 1.2 of a package is broken and you have to downgrade to 1.1 in a hurry, then you re-version the debian package 1.1-5 as 1:1.1-6, which is a higher version number than plain 1.2-1.

A manual downgrade certainly seems undesirable, you'll certainly miss at least one critical server during at least one downgrade.

For postinst, prerm and postrm, consider the Debian New Maintainer Guide.



Answered By - thiton