Forum OpenACS Development: ]po[ V5.2 on OpenACS 5.10.1 Docker

Hi Gustaf,

Thanks a lot for this. I had a detailed look into what you did (including the container-setup-openacs.sh and the other scripts inside the container). I found it interesting how you parsed the docker parameters from within TCL.

I've got one possible improvement for you: I've got timing errors when PostgreSQL took longer to start. So I added a call to the following code in container-setup-openacs.sh before finishing or before executing any DB code:

wait_for_postgres() {
        echo "====== Wait for PG: Waiting up to a minute for PostgreSQL to become available"
	wait_count=0
	wait_max=60
        echo "====== Wait for PG: pg_isready -h ${oacs_db_host} -p ${oacs_db_port} 2>/dev/null"
	while ! pg_isready -h ${oacs_db_host} -p ${oacs_db_port} 2>/dev/null; do
            wait_count=$(($wait_count + 1))
            if [ $wait_count -ge $wait_max ]; then
                echo "====== Wait for PG: PostgreSQL not ready after ${wait_max} attempts. Exiting."
                exit 1
            fi
            echo "====== Wait for PG: Waiting for PostgreSQL to be ready, attempt: ${wait_count}"
            sleep 1
        done
        echo "====== Wait for PG: PostgreSQL ready now with attempt: ${wait_count}"
}

Then I tried to upgrade an existing ]project-open[ installation to OpenACS 5.10. What is the best way to do this? According to the upgrade page (https://openacs.org/xowiki/upgrade-oacs-5-10), I should be able to put a ]po[ backup (based on OpenACS 5.9.1 and PostgreSQL 9), stuff it into the postgres:latest container, start your OpenACS and get a semiautomatic upgrade, isn't that correct?

I tried and NSD seems to start up more or less correctly, but a strange error ("pretty_plural", see below) occurred, see below. After that I also get many "Service contract initialization failed: acs_sc_proc RssGenerationSubscriber lastUpdated fs_rss fs::rss::lastUpdated", followed later by "invalid command name "::acs::dc" which I understand is fatal.

I've tested with the same PostgreSQL container (PG 17.2) on an Ubuntu Server and everything worked. Here are the installation instructions I recorded: https://www.project-open.net/en/install-ubuntu-noble-numbat
I also got some errors in xotcl-core, but the basic installation worked.

At the moment my plan is to look at the PostgreSQL 9 vs. 17 incompatibilities and then try again.

Error: Error sourcing /var/www/openacs/packages/xotcl-core/tcl/05-db-procs.tcl:
projop-1    | :    required argument 'pretty_plural' is missing, should be:
projop-1    | :            ::acs::dc call acs_attribute create_attribute ?-dbn /value/? -object_type /value/ -attribute_name /value/ -datatype /value/ -pretty_name /value/ -pretty_plural /v\
alue/ -table_name /value/ -column_name /value/ -default_value /value/ ?-min_n_values /int32/? ?-max_n_values /int32/? -sort_order /int32/ ?-storage /value/? ?-static_p /value/? ?-create_col\
umn_p /value/? -database_type /value/ -size /value/ ?-null_p /value/? -references /value/ -check_expr /value/ -column_spec /value/
projop-1    | :        while executing
projop-1    | :    "::xo::db::Object contains -object ::xo::db::Object::slot {
projop-1    | :        ::xo::db::Attribute create object_id    -pretty_name "Object ID" -datatype integer
Just a short update, the PG 9.2 -> PG 17 upgrade was easy and painless, just ignoring OIDs and removing the last traces of TSearch2.

I resolved the issue with the "required argument 'pretty_plural'" by adding a fake "-pretty_plural" argument in 05-db-procs.tcl. Now the issue is gone.

However, I still get 'Error: invalid command name "::acs::dc"'. I'll have a look where this apparent database driver is initialized.

Hi Frank,

sorry that i missed your original posting, I am quite busy with other projects these days.

timing issue

The docker-level healthcheck for the service should take care of this. When developing it, I tested this on multiple environments without problems.

The other points are NOT related with the container, but about upgrading PO.

pretty_plural

Without going deeper, there seems to be a PO data model issue, the metadata model seems incomplete. The function "create_attribute" is only called, when tuples in the OpenACS metadata model are missing.

In OpenACS, one sees:

oacs-head=# select attribute_id, attribute_name,pretty_name from  acs_attributes where attribute_name = 'object_id';
 attribute_id | attribute_name | pretty_name 
--------------+----------------+-------------
           74 | object_id      | Object ID
(1 row)

When the attribute is available in the metadata model, it does not try to create it. Nevertheless, you are right, one should not get errors, when the startup tries to repair a broken meta-data model.

invalid command name "::acs::dc"'.

This command is defined in acs-tcl/tcl/acs-db-00-procs.tcl When the file is sourced, the command will be available - unless some earlier error prevented loading

OID and tsearch

Have you seen: https://openacs.org/xowiki/upgrade-pg96-pg13

These instructions address OID dropping and excluding public.pgts* to avoid tsearch problems when upgrading from very old versions from before OpenACS 8.3 (2014).

Some more insights on the pretty_plural issue. When listening acs::dc call acs_attribute create_attribute one gets

 <instance of acs::db::nsdb-postgresql[i]> call acs_attribute create_attribute \
    [ -dbn dbn ] -object_type object_type  \
    -attribute_name attribute_name  -datatype datatype  \
    -pretty_name pretty_name  [ -pretty_plural pretty_plural ] \
    [ -table_name table_name ] [ -column_name column_name ] \
    [ -default_value default_value ] [ -min_n_values min_n_values ] \
    [ -max_n_values max_n_values ] [ -sort_order sort_order ] \
    [ -storage storage ] [ -static_p static_p ] \
    [ -create_column_p create_column_p ] \
    [ -database_type database_type ] [ -size size ] [ -null_p null_p ] \
    [ -references references ] [ -check_expr check_expr ] \
    [ -column_spec column_spec ]

You see, pretty_plural is optional. The argument list of all acs::dc call" functions is generated automatically from thefunction_argsdefinitions of your installation. I conclude, that my previous hypothesis of what might be different in PO, was probably not right, but i guess now that thefunction args` might be different.

Can it be that PO misses some of the upgrade scripts from OpenACS 5.7 or OpenACS 5.8?

acs-kernel/sql/postgresql/upgrade//upgrade-5.8.0d1-5.8.0d2.sql:select define_function_args('acs_attribute__create_attribute','object_type,attribute_name,datatype,pretty_name,pretty_plural;null,table_name;null,column_name;null,default_value;null,min_n_values;1,max_n_values;1,sort_order;null,storage;type_specific,static_p;f,create_column_p;f,database_type;null,size;null,null_p;t,references;null,check_expr;null,column_spec;null');
acs-kernel/sql/postgresql/upgrade//upgrade-5.7.0d3-5.7.0d4.sql:select define_function_args('acs_attribute__create_attribute','object_type,attribute_name,datatype,pretty_name,pretty_plural;null,table_name;null,column_name;null,default_value;null,min_n_values;1,max_n_values;1,sort_order;null,storage;type_specific,static_p;f');

All the best
-g