Forum OpenACS Q&A: Running OpenACS & ACS on same machine

Apologies if this is a repeat question. I have posted a question
about this on a forum but can't remeber if it was here or
aolserver or aD site. Anyway, I am wondering how to run
OpenACS and ACS on one machine. Do I need two servers
listening to different ports or do I set up a virtual server for each. I
seem to remember reading something about the ACS needing
it's own aolserver  process, but I can't find the documentation
concerned.
Thanks
Collapse
Posted by Dan Wickstrom on
For development purposes, I run a server seperate server process for both acs and openacs with acs running on port 8080 and openacs running on port 8000.
Collapse
Posted by Krzysztof Kowalczyk on
You can do both. Actually, you have to run a separate servers on different ports and then you can build virtual hosting based on that. There is thread that describes vhosting using only one server but I guess it won't work for mixed ACS/OpenACS site.

Virtual server setup is described on this site: http://downloads.hollyjerry.org/

I've also seen somewhere on the web an example of using Apache to serve as a proxy instead of nsvhr module (looked quite simple).

Collapse
Posted by Jerry Asher on
A better URL is http://downloads.hollyjerry.org:16080/

The server at port 80 (which does virtually host the server at 16080) is my development and production server. That is, it's up and down alot, but I always leave the server at 16080 alone.

Collapse
Posted by Adam Shimali on
Dan, re using different ports for ACS and OpenACS did you add
the appropriate parameters refering to both ACS and OpenACS
to the nsd.tcl file and then have a separate directory structure for
each?
Collapse
Posted by Dan Wickstrom on
Everything is totally seperated.  Both acs and openacs have their own directory structure, and I use a .ini file to start acs and a .tcl file to start openacs.  I also have seperate auxconfig files for both system's as well.  I have it set-up like this because I'm constantly changing things in the openacs install, so I like to keep the acs classic installation totally seperated to ensure that I have a stable reference.
Collapse
Posted by Mike Slack on
Having seen this and similar questions a number of times, I'll finally stop being lazy and put in my $0.02.

