0.00%
Search · Index

Weblog Page

Showing 161 - 170 of 230 Postings (summary)

Installing OpenACS packages

Created by Malte Sussdorff, last modified by Malte Sussdorff 07 Aug 2007, at 04:32 PM

by Jade Rubick

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff.

An OpenACS package extends your website and lets it do things it wasn't able to do before. You can have a weblog, a forums, a calendar, or even do sophisticated project-management via your website.

After you've installed OpenACS, you can congratulate yourself for a job well done. Then, you'll probably want to install a couple of packages.

To install packages, you have to be an administrator on the OpenACS webserver. Log in, and you'll see a link to Admin or the Control Panel. Click on that, then click on 'Install software'. Packages are sometimes also referred to as applications or software.

At this point, you'll need to determine whether or not you're able to install from the repository, or whether you should install from local files.

Basically, if you have a local CVS repository, or have custom code, you need to install from 'Local Files'. Otherwise, you can install from the OpenACS repository

If you want to install new packages, click on 'Install from Repository' or 'Install from Local'. Select the package, and click 'Install checked applications'. The system will check to make sure you have all necessary packages that the package you want depends on. If you're installing from Local Files, and you are missing any packages, you may have to add the packages your desired package depends on: the section called “Upgrading the OpenACS files”

If you run into any errors at all, check your /var/lib/aolserver/$OPENACS_SERVICE_NAME/log/error.log file, and post your error on the OpenACS forums

Once the package has been installed, then you will need to 'mount' the package. The next section handles that.

Configure OpenACS look and feel with templates

Created by Malte Sussdorff, last modified by Malte Sussdorff 07 Aug 2007, at 04:28 PM

To change the look and feel of OpenACS you will need to dig into the ACS Templating system and change at least some of the given templates and CSS files to suit your needs. Reuven Lerner has written a good Introduction to OpenACS Templates for the Linux Journal.

Configuring a new OpenACS Site

Created by Malte Sussdorff, last modified by Malte Sussdorff 07 Aug 2007, at 04:26 PM

by Joel Aufrecht

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff.

In this chapter, Configuring refers to making changes to a new OpenACS site through the web interface. In crude terms, these changes happen in the database, and are upgrade-safe. Customizing refers to changes that touch the file system, and require some planning if easy upgradability is to be maintained.

An introductory article was written be Reuven Lerner for the Linux Journal which is a good read.  

Creating an Application Package

Created by Joel Aufrecht, last modified by Malte Sussdorff 07 Aug 2007, at 04:24 PM

To start developing new code in OpenACS, we build a new package. A package is a a discrete collection of web pages, tcl code, and database tables and procedures. A package with user interface is called an application; a package which provides functions to other packages and has no direct interface, a service. A package can be installed, upgraded, and removed. It communicates with other packages through an API. This chapter walks you through the minimum steps to create a useful package, including writing documentation, setting up database tables and procedures, writing web pages, debugging, and automatic regression testing.

Before start with this tutorial read up the introduction on OpenACS Packages and http://www.linuxjournal.com/article/6337.

This tutorial uses the content repository package. This radically simplifies the database work, but forces us to work around the content repository's limitations, including an incomplete TCL API. So the tutorial is messier than we'd like right now. Code that is temporary hackage is clearly marked.

 
In this tutorial, we will make an application package for displaying a list of text notes.

You will need:

  • A computer with a working installation of OpenACS. If you don't have this, see Chapter2, Installation Overview .

  • Example files, which are included in the standard OpenACS 5.2.3rc1 distribution.

Figure9.1.Assumptions in this section

Fully qualified domain name of your serveryourserver.test
URL of your serverhttp://yourserver.test:8000
Name of development account$OPENACS_SERVICE_NAME
New Package keymyfirstpackage

We use the ACS Package Manager (APM) to add, remove, and upgrade packages. It handles package meta-data, such as lists of files that belong in the package. Each package is uniquely identified by a package key. To start developing a new package, use the APM to create an empty package with our new package key, myfirstpackage. This will create the initial directories, meta-information files, and database entries for a new package. (More info on APM)

  1. Browse to http://yourserver:8000/acs-admin/apm .

  2. Click Create a New Package.

    Fill in the fields listed below. Ignore the rest (and leave the check boxes alone). (Some will change automatically. Don't mess with those.)

    • Package Key: myfirstpackage

    • Package Name: My First Package

    • Package Plural: My First Package

    • Package Type: Application

    • Initial Version: 0.1d

    • Summary: This is my first package.

    At the bottom, click Create Package.

This creates a package rooted at /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage . This is the "home directory" of our new package, and all files in the package will be within this directory. More on the structure of packages).

In order to see your work in progress, you must create a map between the URL space of incoming requests and the package application instance. You do this by adding the application in the main site administration). This creates a link between the incoming URL requests and an instance of the application. (More on applications and nodes)

You can have instances of a package on one site, each with a different URL and different permissions, all sharing the same code and tables. This requires that a package be developed package-aware. You'll see how to do that in this tutorial.

  1. Browse to http://yourserver.test:8000/admin/applications/application-add/ .

  2. Choose "My First Package" from the list and click OK (the other fields are optional).

By mounting the package, we've caused all requests to http://yourserver.test:8000/my-first-package to be satisfied from the files at /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/www.

The remainder of the tutorial walks you through each file one at a time as you create the package. You can skip all this, and get a working package, by doing the following:

