Forum OpenACS Development: Re: TWiST OpenACS package

Collapse
3: Re: TWiST OpenACS package (response to 1)
Posted by Claudio Pasolini on
Hi Tom,

Installing TWiST on my OpenACS 5.2 with Aolserver 4.5 I got the following error from packages-install-4.tcl:

Failed to install TWiST, version 0.9.3. The following error was generated:

Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")
ERROR: -20000: The specified package 0 AND/OR parameter initialized do not exist in the system
SQL: select apm__set_value( '0', 'initialized', '1]' );

Are there any specific requirements to install?

Collapse
4: Re: TWiST OpenACS package (response to 3)
Posted by Tom Jackson on
I hope someone can answer this question, but my guess is that the parameters are not added to the database before the tcl scripts (twist-procs.tcl and twist-init.tcl) are run.

Oh, wait! the default appears to be '1]', I'll see where that shows up in the source.

Collapse
6: Re: TWiST OpenACS package (response to 4)
Posted by Malte Sussdorff on
The problem does not lie in the 1, it lies in the fact that you run "init" in the before-install block. As the name implies, it is executed "before install", meaning the parameters are not yet written into the database as the package is not yet installed. Remove it and you are fine at this point :)

Furthermore you need to have SVN installed, which is not a good thing to require. Why not provide it at a download location (url) where one can download a .tar.gz?

After solving this riddle I hit the road again with the init in the after_install and here I am not sure why the parameter is not yet installed, but well. Do we really need it there? After all you are restarting the server after an install of a package anyway, and init runs upon server start, so ....

Just a minor thing though. As per convention the callback procedures (to which before_install and after_install belong) are put into a file $package_name-callback-procs.tcl or apm-callback-procs.tcl (new / old convention). But this is not documented in the developers guide, I think 😊.

Collapse
8: Re: TWiST OpenACS package (response to 6)
Posted by Tom Jackson on
There is a new version up at http://junom.com/openacs/ (0.9.3.2).

I finally figured it out, I hope. Before-install means that a Tcl proc is run prior to loading any database code. After-install means after the database code has been run. Both seem to run before APM considers the package to be installed, so it is before there is a package_id, so you can't use parameter::set... in either of these.

But there is another issue as well: I was thinking that the package parameters would be initially taken from the twist.info file, but they are not. This means that if you don't like the defaults (except the mount point, which works), you need to change them in twist-procs.tcl in the proc ::twist::install::init.

Although the normal install requires subversion, it isn't necessary. I don't have subversion on the server where I created the package; on the other hand, I don't have wget on my local machine, so coming up with an 'always sure to work' solution may not be possible. Here is the reasoning behind the way the package works:

If you want to upgrade TWiST, go to the application instance and change the version parameter. Restart your server. The old version remains in place, and you can revert back to it if there is some issue with the new version, just change the version number back and restart the server. You can remove the old version if you wish. The upgrade of TWiST version doesn't affect the OpenACS package.

The new OpenACS package removes the 'initialized' parameter and replaces it with an 'installed' parameter. The default in twist.info is '1', but until the package is installed, the 'init' procedure sets it to '0'. Once this becomes '1', which means that the package is installed, the sourceDirectory parameter is updated with the Tcl default. This parameter is set in Tcl code to [ns_info tcllib], so if you want the TWiST source somewhere else, you have to edit the Tcl code prior to installation, or change the sourceDirectory parameter and restart the server, after installation. This will force a re-download of the code using svn ... or just move it by hand into place and restart.

Collapse
5: Re: TWiST OpenACS package (response to 3)
Posted by Tom Jackson on
Claudio,

I've added an update to http://junom.com/openacs/

I uninstalled the package from my OpenACS and tried it from scratch, 0.9.3.1. I get a different error, but it installed anyway, something about a missing url, like set_url? You might need to restart the server, but the error you found could prevent it from ever loading. Note that I don't have svn on my server, so I had to place the files in [ns_info tcllib]/twist/twist-$version/, but I have tested the download code on my laptop. These errors are unrelated. Maybe my apm is out of date?

I'm still not sure exactly how this works. I went to the list of applications for the main site, after the restart and added TWiST. Is this necessary? But it also added it at the url /twist-2/.

One way to test the installation is to see if the documentation is showing up under /twist/doc/, or whatever directory it ends up at, plus doc/.

I'll be out for a few hours, but back later this evening.

Collapse
7: Re: TWiST OpenACS package (response to 5)
Posted by Claudio Pasolini on
Following Malte's suggestion and downloading your updated TWiST version I managed to install the package, even if I got another error (that I forgot to annotate).

As a result the package was created and the twist code was correctly checked out by subversion, but:

  • the package was not auto mounted on the site map
  • the links to the documentation and to the example web services were missing, even if I had set the corresponding parameters to "1" before installing
  • the parameter "sourceDirectory" was empty
I manually mounted the package, executed the proc ::twist::install::after-install to create the missing links and set the parameter "sourceDirectory" (not sure if it is necessary) and restarted the server.

Now all is working fine, but naturally only after modifying the config.tcl adding the line:

    ns_param   twsdl              tcl
to the list of Aolserver modules: perhaps you could add a simple reminder about this into the package /doc.

Thank you very much for your work on complex types and the examples provided!

Collapse
9: Re: TWiST OpenACS package (response to 7)
Posted by Tom Jackson on
There seemed to be two causes for errors:

First I tried to use parameter::set... before the package was installed. The bottom line result is that you can't access the parameter defaults in the twist.info file prior to the package being installed. I finally figured out how to use this to my advantage.

Second: a mount point like '/twist/' was rejected, I think due to the leading '/'. Changing it to 'twist' seemed fo fix the error.

Third: code in twist-init.tcl should not run until the package is installed. The installed and upgradeNow parameters default to 0 before installation, so this code doesn't run until you restart the server.

Claudio,

You should not have to modify your config.tcl file, the TWiST code is sourced by the twist-init.tcl file during startup.

If this change actually works at all, it would not be good, because the twist source should be at tcl/twist/twist-$version/. If AOLserver is finding and executing subdirectories of tcl/twist, then the next time you upgrade twist, both versions will execute. Hopefully your install is just working as expected and not because of the change to config.tcl.

If you decide to test the new package, you might need to delete the site-node created. At least once in my testing I ended up with twist-2/ as the auto-mount point.

I am still working to improve this so it is easier to install and upgrade, and follows OpenACS conventions.

So far I have these suggestions (some my own):

1. alternative download option, using http/tar.gz. Which client should I standardize on?

2. maybe move the install/callback code to other files.

3. provide some OpenACS package specific documentation.

4. make it easier to setup defaults prior to package installation.

5. examples using the OpenACS API.

6. some method for discovering or registering twist configuration files.