Forum OpenACS Q&A: Response to ns_db not enabled

Collapse
Posted by Jose Mercado on
My nsd.tcl looks like this:


#
# nsd.tcl --  The AOLserver Startup Script
#
#      This is a Tcl script that is sourced when AOLserver starts up.
#      A detailed reference is in "doc/config.txt".
#

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


#
# Set some Tcl variables that are commonly used throughout this file.
#

set httpport               8000
set httpsport              8443

#set hostname               [ns_info hostname]
#set address                [ns_info address]
set hostname		   "localhost"
set address		   127.0.0.1

set servername             "server1"
set serverdesc             "AOL3 Test Server"

set homedir                [file dirname [ns_info config]]
set bindir                 [file dirname [ns_info nsd]]

set pageroot               /webroot/test/acspg/www
set directoryfile          index.adp,index.html,index.htm,index.tcl

# nsssl: Only loads if keyfile.pem and certfile.pem exist.
set sslkeyfile             ${homedir}/servers/${servername}/modules/nsssl/keyfile.pem
set sslcertfile            ${homedir}/servers/${servername}/modules/nsssl/certfile.pem

# nscp: Uncomment the sample password and log in with "nsadmin", password "x",#       type "ns_crypt newpassword salt" and put the new encrypted string below.
#set nscp_user ""
set nscp_user              "web:t2GqvvaiIUbF2:"
# sample user="nsadmin", pw="x"

#
# Global server parameters
#
ns_section "ns/parameters"
ns_param   home            $homedir
ns_param   debug           false


#
# Thread library (nsthread) parameters
#
ns_section "ns/threads"
ns_param   mutexmeter      true      ;# measure lock contention
#ns_param   stacksize [expr 128*1024] ;# Per-thread stack size for hungry C modules.

#
# MIME types.
#
#  Note: AOLserver already has an exhaustive list of MIME types, but in
#  case something is missing you can add it here.
#
ns_section "ns/mimetypes"
ns_param   default         "*/*"     ;# MIME type for unknown extension
ns_param   noextension     "*/*"     ;# MIME type for missing extension
#ns_param   ".xls"          "application/vnd.ms-excel"

#
# Create pools for ACS
#

ns_section "ns/db/pool/main"
ns_param   Driver            postgres
ns_param   Connections       4
ns_param   MaxOpen           1000000000
ns_param   MaxIdle           1000000000
ns_param   DataSource        localhost::test
ns_param   User              web
ns_param   Verbose           Off
ns_param   LogSQLErrors      Off
ns_param   ExtendedTableInfo  On

ns_section "ns/db/pool/subquery"
ns_param   Driver            postgres
ns_param   Connections       4
ns_param   MaxOpen           1000000000
ns_param   MaxIdle           1000000000
ns_param   DataSource        localhost::test
ns_param   User              web
ns_param   Verbose           Off
ns_param   LogSQLErrors      Off
ns_param   ExtendedTableInfo  On

ns_section "ns/db/pool/log"
ns_param   Driver            postgres
ns_param   Connections       4
ns_param   MaxOpen           1000000000
ns_param   MaxIdle           1000000000
ns_param   DataSource        localhost::test
ns_param   User              web
ns_param   Verbose           Off
ns_param   LogSQLErrors      Off
ns_param   ExtendedTableInfo  On


#
# Stuff for Postgresql
#

ns_section "ns/db/drivers"
ns_param   postgres     ${bindir}/postgres.so
ns_section "ns/db/driver/postgres"
ns_param   datestyle    iso

############################################################
#
# Server-level configuration
#
#  There is only one server in AOLserver, but this is helpful when multiple
#  servers share the same configuration file.  This file assumes that only
#  one server is in use so it is set at the top in the "server" Tcl variable.
#  Other host-specific values are set up above as Tcl variables, too.
#

ns_section "ns/servers"
ns_param   $servername     $serverdesc