cd /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-core-docs/www/files/tutorial
psql $OPENACS_SERVICE_NAME -f myfirstpackage-create.sql
cp note-edit.* note-delete.tcl index.* ../../../../myfirstpackage/www/
mkdir ../../../../myfirstpackage/lib
cp note-list.* ../../../../myfirstpackage/lib/
cp myfirstpackage-*sql ../../../../myfirstpackage/sql/postgresql/
cp myfirstpackage-procs.tcl ../../../../myfirstpackage/tcl/test/
cp note-procs.tcl ../../../../myfirstpackage/tcl/

After restarting the server, the tutorial application will be installed and working at the url you selected in the previous step.

Overview

Created by Gustaf Neumann, last modified by Malte Sussdorff 07 Aug 2007, at 04:18 PM

A good detailed, yet somewhat outdated article is written by Reuven Lerner for the Linux Journal. It gives a good introduction, but please read on !

OpenACS (Open Architecture Community System) is an advanced toolkit for building scalable, community-oriented web applications. If you're thinking of building an enterprise-level web application, OpenACS is a solid, scalable framework for building dynamic content driven sites.

OpenACS is a collection of pre-built applications and services that you can use to build your web site/application. Through a modular architecture, OpenACS has packages for user/groups management, content management, e-commerce, news, FAQs, calendar, forums, bug tracking, full-text searching, and much more.

OpenACS relies on AOLserver, the free, multithreaded, scalable, Tcl-enabled, web/application server used by America Online for most of its web sites, and a true ACID-compliant Relational Database Management System (RDBMS). Currently OpenACS supports PostgreSQL, an open source RDBMS, and Oracle and is easily extensible to other databases which support a comparable feature set.

The OpenACS toolkit is derived from the ArsDigita Community System (ACS). ArsDigita (now part of Red Hat, Inc.) kindly made their work available under the GPL, making all of this possible.

The OpenACS project was born when Don Baccus, Ben Adida, and others decided to port ACS from Oracle to PostgreSQL, thus making it a fully open-source solution. With OpenACS 4, Oracle and PostgreSQL support were combined in one code base and with OpenACS 5, support for internationalization and localization has been added.

A vibrant and productive community has sprung up around the OpenACS software and there are many volunteer contributors as well as a commercial companies able to provide support, hosting, and custom development. Many of the production users are actively funding and contributing work back to the project. Formal, consensus driven governance has been established (with semi-annual elections) which ensures the project serves the needs of it's constituents.

The OpenACS community would like to hear your comments and can help you in your endeavors with the system. Visit our web site and feel free to ask questions or provide feedback.

Install PostgreSQL

Created by Gustaf Neumann, last modified by Dave Bauer 07 Aug 2007, at 05:41 AM

by Vinod Kurup

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff.

Skip this section if you will run only Oracle.