I have found it useful to use the same nsd.tcl file to run both ACS and OpenACS.  It is called from another tcl file, which you can name anything you want (I'll call it "service_name.tcl").  It actually works pretty well for me.  Just edit and rename service_name.tcl for each of your ACS or OpenACS services (I also run non-ACS stuff with these config files as well).  To start a service, just use the command (from your aolserver home directory):

./bin/nsd -t ./service_name.tcl

Make sure both service_name.tcl and nsd.tcl are in the same home directory (actually I have a separate directory for all of the service_name.tcl files -- just make sure you apply the command above with the right path to service_name.tcl).

I will post both nsd.tcl and service_name.tcl here to follow.  Experts please feel free to critique these if you see any improvements and/or  comments you'd like to make.

Collapse
Posted by Mike Slack on
Here is the first of two files I promised:

#
# service_name.tcl 
# Parameters for Aolserver/ACS & OpenACS
# Mike Slack (mike@slacking.org)
#

# Set these environment variables for each service

set service_port                "80"
set service_port_ssl            "443"

set service_short_name          "slack"
set service_ip_name             "www.yourservername.org"
set service_ip_name_ssl         "www.yourservername.org"

set service_ip_address          "192.168.0.2"
set service_ip_address_ssl      "192.168.0.2"

set service_email               "mike@slacking.org"
set service_short_description   "Personal Home Page"
set service_database_username   "slack"
set service_database_password   "your_password"

set aol_home                    "/home/aol30"
set acs_home                    "/web/slack"

# binary flags
set use_cgi                     "0"
set use_java                    "0"
set use_ssl                     "0"
set use_acs                     "1"
set use_tcl                     "1"

# set to either "ora8", "postgres" or "none"
set database_type               "ora8"

source                          "${aol_home}/nsd.tcl"

Collapse
Posted by Mike Slack on
Here is the other config file:

#
# nsd.tcl 
# Parameters for Aolserver/ACS & OpenACS
# Mike Slack (mike@slacking.org)
#

# This file should not need editing, but should be called from "service_name.tcl"

if { [string equal $database_type "ora8"] } {
    set service_database_datasource ""
    set database_driver             "${aol_home}/bin/ora8.so"
} elseif { [string equal $database_type "postgres"] } {
    set service_database_datasource "localhost:5432:${service_short_name}"
    set database_driver             "${aol_home}/bin/postgres.so"
}

# Starting

ns_log notice                   "nsd.tcl: starting to read config file..."

#
# Should not need to edit (much) below here for different services
#

# General parameters

ns_section "ns/parameters"
ns_param User                   "nsadmin"
ns_param ServerLog              "${aol_home}/log/${service_short_name}-error.log"
ns_param Home                   "$aol_home"
ns_param StackSize              "500000"
if { $use_acs == 1 } {
    ns_param auxconfigdir       "${acs_home}/parameters"
}
ns_param MaxKeepAlive           "0"

ns_section "ns/threads"
ns_param SystemScope            "On"

ns_section "ns/server/${service_short_name}"
ns_param PageRoot               "${acs_home}/www"
ns_param DirectoryFile          "index.adp,index.tcl,index.html,index.htm"
ns_param Webmaster              "$service_email"
ns_param NoticeBgColor          "#ffffff"
if { $use_tcl == 1 } {
    ns_param EnableTclPages     "On"
}
ns_param NotFoundResponse       "/global/file-not-found.html"
ns_param ServerBusyResponse     "/global/busy.html"
ns_param ServerInternalErrorResponse "/global/error.html"
ns_param MaxThreads             "50"
ns_param MaxBusyThreads         "20"
ns_param MaxWait                "2"

ns_section "ns/server/${service_short_name}/adp"
ns_param Map                    "/*.adp"

# Database parameters

if { ![string equal $database_type "none"] } { 
    ns_section "ns/db/drivers"
    ns_param "$database_type"     "$database_driver"

    ns_section "ns/db/pools"
    ns_param main                 "main"
    ns_param subquery             "subquery"
    ns_param log                  "log"
    
    ns_section "ns/db/pool/main"
    ns_param MaxIdle              "1000000000"
    ns_param MaxOpen              "1000000000"
    ns_param Driver               "$database_type"
    ns_param Connections          "4"
    ns_param DataSource           "$service_database_datasource"
    ns_param User                 "$service_database_username"
    ns_param Password             "$service_database_password"
    ns_param Verbose              "On"
    ns_param ExtendedTableInfo    "On"

    ns_section "ns/db/pool/subquery"
    ns_param MaxIdle              "1000000000"
    ns_param MaxOpen              "1000000000"
    ns_param Driver               "$database_type"
    ns_param Connections          "4"
    ns_param DataSource           "$service_database_datasource"
    ns_param User                 "$service_database_username"
    ns_param Password             "$service_database_password"
    ns_param Verbose              "On"
    ns_param ExtendedTableInfo    "On"

    ns_section "ns/db/pool/log"
    ns_param MaxIdle              "1000000000"
    ns_param MaxOpen              "1000000000"
    ns_param Driver               "$database_type"
    ns_param Connections          "3"
    ns_param DataSource           "$service_database_datasource"
    ns_param User                 "$service_database_username"
    ns_param Password             "$service_database_password"
    ns_param Verbose              "On"
    ns_param ExtendedTableInfo    "On"

    ns_section "ns/server/${service_short_name}/db"
    ns_param Pools                "main,subquery,log"
    ns_param DefaultPool          "main"
}

# Module parameters

ns_section "ns/server/${service_short_name}/module/nslog"
ns_param EnableHostnameLookup   "Off"
ns_param File                   "${aol_home}/log/${service_short_name}.log"
ns_param LogCombined            "On"
ns_param LogRefer               "Off"
ns_param LogUserAgent           "Off"
ns_param MaxBackup              "5"
ns_param RollDay                "*"
ns_param RollFmt                "%Y-%m-%d-%H:%M"
ns_param RollHour               "0"
ns_param RollOnSignal           "On"
ns_param RollLog                "On"

ns_section "ns/server/${service_short_name}/module/nsperm"
ns_param Model                  "Small"
ns_param EnableHostnameLookup   "Off"

ns_section "ns/server/${service_short_name}/module/nssock"
ns_param timeout                "120"
ns_param Address                "${service_ip_address}"
ns_param Hostname               "${service_ip_name}"
ns_param Port                   "${service_port}"

if { $use_ssl == 1 } {
    ns_section "ns/server/${service_short_name}/module/nsssl"
    ns_param Address            "${service_ip_address_ssl}"
    ns_param Hostname           "${service_ip_name_ssl}"
    ns_param CertFile           "${aol_home}/servers/${service_short_name}/cert.pem"
    ns_param KeyFile            "${aol_home}/servers/${service_short_name}/key.pem"
    ns_param Port               "${service_port_ssl}"
}

if { $use_cgi == 1 } {
    ns_section "ns/server/${service_short_name}/module/nscgi" 
    ns_param Map                "GET  /cgi-bin ${acs_home}/cgi-bin"
    ns_param Map                "POST /cgi-bin ${acs_home}/cgi-bin" 
    ns_param Interps            "CGIinterps"

    ns_section "ns/interps/CGIinterps"
    ns_param ".cgi"             "/usr/bin/perl"
}

if { $use_java == 1 } {
    ns_section "ns/server/${service_short_name}/module/nsjava"
    ns_param EnableJava         "On"
    ns_param VerboseJvm         "Off"
    ns_param LogLevel           "Notice"
    ns_param DestroyJvm         "Off"
    ns_param DisableJITCompiler "Off"
    # This probably needs fixing if you're using java
    ns_param ClassPath          "/usr/local/jdk/jdk118_v1/lib/classes.zip:/usr/local/aolserver/bin/nsjava.jar:/home/nsadmin/mirror/acs3-pg/www/webmail/java/activation.jar:/home/nsadmin/mirror/acs3-pg/www/webmail/java/mail.jar:/home/nsadmin/mirror/acs3-pg/www/webmail/java" 
}

ns_section "ns/server/${service_short_name}/modules"
ns_param nsperm                 "${aol_home}/bin/nsperm.so"
ns_param nssock                 "${aol_home}/bin/nssock.so"
ns_param nslog                  "${aol_home}/bin/nslog.so"
if { $use_ssl == 1 } {
    ns_param nsssl              "${aol_home}/bin/nsssle.so"
}
if { $use_cgi == 1 } {
    ns_param nscgi              "${aol_home}/bin/nscgi.so"
}
if { $use_java == 1 } {
    ns_param nsjava             "${aol_home}/bin/libnsjava.so"
}

# Other misc parameters

ns_section "ns/server/${service_short_name}/MimeTypes"
ns_param Default                "text/plain"
ns_param NoExtension            "text/plain"
ns_param ".pcd"                 "image/x-photo-cd"
ns_param ".prc"                 "application/x-pilot"
ns_param ".xls"                 "application/vnd.ms-excel"

ns_section "ns/server/${service_short_name}/tcl"
if { $use_tcl == 1 } {
    ns_param Library            "${acs_home}/tcl"
}

ns_section "ns/servers"
ns_param "$service_short_name"  "${service_short_description}"

# Load ACS parameters (if you use a *.ini instead of a *.tcl config file, 
# you'll need to change ".tcl" to ".ini" below)

if { $use_acs == 1 } {
    source                      "${acs_home}/parameters/${service_short_name}.tcl"
}

# Done

ns_log notice                   "nsd.tcl: finished reading config file."

Collapse
Posted by Mike Slack on
Just to be clear, in the setup above, I have different services running on different ports.