#
# Server parameters
#
ns_section "ns/server/${servername}"
ns_param   directoryfile   $directoryfile
ns_param   pageroot        $pageroot
ns_param   globalstats     true      ;# Enable built-in statistics
ns_param   urlstats        true      ;# Enable URL statistics
ns_param   maxurlstats     1000      ;# Max number of URL's to do stats on
ns_param   enabletclpages  true     ;# Parse tcl files in pageroot (dangerous)
# Directory listings -- use an ADP or a Tcl proc to generate them.
#ns_param   directoryadp    $pageroot/dirlist.adp ;# Choose one or the other
#ns_param   directoryproc   _ns_dirlist           ;#  ...but not both!
#ns_param   directorylisting simple               ;# Can be simple or fancy

#
# ADP (AOLserver Dynamic Page) configuration
#
ns_section "ns/server/${servername}/adp"
ns_param   map             "/*.adp"  ;# Extensions to parse as ADP's
#ns_param   map             "/*.html" ;# Any extension can be mapped
ns_param   enableexpire    false     ;# Set "Expires: now" on all ADP's
ns_param   enabledebug     false     ;# Allow Tclpro debugging with "?debug"

# ADP special pages
#ns_param   errorpage      ${pageroot}/errorpage.adp ;# Pretty-print ADP scripting errors


#
# ADP custom parsers -- see adp.c
#
ns_section "ns/server/${servername}/adp/parsers"
ns_param   adp             ".adp"

#
# TCL
#

ns_section "ns/server/${servername}/tcl"
ns_param   Library        /webroot/test/acspg/tcl

#
# Socket driver module (HTTP)  -- nssock
#
ns_section "ns/server/${servername}/module/nssock"
ns_param   port            $httpport
ns_param   hostname        $hostname
ns_param   address         $address


#
# Socket driver module (HTTPS) -- nsssl
#
#  nsssl does not load unless sslkeyfile/sslcertfile exist (above).
#
ns_section "ns/server/${servername}/module/nsssl"
ns_param   port            $httpsport
ns_param   hostname        $hostname
ns_param   address         $address
ns_param   keyfile         $sslkeyfile
ns_param   certfile        $sslcertfile

#
# Control port -- nscp
#
#  nscp does not load unless nscp_user is a valid user.
#
ns_section "ns/server/${servername}/module/nscp"
ns_param   port            9999
ns_param   address         "127.0.0.1" ;# LOCALHOST IS RECOMMENDED

ns_section "ns/server/${servername}/module/nscp/users"
ns_param   user            $nscp_user


#
# Access log -- nslog
#
ns_section "ns/server/${servername}/module/nslog"
ns_param   rolllog         true      ;# Should we roll log?
ns_param   rollonsignal    true      ;# Roll log on SIGHUP
ns_param   rollhour        0         ;# Time to roll log
ns_param   maxbackup       5         ;# Max number to keep around when rolling

#
# CGI interface -- nscgi
#
ns_section "ns/server/${servername}/module/nscgi"
#ns_param   map "GET  /cgi /usr/local/cgi"
#ns_param   map "POST /cgi /usr/local/cgi"


#
# Set up db pools for ACS
#

ns_section "ns/server/${servername}/db"
ns_param   Pools           "*"
ns_param   DefaultPool     "main"

ns_section "ns/parameters"
ns_param   auxconfigdir   /webroot/test/acspg/parameters

#
# Modules to load
#
ns_section "ns/server/${servername}/modules"
ns_param   nssock          ${bindir}/nssock.so
ns_param   nslog           ${bindir}/nslog.so
ns_param   nscgi           ${bindir}/nscgi.so
#ns_param   nsperm         ${bindir}/nsperm.so

## nsssl: loads only if requisite files already exist (see top of this file).
if { [file exists $sslcertfile] && [file exists $sslkeyfile] } {
    ns_param nsssl ${bindir}/nsssle.so
} else {
    ns_log warning "nsd.tcl: nsssl not loaded because key/cert files do not exist."
}

# nscp: loads only if nscp_user is set (see top of this file).
if { $nscp_user != "" } {
    ns_param nscp ${bindir}/nscp.so
} else {
    ns_log warning "nsd.tcl: nscp not loaded because user/password is not set."
}

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