OpenACS 5.3.2 will run with PostgreSQL 8.2.x or 8.1.x.  8.2.4 is the recommended version of PostgreSQL.

  • Special notes for Mac OS X.If you are running Mac OS X prior to 10.3, you should be able to install and use PostGreSQL ???. Mac OS X 10.3 requires PostGreSQL ???.

  • Special Notes for Debian.

    Debian stable user should install PostGreSQL from source as detailed below, or they should use the www.backports.org backport for Postgres to get a more current version. Debian unstable users: the following process has been known to work (but you should double-check that the version of PostGreSQL is 8.1.0 or above):

    For Debian stable users, you can use backports, by adding this line to the /etc/apt/sources.list

    deb http://www.backports.org/debian stable bison postgresql openssl openssh tcl8.4 courier debconf spamassassin tla diff patch neon chkrootkit
    apt-get install postgresql postgresql-dev postgresql-doc
    ln -s /usr/include/postgresql/ /usr/include/pgsql
    ln -s /var/lib/postgres /usr/local/pgsql
    ln -s /usr/include/pgsql /usr/local/pgsql/include
    su postgres -c "/usr/lib/postgresql/bin/createlang plpgsql template1"

    and proceed to Tune postgres. (OPTIONAL) or to the next section.

  • Special Notes for Red Hat.Red Hat users: If you install PostgreSQL ??? from the Red Hat 9 RPM, you can skip a few steps. These shell commands add some links for compatibility with the directories from a source-based install; start the service; create a new group for web service users, and modify the postgres user's environment (more information):

    [root root]# ln -s /usr/lib/pgsql/ /var/lib/pgsql/lib
    [root root]# ln -s /var/lib/pgsql /usr/local/pgsql
    [root root]# ln -s /etc/init.d/postgresql /etc/init.d/postgres
    [root root]# ln -s /usr/bin /usr/local/pgsql/bin
    [root root]# service postgresql start
    Initializing database:
                                                               [  OK  ]
    Starting postgresql service:                               [  OK  ]
    [root root]# echo "export LD_LIBRARY_PATH=/usr/local/pgsql/lib" >> ~postgres/.bash_profile
    [root root]# echo "export PATH=$PATH:/usr/local/pgsql/bin" >> ~postgres/.bash_profile
    [root root]# groupadd web
    [root root]# su - postgres
    -bash-2.05b$
    
    ln -s /usr/lib/pgsql/ /var/lib/pgsql/lib
    ln -s /var/lib/pgsql /usr/local/pgsql
    ln -s /usr/bin /usr/local/pgsql/bin
    service postgresql start
    echo "export LD_LIBRARY_PATH=/usr/local/pgsql/lib" >> ~postgres/.bash_profile
    echo "export PATH=$PATH:/usr/local/pgsql/bin" >> ~postgres/.bash_profile
    groupadd web
    su - postgres
    

    ... and then skip to 8. Something similar may work for other binary packages as well.

  • Safe approach: install from source

    1. Unpack PostgreSQL 8.2.4.If you have not downloaded the postgresql tarball to /var/tmp/postgresql-8.2.4.tar.gz, get it.

      [root root]# cd /usr/local/src
      [root src]# tar xzf /var/tmp/postgresql-8.2.4.tar.gz
      [root src]# 
      cd /usr/local/src
      tar xzf /var/tmp/postgresql-8.2.4.tar.gz
    2. ALTERNATIVE: Unpack PostgreSQL 8.2.4.If you have not downloaded the postgresql tarball to /var/tmp/postgresql-8.2.4.tar.bz2, get it.

      [root root]# cd /usr/local/src
      [root src]# tar xfj /var/tmp/postgresql-8.2.4.tar.bz2
      [root src]# 
      cd /usr/local/src
      tar xfj /var/tmp/postgresql-8.2.4.tar.bz2
    3. Install Bison.Only do this if bison --version is smaller than 1.875 and you install PostgreSQL 8.2 from cvs instead of tarball.

      [root root]# cd /usr/local/src
      [root src]# wget http://ftp.gnu.org/gnu/bison/bison-1.875.tar.gz
      [root src]# tar xfz bison-1.875.tar.gz
      [root src]# cd bison-1.875
      [root src]# ./configure
      [root src]# make install
      
    4. Create the Postgres user. Create a user and group (if you haven't done so before) for PostgreSQL. This is the account that PostgreSQL will run as since it will not run as root. Since nobody will log in directly as that user, we'll leave the password blank.

      Debian users should probably use adduser instead of useradd. Type man adduser

      [root src]# groupadd web
      [root src]# useradd -g web -d /usr/local/pgsql postgres
      [root src]# mkdir -p /usr/local/pgsql
      [root src]# chown -R postgres.web /usr/local/pgsql /usr/local/src/postgresql-7.4.7
      [root src]# chmod 750 /usr/local/pgsql
      [root src]#
      groupadd web
      useradd -g web -d /usr/local/pgsql postgres
      mkdir -p /usr/local/pgsql
      chown -R postgres.web /usr/local/pgsql /usr/local/src/postgresql-7.4.7
      chmod 750 /usr/local/pgsql
      • Mac OS X: Do instead:First make sure the gids and uids below are available (change them if they are not).To list taken uids and gids:

        nireport / /groups name gid | grep "[0123456789][0123456789]"
        nireport / /users name uid | grep "[0123456789][0123456789]"

        Now you can install the users

        sudo niutil -create / /groups/web
        sudo niutil -createprop / /groups/web gid 201 sudo niutil -create / /users/postgres sudo niutil -createprop / /users/postgres gid 201 sudo niutil -createprop / /users/postgres uid 502 sudo niutil -createprop / /users/postgres home /usr/local/pgsql sudo niutil -create / /users/$OPENACS_SERVICE_NAME sudo niutil -createprop / /users/$OPENACS_SERVICE_NAME gid 201 sudo niutil -createprop / /users/$OPENACS_SERVICE_NAME uid 201 mkdir -p /usr/local/pgsql chown -R postgres:web /usr/local/pgsql /usr/local/src/postgresql-7.4.7 chmod 750 /usr/local/pgsql
      • FreeBSD users: need to add more parameters.

        [root src]# mkdir -p /usr/local/pgsql
        [root src]# pw groupadd -n web
        [root src]# pw useradd -n postgres -g web -d /usr/local/pgsql -s /bin/bash
        [root src]# chown -R postgres:web /usr/local/pgsql /usr/local/src/postgresql-7.4.7
        [root src]# chmod -R 750 /usr/local/pgsql
        [root src]#
        mkdir -p /usr/local/pgsql
        pw groupadd -n web
        pw useradd -n postgres -g web -d /usr/local/pgsql -s /bin/bash
        chown -R postgres:web /usr/local/pgsql /usr/local/src/postgresql-7.4.7
        chmod -R 750 /usr/local/pgsql
    5. Set up postgres's environment variables.They are necessary for the executable to find its supporting libraries. Put the following lines into the postgres user's environment.

      [root src]# su - postgres
      [postgres ~] emacs ~postgres/.bashrc
      

      Paste this line into .bash_profile:

      source $HOME/.bashrc

      Paste these lines into .bashrc:

      export PATH=/usr/local/bin/:$PATH:/usr/local/pgsql/bin
      export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgsql/lib

      Test this by logging in as postgres and checking the paths; you should see /usr/local/pgsql/bin somewhere in the output (the total output is system-dependent so yours may vary)

      [root src]# su - postgres
      [postgres pgsql]$ env | grep PATH
      LD_LIBRARY_PATH=:/usr/local/pgsql/lib
      PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin/X11:/usr/X11R6/bin:/root/bin:/usr/local/pgsql/bin:/usr/local/pgsql/bin
      [postgres pgsql]$ exit
      

      Don't continue unless you see correct output from env | grep PATH

    6. Compile and install PostgreSQL. Change to the postgres user and run ./configure to set the compilation options automatically. This is the point at which you can configure PostgreSQL in various ways. For example, if you are installing on "OS X" add the flags --with-includes=/sw/include/ --with-libraries=/sw/lib. If you want to see what the other possibilities are, run ./configure --help.

      On debian woody (stable, 3.0), do ./configure --without-readline --without-zlib.

      [root src]# su - postgres
      [postgres pgsql]$ cd /usr/local/src/postgresql-7.4.7
      [postgres postgresql-8.2.4]$ ./configure
      creating cache ./config.cache
      checking host system type... i686-pc-linux-gnu
      (many lines omitted>
      linking ./src/makefiles/Makefile.linux to src/Makefile.port
      linking ./src/backend/port/tas/dummy.s to src/backend/port/tas.s
      [postgres postgresql-8.2.4$ make all
      make -C doc all
      make[1]: Entering directory `/usr/local/src/postgresql-8.2.4/doc'
      (many lines omitted)
      make[1]: Leaving directory `/usr/local/src/postgresql-8.2.4/src'
      All of PostgreSQL successfully made. Ready to install.
      [postgres postgresql-8.2.4]$ make install
      make -C doc install
      make[1]: Entering directory `/usr/local/src/postgresql-8.2.4/doc'
      (many lines omitted)
      Thank you for choosing PostgreSQL, the most advanced open source database
      engine.
      su - postgres
      cd /usr/local/src/postgresql-8.2.4
      ./configure
      make all
      make install

       

    7. Edit /etc/postgresql.conf (Debian /etc/postgresql/8.2/postgresql.conf) to make sure the three following settings are correct:
      add_missing_from = true
      regex_flavor = enhanced
      default_with_oids = true
    8. Start PostgreSQL. The initdb command initializes the database. pg_ctl is used to start up PostgreSQL. If PostgreSQL is unable to allocate enough memory, see section 11 Tuning PostgreSQL (below).

      [postgres postgresql-8.2.4]$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
      The files belonging to this database system will be owned by user "postgres".
      This user must also own the server process.
      (17 lines omitted)
      or
          /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
      [postgres postgresql-7.4.7]$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/server.log start
      postmaster successfully started
      [postgres postgresql-7.4.7]$
      /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
      /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/server.log start

      PostgreSQL errors will be logged in /usr/local/pgsql/data/server.log

    9. Install Pl/pgSQL.Set up plpgsq and allow your user to have access. Plpgsql is a PL/SQL-like language. We add it to template1, which is the template from which all new databases are created. We can verify that it was created with the createlang command in list mode.

      Additionals to install in Postgres 8.1.x

      [postgres postgresql-7.4.7]$ createlang plpgsql template1
      [postgres pgsql]$ createlang -l template1
      Procedural languages
        Name   | Trusted?
      ---------+----------
       plpgsql | t
      (1 row)
      
      [postgres pgsql-7.4.7]$
      createlang plpgsql template1
      createlang -l template1
    10. Test PostgreSQL (OPTIONAL).Create a database and try some simple commands. The output should be as shown.

      [postgres pgsql]$ createdb mytestdb
      CREATE DATABASE
      [postgres pgsql]$ psql mytestdb
      Welcome to psql, the PostgreSQL interactive terminal.
      
      Type:  \copyright for distribution terms
             \h for help with SQL commands
             \? for help on internal slash commands
             \g or terminate with semicolon to execute query
             \q to quit
      
      mytestdb=# select current_timestamp;
                timestamptz
      -------------------------------
       2003-03-07 22:18:29.185413-08
      (1 row)
      
      mytestdb=# create function test1() returns integer as 'begin return 1; end;' language 'plpgsql';
      CREATE
      mytestdb=# select test1();
       test1
      -------
           1
      (1 row)
      
      mytestdb=# \q
      [postgres pgsql]$ dropdb mytestdb
      DROP DATABASE
      [postgres pgsql]$ exit
      logout
      
      [root src]#
    11. Set PostgreSQL to start on boot. First, we copy the postgresql.txt init script, which automates startup and shutdown, to the distribution-specific init.d directory. Then we verify that it works. Then we automate it by setting up a bunch of symlinks that ensure that, when the operating system changes runlevels, postgresql goes to the appropriate state. Red Hat and Debian and SuSE each work a little differently. If you haven't untarred the OpenACS tarball, you will need to do so now to access the postgresql.txt file.

      • Red Hat RPM:

        The init script is already installed; just turn it on for the appropriate run levels.

        [root root]# chkconfig --level 345 postgresql on
        [root root]# 
      • Red Hat from source:

        [root src]# cp /var/tmp/openacs-5.2.3rc1/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
        [root src]# chown root.root /etc/rc.d/init.d/postgresql
        [root src]# chmod 755 /etc/rc.d/init.d/postgresql
        [root src]# 
        cp /var/tmp/openacs-5.2.3rc1/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
        chown root.root /etc/rc.d/init.d/postgresql
        chmod 755 /etc/rc.d/init.d/postgresql

        Test the script.

        [root root]# service postgresql stop
        Stopping PostgreSQL: ok
        [root root]# 

        If PostgreSQL successfully stopped, then use the following command to make sure that the script is run appropriately at boot and shutdown. And turn it back on because we'll use it later.

        [root root]# chkconfig --add postgresql
        [root root]# chkconfig --level 345 postgresql on
        [root root]# chkconfig --list postgresql
        postgresql      0:off   1:off   2:on    3:on    4:on    5:on    6:off
        [root root]# service postgresql start
        Starting PostgreSQL: ok
        [root root]#
        chkconfig --add postgresql
        chkconfig --level 345 postgresql on
        chkconfig --list postgresql
        service postgresql start
      • Debian:

        [root ~]# cp /var/tmp/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
        [root ~]# chown root.root /etc/init.d/postgresql
        [root ~]# chmod 755 /etc/init.d/postgresql
        [root ~]# 
        cp /var/tmp/openacs-5.2.3rc1/packages/acs-core-docs/www/files/postgresql.txt /etc/init.d/postgresql
        chown root.root /etc/init.d/postgresql
        chmod 755 /etc/init.d/postgresql
        

        Test the script

        [root ~]# /etc/init.d/postgresql stop
        Stopping PostgreSQL: ok
        [root ~]# 

        If PostgreSQL successfully stopped, then use the following command to make sure that the script is run appropriately at boot and shutdown.

        [root ~]# update-rc.d postgresql defaults
         Adding system startup for /etc/init.d/postgresql ...
           /etc/rc0.d/K20postgresql -> ../init.d/postgresql
           /etc/rc1.d/K20postgresql -> ../init.d/postgresql
           /etc/rc6.d/K20postgresql -> ../init.d/postgresql
           /etc/rc2.d/S20postgresql -> ../init.d/postgresql
           /etc/rc3.d/S20postgresql -> ../init.d/postgresql
           /etc/rc4.d/S20postgresql -> ../init.d/postgresql
           /etc/rc5.d/S20postgresql -> ../init.d/postgresql
        [root ~]# /etc/init.d/postgresql start
        Starting PostgreSQL: ok
        [root ~]#
      • FreeBSD:

        [root ~]# cp /tmp/openacs-5.2.3rc1/packages/acs-core-docs/www/files/postgresql.txt /usr/local/etc/rc.d/postgresql.sh
        [root ~]# chown root:wheel /usr/local/etc/rc.d/postgresql.sh
        [root ~]# chmod 755 /usr/local/etc/rc.d/postgresql.sh
        [root ~]# 
        cp /tmp/openacs-5.2.3rc1/packages/acs-core-docs/www/files/postgresql.txt /usr/local/etc/rc.d/postgresql.sh
        chown root:wheel /usr/local/etc/rc.d/postgresql.sh
        chmod 755 /usr/local/etc/rc.d/postgresql.sh
        

        Test the script

        [root ~]# /usr/local/etc/rc.d/postgresql.sh stop
        Stopping PostgreSQL: ok
        [root ~]# 

        If PostgreSQL successfully stopped, then turn it back on because we'll use it later.

        [root root]# /usr/local/etc/rc.d/postgresql.sh start
        Starting PostgreSQL: ok
        [root root]#
        /usr/local/etc/rc.d/postgresql.sh start
        
      • SuSE:

        Note

        I have received reports that SuSE 8.0 is different from previous versions. Instead of installing the boot scripts in /etc/rc.d/init.d/, they should be placed in /etc/init.d/. If you're using SuSE 8.0, delete the rc.d/ part in each of the following commands.

        [root ~]# cp /var/tmp/openacs-5.2.3rc1/packages/acs-core-docs/www/files/postgresql.txt /etc/rc.d/init.d/postgresql
        [root ~]# chown root.root /etc/rc.d/init.d/postgresql
        [root ~]# chmod 755 /etc/rc.d/init.d/postgresql
        

        Test the script.

        [root ~]# /etc/rc.d/init.d/postgresql stop
        Stopping PostgreSQL: ok

        If PostgreSQL successfully stopped, then use the following command to make sure that the script is run appropriately at boot and shutdown.

        [root ~]# cd /etc/rc.d/init.d
        root:/etc/rc.d/init.d# ln -s /etc/rc.d/init.d/postgresql K20postgresql
        root:/etc/rc.d/init.d# ln -s /etc/rc.d/init.d/postgresql S20postgresql  
        root:/etc/rc.d/init.d# cp K20postgresql rc2.d
        root:/etc/rc.d/init.d# cp S20postgresql rc2.d
        root:/etc/rc.d/init.d# cp K20postgresql rc3.d
        root:/etc/rc.d/init.d# cp S20postgresql rc3.d
        root:/etc/rc.d/init.d# cp K20postgresql rc4.d
        root:/etc/rc.d/init.d# cp S20postgresql rc4.d 
        root:/etc/rc.d/init.d# cp K20postgresql rc5.d
        root:/etc/rc.d/init.d# cp S20postgresql rc5.d
        root:/etc/rc.d/init.d# rm K20postgresql
        root:/etc/rc.d/init.d# rm S20postgresql
        root:/etc/rc.d/init.d# 

        Test configuration.

        root:/etc/rc.d/init.d # cd
        root:~ # /etc/rc.d/init.d/rc2.d/S20postgresql start
        Starting PostgreSQL: ok
        root:~ # 
      • Mac OS X 10.3:

        1. Install the startup script:

          cd /System/Library/StartupItems/tar xfz /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-core-docs/www/files/osx-postgres-startup-item.tgz
          
      • Mac OS X 10.4 can use Launchd:

        1. Install the startup script:

          cd /Library/LaunchDaemonscp
          /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-core-docs/www/files/osx-postgres-launchd-item.txt
          org.postgresql.PostgreSQL.plist

          If postgres does not start automatically on reboot, see what error you get when manually starting it with:

          $ sudo launchctl load /Library/LaunchDaemons/org.postgresql.PostgreSQL.plist
          $ sudo launchctl start org.postgresql.PostgreSQL
          

      From now on, PostgreSQL should start automatically each time you boot up and it should shutdown gracefully each time you shut down. (Note: Debian defaults to starting all services on runlevels 2-5. Red Hat defaults to starting services on 3-5. So, on Red Hat, PostgreSQL won't start on runlevel 2 unless you alter the above commands a little. This usually isn't a problem as Red Hat defaults to runlevel 3)

    12. Tune postgres. (OPTIONAL).The default values for PostgreSQL are very conservative; we can safely change some of them and improve performance.

      1. Change the kernel parameter for maximum shared memory segment size to 128Mb:

        [root root]# echo 134217728 >/proc/sys/kernel/shmmax
        [root root]#

        Make that change permanent by editing /etc/sysctl.conf to add these lines at the end:

        # increase shared memory limit for postgres
        kernel.shmmax = 134217728
      2. Edit the PostgreSQL config file, /usr/local/pgsql/data/postgresql.conf, to use more memory. These values should improve performance in most cases. (more information)

        #       Shared Memory Size
        #
        shared_buffers = 15200 # 2*max_connections, min 16

        # Non-shared Memory Sizes
        #
        sort_mem = 32168 # min 32


        # Write-ahead log (WAL)
        #
        checkpoint_segments = 3 # in logfile segments (16MB each), min 1

        Restart postgres (service postgresql restart) or (/etc/init.d/postgres restart) so that the changes take effect.

      FreeBSD users: See man syctl, man 5 sysctl and man 5 loader.conf.

      Performance tuning resources:

OpenACS: robust web development framework

Created by Anett Szabo, last modified by Anett Szabo 30 Jul 2007, at 01:58 PM

OpenACS: robust web development framework


Author: Rocael Hernández, Galileo University, Guatemala / OpenACS Core Team, roc@viaro.net
Author: Andrew Grumet, OpenACS Core Team, aegrumet@alum.mit.edu


Tcl/Tk 2005 Conference, Portland, Oregon


Abstract:


OpenACS is a full featured web development framework to create scalable applications
oriented to collaboration and online communities. Is in use by many big players such as
greenpeace.org or the e-learning platform of the MIT Sloan School of Management.
While the system is not trivial, here are explained some of the most interesting and still
relatively simple facilities that the framework provides. Everything from templating,
separating the code from the presentation, database interactions according to the
programming language, auto-documentation features, automated test engine,
internationalization, and many more are written in Tcl, which has shown to be extremely
powerful for writing the foundation logic and the application pages.


Advanced infrastructure

Created by Anett Szabo, last modified by Anett Szabo 30 Jul 2007, at 01:57 PM

3.1. Serving files: packages, instances, site-map, request processor


Like other Web environments OpenACS can serve familiar file types such as .html and
.gif files from a document root. The OpenACS standard document root is
$OACS_HOME/www. Put a file at $OACS_HOME/www/hello.html and it will appear
at http://yourserver.example.com/hello.html.
OpenACS can also run scripts that set up variables and display them in HTML-like
templates, and also embed templates within other templates via include and master/slave
tags. These topics are covered in the Template system section above. In the sections
below we explore OpenACS more advanced mechanisms for serving files.


3.1.1. Packages

OpenACS is modularized into a set of packages that can be found in the
$OACS_HOME/packages subdirectory. Each package may contain SQL scripts, Tcl
libraries and visible pages, as illustrated in the abbreviated directory layout below:

$OACS_HOME/
packages/
acs-admin/ # Core package.
acs-api-browser/ # Core package.
...
forums/ # Forums package.
catalog/ # i18n message catalogs.
forums.info # Package specification file.
lib/ # Re-usable tcl/adp templates.
sql/ # Data model scripts.
tcl/ # Tcl library.
www/ # Package document root.
forum-view.tcl
forum-view.adp
...
www/ # Default document root.

This example draws attention to the forums package, one of dozens of application
packages available for use with OpenACS. Other available packages include a Webbased
files storage system (which also is WebDAV-enabled), calendaring, blog
authoring, assessment, news aggregation, wikis, photo galleries, RSS support, XMLRPC,
SOAP support and many more. A full list of packages can be browsed at
http://cvs.openacs.org/cvs/openacs-4/packages/.
Packages are managed with the OpenACS package manager, which handles upgrades and
tracks versions, dependencies and files much like Linux package managers do.
A view of the Package Manager:


3.1.2. Site map, package instances, request processor

Each package can have its own document root that functions like the default document
root at $OACS_HOME/www. The document root for the forums package is located at
$OACS_HOME/packages/forums/www, as illustrated in the abbreviated directory layout
above.
Package document roots are mapped to visible URLs through a set of database tables,
configuration data, libraries and administration Web pages known collectively as the site
map. Using the site map we can map $OACS_HOME/packages/forums/www to, for
example, http://yourserver.example.com/tclers-forums/. But it gets more interesting,
because the site map allows for re-use of packages at multiple URLs. Hence we can host
a discussion forum for C programmers by adding a new site map entry that maps the
forums package to http://yourserver.example.com/cprogrammers-forums/.
These mappings are referred to in OpenACS-speak as “package instances”. As the
terminology hints, the mapping to /tclers-forums has distinct configuration data from the
mapping to /cprogrammers-forums. Hence the /tclers-forums instance might contain a
Tcl Forum, a Tk Forum and an AOLserver Forum, while the /cprogrammers-forums
instance contains a Small and Fast Forum and a Some Compilation Required Forum.
Because package instances are OpenACS objects, they can be have different permission
settings, so that some users may be able to read and post to the /tclers-forums but not the
/cprogrammers-forums, and vice-versa. The OpenACS object system will be covered in
more detail below.
Before doing that, let’s take a brief diversion into the mechanics of how files are served,
Requests for OpenACS Web pages pass through a Request Processor, which is a global
filter and set of Tcl procs that respond to every incoming URL reaching the server. The
following diagram summarizes the stages of the request processor assuming a URL
request like http://yourserver.example.com/notes/somepage.adp.
The stages are:
1. Search the Site Map, to map the URL to the appropriate physical directory in the
filesystem.
2. Authenticate the user.
3. Authorize the possible specific defined permissions that the site node might have.
4. Process the URL, search for the appropriate file and server it.


 
3.2. Object system and services


Deep in OpenACS’ design is the notion that one should be able to build common services
that are useful across the toolkit. Hence a commenting engine ought work equally well
for blog posts as it does for images in photo galleries. Furthermore, any sufficiently
interesting piece of data in the system ought to carry basic accounting information with it,
such as who created it and timestamps for creation and modification.
The OpenACS object system addresses these requirements by defining a central SQL
table called acs_objects and giving this table a column for each generic bit of
information. Most importantly, acs_objects has a primary key column, named
object_id. This primary key is the anchor on which all other information about an
object rests. If the object is a blog post, the post body might live in a separate table
blog_posts whose primary key, post_id, is a reference back to
acs_objects.object_id. If the object is an image, it might contain a binary field
containing the image bits or alternatively a text field pointing to the physical storage
location of the image file, and also an image_id primary key that is a reference back to
acs_objects.object_id. Since each blog post and each image has a row in
acs_objects, comments on either can be inserted into a table that contains an
on_what_object column that points back to the object_id.
Any data that participates in the OpenACS object system can tell us its title, what kind of
object it is, when it was created and by whom. It can also be assigned permissions,
commented on, categorized, have files attached to it, and benefit from any other objectlevel
services that we can dream up.
The OpenACS object system, site map and instances are the foundation of OpenACS.
More information about these can be found at the following URLs:
http://openacs.org/doc/openacs-5-1/request-processor.html
http://openacs.org/doc/openacs-5-1/subsites.html
http://openacs.org/doc/openacs-5-1/packages.html


 3.3. Developer Support


OpenACS provides a set of developer support tools to improve the development process,
debugging, testing, and searching of the API. These tools enhance many of the day to day
activities of the developers.
The functionalities that developer support provides are:
1. Time to serve a given request. Good for performance problem detection and
improvement.
2. Tracing database calls involved in a given request, where the involved queries
are located, what was the actual query executed and how long did it take to return
the data. Useful for improving queries that might be slowing your application
performance.
3. Tracing scripts involved in serving a given request. Showing the time taken to
perform a given script, its location, code, and error that it might bring. Especially
important for tuning applications performance.
4. ADP reveal, to show in the browser which part of the rendered html belongs to a
given script.
5. User Switching, as an admin account switch easily to another account to
reproduce and test actions, and then simply go back to the administrator account.
6. OpenACS Shell, which is a Tcl shell with all the API available within OpenACS,
in order to simplify the testing of small pieces of Tcl within your browser.
An screenshot of the ADP Reveal:
The Tracing Script view, information shown at the bottom of each server page:
OpenACS also provides an implicit mechanism to document any script or procedure that
you might create, and then display and search that scripts or procedures, its documented
information, expected inputs and outputs, and its code though a Web interface at your
own OpenACS installation, like yourserver.com/api-doc, have a look here:
http://openacs.org/api-doc/
Finally, using the package manager, the Web server can be instructed to reload Tcl
library files without a restart of the webserver, and keep watching them for subsequent
changes, which is quite useful for the developers.


 
3.5. Testing Framework


OpenACS provides a full featured testing framework to create, maintain and run
automated test in your applications. The main characteristics of it are:
- Define tests, as smoke, config, database, web, etc. in a per package basis. And
with the API provided by the test framework you have a UI to check results, and
log events when executing a test case.
- Test your application at the proc level, using specific Test API to define and
check if your procs are behaving as expected.
- Test your end-user web scripts using a third party tool, such as tclwebtest or
perl::mechanize, to test the end-user pages automatically simulating end user
navigation (clicks) through the application and finally check the outpus using the
Test API.
- Define procedures that many tests might call, in order to automate similar
activities that need to be done before running a test case.
- Rollback the generated data after executing a test case.
- Rollback code section, to perform actions that will rollback the actions done by
running a test case, specially designed for those situations where you cannot
encapsulate the database calls to rollback, like when you are calling the scripts
with an automated tool.
- Run tests by installation, package or by choosing an specific test case.


 
3.6. Internationalization


OpenACS provide a facility to internationalize its user interface texts (not the data stored)
to any desired language, right now OpenACS is translated to more than 20 languages.
The end users can change the language user interface by simply selecting it. Each
OpenACS package can be internationalized separately, maintaining a message keys
catalog, which consist in a specific XML DTD where each possible user interface
message is stored as a message key, and then translated to a given language. Although all
the data is stored in the xml file, everything is also stored in the database, for
performance reasons and to facilitate the edition of the message keys OpenACS provides
a simple UI for translation of message key. And exists an official translation server for
the community at: translate.openacs.org.


3.7. Callbacks


The callbacks are a simple method to execute procedures stored in each of the possible
installed packages that a given OpenACS installation might have. The objective is to give
the core applications to invoke in non-core packages that may or may not be installed, but
without cluttering core with code that belongs to other packages, making possible to have
independence among packages.
The architecture work as

-> Core proc for removing user
-> Invoke callbacks based on what's installed
-> Package A logic for removing user
-> Package B logic for removing user
-> Package C logic for removing user
...
-> Core logic for removing user

 


as opposed to this architecture


-> Package A proc for removing user
-> Package A logic for removing user
-> Call core proc for removing user
-> Package B proc for removing user
-> Package B logic for removing user
-> Call core proc for removing user

 

Callback implementations would be declared like this:

ad_proc -callback module::op -implementation implname { ... }

 Where ad_proc is a wrapper of the normal TCL proc, which mainly gives autodocumentation
structure for any procedure.
Core uses tcl introspection to find which callbacks exist and invokes them. eg
foreach proc [info procs ::callback::module::op::impl::*] {
$proc $args
}
To invoke a callback you do this
callback [ -catch ] [ -impl impl ] callback [ args... ]
The callbacks is a great improvement in order to keep simple yet separated, coherent and
modular a web framework that constantly evolves and grows. The larger goal is to
promote reuse of standard pages and functions by removing the need to create perpackage
versions of these.

Domain level tools

Created by Anett Szabo, last modified by Anett Szabo 30 Jul 2007, at 01:40 PM

4.1. Content Repository


The Content Repository (CR) is a central service application that can be used by other
applications to manage its content. The developer must define and declare the
interactions with the content repository. The main features that the content repository are:
- CR is capable to store any kind of information (files, data, text).
- Define application specific data structures that will use the CR features and
services within the application context.
- Revision control, which means that every addition and subsequent changes of an
application is registered, so the versions are kept and can be roll-backed.
- Ability to handle hierarchies, and folder structures, and inherit its properties.
- Easily interact with the CR and its specific defined structures through a welldefined
API, in order to add data or present it.
- Also handles publish states for content that might need it.
- Identify content through a content type definition.
- Associate the content with external applications.
- Store specific templates to use when displaying specific content types.
- Create relations between content repository items or external database objects.
- Embedded search facility to automatically expose the content to the search engine
the system might be using.
The process for an application to use the content repository goes as:
1. Define the database structure your application needs that will use some of the CR
features.
2. Use the standardized API (to add, edit, delete, present) to create scripts for your
CR-enabled-application.
The CR logic is stored in database functions and triggers, but it has a Tcl API that glue all
the involved database calls and makes straightforward for the developers to create
applications that use the CR.


4.2. Results: Vertical Applications


Within OpenACS a vertical application means a set packages that interact together to
provide a specific domain set of functionalities.
The following are good examples of vertical applications completely running in
OpenACS and using Tcl as the programming language:


4.2.1. Project Manager

Full featured Project manager, consist in a set of functionalities that can be summarized
as: track tasks, estimates and actual progress for a project. It consist in more that 5
packages. Features that are part f it: project creation, customers management, task
assignments, logs, comments, create processes, rates, etc.


4.2.2. Assessment Tool

Extremely powerful application to create several types of assessments such as online selftests,
surveys, tests and gathering of information in general. The main features of this
application are: IMS-QTI support for import and export of assessments, branching,
sections, several types of questions and many more are part of it. More information at:
http://cvs.openacs.org/cvs/*checkout*/openacs-
4/packages/assessment/www/doc/index.html?rev=1.6


4.2.3. Communities of Practice

Communities of Practice within OpenACS are represented by a set of tools available
through all the website to interact with any kind of applications. The main objective is to
give the power to the end user describe in many forms any object at the system and make
relations among them. Those tools are:
- Rate
- Comment
- Categorize
- Link
- Search
And those tools can be used in all the applications that the end user might have available,
such as forums, file storage, etc. For example, you can categorize a given file, and then
link it to a forum thread, which you are also rating and commenting. Then a third user
will search for given topic, and the first result will be the file, and when he looks at the
file, he’ll see as well all its related objects, such as the forum thread.


4.2.4. .LRN and the E-LANE project

.LRN (pronounced dot-learn, www.dotlrn.org) is a full featured LMS with extra
community building capabilities, uses packages available for OpenACS and integrate
other vertical applications described here. Its focus is to help the creation of learning and
research communities, and not just server as an LMS.
The E-LANE Project (European-Latin America New Education, www.e-lane.org) is
using .LRN as its foundation technology to promote and demonstrate e-learning within
this geographical area, the demonstration is based on three fundamental factors: the
learning methodology, the content development, and the technological platform, the three
of them brought together to use it in real scenarios for further improvement of .LRN.
As a contribution to the .LRN community, E-LANE has developed among other
applications the user-tracking package, which is mainly focused to “Analyze users
behavior and syndicate it by object type”.
This package is basically using Tcl to create the UI and the administrative actions, and
glue them with awstats (http://awstats.sourceforge.net/), which in this case is the log
analyzer used to parse the AOLserver request logs, and those logs contains a set of
special keys written on each http request logged, which is the base to generate specific
request reports for a given user and/or object type.

Introduction

Created by Anett Szabo, last modified by Anett Szabo 30 Jul 2007, at 01:08 PM

 
The Open Architecture Community System (OpenACS) is a Web development
framework for building applications that support online communities.
OpenACS provides a robust infrastructure, building on top of the following standard
components: the Tcl programming language, a Postgres or Oracle database for storing the
application data, AOLserver for HTTP service and *nix or Windows operating systems.
Like other modern Web frameworks, OpenACS supports: templating for separating the
logic from the presentation, internationalization to present the user interface in the user’s
preferred language, a modular package system to create sub-applications, a role and
permissioning system, a content repository to store all manner of content and maintain
versioning.

Next Page