Forum OpenACS Q&A: Instances of OpenACS

Collapse
Posted by James Bennin on
Is there any way to have two instances of OpenACS running the same machine (two servers on the same machines) If yes, how do I go about it?  Do I need to install another AOLServer?  What do I do?
Collapse
2: Re: Instances of OpenACS (response to 1)
Posted by Brian Fenton on
No, you don't need to install AOLserver again but you do need another nsd.tcl. You also need another database user and another copy of all the tcl and adp files. A (very) rough outline of a quick and dirty solution is to take an export dump of your current database, create a new database user and then import the dump to the new user. Then copy your tcl and adp files to another directory. Then make a copy of your nsd.tcl, edit it and change the port, database user and serverroot and off you go. (You might need to copy your aol/servers/yourserver directory too.)
Collapse
3: Re: Instances of OpenACS (response to 1)
Posted by James Bennin on
Thank you for reply.  Could you give or is there any step-by-step documentation on how to go about this?
Collapse
4: Re: Instances of OpenACS (response to 3)
Posted by Brian Fenton on
You're in luck. I found a document I put together in here a few years ago when all this was new to me. I'm sure most of it is still relevant. It describes taking a server called bestadvice and making a copy of it called release. It's for Oracle.

The Problem:
setting up a copy of the live environment as a test/release environment (on the same server). We use the same Oracle database, just make a separate tablespace and user. We also need a new web server. This environment will be used for releasing software too before moving programs, database changes etc. to live.

This involves:

1. Oracle tablespace - we want to make this smaller than the live one since it's only a test system. I chose 100M.
[oracle@bestadvice bin]$ svrmgrl
SVRMGR> connect internal
Connected.
SVRMGR> CREATE TABLESPACE release DATAFILE '/bestadvice1/oradata/release01.dbf' SIZE 100M DEFAULT STORAGE (INITIAL 100K NEXT 100K MI
NEXTENTS 1 MAXEXTENTS 249 PCTINCREASE 0);
Statement processed.

2. New database user - make sure he uses the new tablespace!
SVRMGR> create user release identified by release default tablespace release temporary tablespace temp quota unlimited on release;
Statement processed.
SVRMGR> grant dba to release;
Statement processed.

3. Create ACS tables in the new schema:
We're going to do this using an export of the ACS tables from the bestadvice user.

[oracle@bestadvice oradata]$ exp bestadvice/bestadvice file=/tmp/acs.dmp
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user BESTADVICE
. exporting object type definitions for user BESTADVICE
About to export BESTADVICE's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export BESTADVICE's tables via Conventional Path ...
. . exporting table                    ACS_MODULES        13 rows exported
. . exporting table                  ADDRESS_BOOK          0 rows exported
. . exporting table  ADDRESS_BOOK_VIEWABLE_COLUMNS        19 rows exported
. . exporting table            ADMINISTRATION_INFO          6 rows exported
...
...
...
...
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.

Now import /tmp/acs.dmp back into the release user. Note, the example given here will only work if the release schema is empty. So, if you want to overwrite the schema, you'll want to type drop user release cascade; in svrmgrl and then recreate release as above.

[oracle@bestadvice oradata]$ imp release/release file=/tmp/acs.dmp full=y
. importing BESTADVICE's objects into RELEASE
. . importing table                  "ACS_MODULES"        13 rows imported
. . importing table                "ADDRESS_BOOK"          0 rows imported
. . importing table "ADDRESS_BOOK_VIEWABLE_COLUMNS"        19 rows imported
. . importing table          "ADMINISTRATION_INFO"          6 rows imported
. . importing table                        "ADVS"          0 rows imported
. . importing table              "ADV_CATEGORIES"          0 rows imported
. . importing table                  "ADV_GROUPS"          0 rows imported
...
...
...
IMP-00017: following statement failed with ORACLE error 1730:
"CREATE FORCE VIEW "RELEASE"."IM_EMPLOYEES_ACTIVE"                        ("
...
...
...
ORA-00904: invalid column name
IMP-00015: following statement failed because the object already exists:
"ALTER TABLE "SEC_SESSION_PROPERTIES" ADD FOREIGN KEY ("SESSION_ID") REFEREN"
"CES "SEC_SESSIONS" ("SESSION_ID") ON DELETE CASCADE ENABLE"
About to enable constraints...
Import terminated successfully with warnings.

Don't worry unduly about the warnings - most of them are unimportant. Any errors should be looked at though.

4. AOLserver:
Simple! There's no need to re-install AOLserver. Just copy the live aolserver ini file and edit it as follows:

[oracle@bestadvice aol33]$ cd /apps/aol33/
[oracle@bestadvice aol33]$ cp bestadvice.tcl release.tcl
[oracle@bestadvice aol33]$ vi release.tcl

