Вопрос

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.

Это было полезно?

Решение

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.

Другие советы

Both apt-get and aptitude allow you to specify the desired installed version:

apt-get install <your-package>=<your-version>
aptitude install <your-package>=<your-version>

It would be advisable to make use of this, in any case, in your deployment process, so you mandate exactly which version is deployed to the servers.

To roll back to a previous version should simply be a case of specifying the previous version number. Of course, if it makes more sense to solve the problem with a new version, then do that rather than roll back.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top