Forum OpenACS Q&A: Re: Instances of OpenACS

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

.