Forum OpenACS Development: package installation

Collapse
Posted by Iuri Sampaio on
Hi there,

I realized that installing a package on openacs is not an atomic procedure.

It means if the installation process somehow breaks in the middle, the package then is "partially" enabled in the system.

an example of scenario would be after a installation break such as

[17/Jul/2010:16:27:40][14712.3051707280][-default:4-] Notice: pInstalled Photo Album, version 5.2.3. /p
[17/Jul/2010:16:27:40][14712.3051707280][-default:4-] Notice: p Package enabled.
[17/Jul/2010:16:27:40][14712.3051707280][-default:4-] Notice: apm_invoke_callback_proc: invoking callback after-install with command photo_album::install::p\
ackage_install
[17/Jul/2010:16:27:41][14712.3051707280][-default:4-] Notice: apm_invoke_callback_proc: invoking callback after-instantiate with command photo_album::instal\
l::add_categories -package_id 917
[17/Jul/2010:16:27:41][14712.3051707280][-default:4-] Warning: /acs-admin/apm/packages-install-4 has no doc(title) set.
[17/Jul/2010:16:27:41][14712.3051707280][-default:4-] Error: POST http://teste.softwarepublico.gov.br/acs-admin/apm/packages-install-4?
referred by "http://teste.softwarepublico.gov.br/acs-admin/apm/packages-install-3";
invalid command name "category_tree::add"
while executing

That happens because i haven't written a requirement "tag" in the photo-album's .info file to use categories pkg
i.e. requires url="categories" version="5.3.1.a1"

That it is yelling about an API from category's package that it is not in the system

The pkg seems to be partially installed in the system because it does not show up in the section to install a package:

/acs-admin/apm/packages-install

/acs-admin/install/install?package_type=apm_application

Neither it appears in the apm section as a installed package.
/acs-admin/apm/

Where is the package then? is it installed or not? i can neither install it again nor navigate on it through oacs admin sections

The installation of all packages on oacs must be atomic.
Maybe there is a sort of way to put everything inside a db_transaction { } to roll back everything done in case of breaks in the installation process

cheers,

Collapse
2: Re: package installation (response to 1)
Posted by Torben Brosten on
Iuri,

Whether installing the package for the first time, or upgrading from previous versions, basically the process is:

Examine the sql files loaded during install (package-key/sql/postgresql/ for PG) to see how the database should be representing the package, tables created, special keys, relationships, indexes etc.

When installing, load the sql from the sql files manually where there is a difference, such as a table that doesn't exist etc.

When upgrading, also examine the upgrade error to see how the package is represented in the database differently from how it should be. Use the sql files in package-key/sql/postgresql/upgrade for how to handle the changes. If following standard release versions, report any differences as bugs.

To answer your question:

Once the database is in configuration consistent with the sql, point your browser to: /acs-admin/apm/packages-install This installation method is different than the one at /acs-admin/install

install or upgrade the package(s) in question. Be sure to uncheck the sql files to load (since you've already loaded them).

The real complications occur if there's corrupted data somewhere in the core that's triggering the problem.

cheers,

Torben

Collapse
3: Re: package installation (response to 1)
Posted by Michael Aram on
Iuri,

I totally agree that it should be atomic. I relatively often experience errors during upgrade or installation of packages. Therefore, I usually clone the database first to be able to "step back" in the case of an error. However, this may not be that easy on highly available production systems.

In a perfect world, also "downgrade" scripts would exist, which allow to "undo" such operations.

Cheers