Change the following parameters:
Do a global replace of "bestadvice" with "release" as follows
Press Esc. Then :g/bestadvice/s//release/gc
Press y if you're sure want to replace an entry.

You also have to change the port to whatever port you like in the following section:
ns_section ns/server/release/module/nssock
ns_param Port 8000
That's all!

5. Next, you need a website i.e. some html and tcl. Just copy the bestadvice one across:
[root@bestadvice /root]# cp -Rp /web/bestadvice/ /web/release

6. You have to edit the /web/release/parameters/ad.ini file too.
Same thing as the AOLserver ini file:
[root@bestadvice aol33]$ vi /web/release/parameters/release.tcl
Do a global replace of "bestadvice" with "release" as follows
Press Esc. Then :g/bestadvice/s//release/gc
Press y if you're sure want to replace an entry.

7. All you need now is a startup script.
We'll use daemontools to monitor the AOLserver
So, login as root.
Create a directory named /service/.release
Copy the run script from /service/bestadvice.com into the new directory
Edit the run script to use the new ini file i.e. the exec line looks like this:
exec /apps/aol33/bin/nsd -izkt /apps/aol33/release.tcl -u oracle
Test the run script before going any further by typing /service/.release/run & - check the webserver is up by visiting http://192.168.0.20:8001 (or wherever you put the website). Down it when you're satisfied by typing:
[root@bestadvice aol33]$ kill -TERM `cat /apps/aol33/log/nspid.release`

When you're happy that the run script works, simply rename the directory to /service/release
[root@bestadvice aol33]$ mv /service/.release /service/release
That's all you need to do - daemontools should now start up the release webserver. If you have any problems, read the daemontools instructions for further information.

Basically the most important things you need to know are:
svc - u /service/release - this brings up release if it's down
svc - td /service/release - this brings releasedown

.

Collapse
5: Re: Instances of OpenACS (response to 1)
Posted by James Bennin on
Thank you so much for your help.  I am not using Oracle, I am using PostGreSQL instead.  Will this affect the outline you have given me?
Collapse
6: Re: Instances of OpenACS (response to 5)
Posted by Brian Fenton on
Sorry, I can't help you there - I've never used Postgres, but I'm sure it's the same in principle: create a tablespace and a user, take a dump and import it back into the new user.
Collapse
7: Re: Instances of OpenACS (response to 1)
Posted by Brad Ford on
Hi James,

Once you've got one instance set up, it's quite simple to add additional instances. I have four separate instances running on my wimpy duron 800 server - that should be had as I just tried doing a live upgrade from suse 8.2 to 9.0 and hosed the server. Luckily they were just experiments, nothing crucial. This time around, I'm going to document all the little suse quirks and tips for myself to remember.

In a nutshell, here's what you need to do:

1. Create a new user in the web group with the name of the new service/instance

2. Create a new db with the same name + I also run the openFTS scripts

3. Create a new directory under /web (or /var/lib/aolserver i think if you're following the head install docs) with the same name as your service

4. Copy everything from /web/existing service to /web/new service - you'll have to su to copy parts of /web/etc

5. Edit the config.tcl in /web/etc changing the service name to the new one

6. I use web forwarding through www.zoneedit.com to point multiple domain names to a single ip address. To do this, I have all the aol instances listening on different ports. If that's the route you want to take, you'll need to edit the listening port in config.tcl and change the ip to 0.0.0.0. Alternatively, use squid and apache for virtual hosting - search the forums for help on that. I'll be switching over on this setup and will writeup what I do

7. Edit the run file in /web/etc changing the service name to the new one

8. Fire off the linking command to link the service to daemon tools - ln -s /web/service0/etc/daemontools/ /service/service0

9. Start the service - svc -u /service/service0

10. Visit your new service in a web browser and follow the installation instructions as usual

That's all

You may notice that this is basically just following "Install OpenACS 4.6.3" section of the install guide - works for head as well. I haven't tried the new auto install method yet as outlined in the head docs.

Collapse
8: Re: Instances of OpenACS (response to 1)
Posted by James Bennin on
Thank you so much for your help. I had kind of figure these steps on my own, up till the last point.  The problem I am having now is I think I was trying to fiddle with the daemontools directory and now when I try to run the "svc" commnands on the existing service, I get an error that says

svc: warning: unable to control /service/service0/: supervise not running

Do you have any clue of what is going?  How can remedy that?

Collapse
9: Re: Instances of OpenACS (response to 8)
Posted by Tom Jackson on

Probably supervise isn't running on service0, shoot us a listing:

$ ls -l /service
Collapse
10: Re: Instances of OpenACS (response to 1)
Posted by James Bennin on
Once again thank you very much. I was able to fix my problem.  I now have two instances of OpenACS running, and things are looking great.  One question I have is does anyone know how to operate the CMS (Content Management System) package?  If so please to me how.