You are here: Foswiki>Tasks Web>Item14754 (24 Sep 2018, GeorgeClark)Edit Attach

Item14754: Extension installer dies without a working LocalSite.cfg

Priority: Normal
Current State: Confirmed
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: Configure, FoswikiUsability
Reported By: PeterAndrasSiklosi
Waiting For:
Last Change By: GeorgeClark
I tried to create a script to automate the deployment of a single Foswiki application.

In the steps I tried to install an Extension before generating the LocalSite.cfg. This resulted the error below. Although I clearly missed a step, the _stop function also vanished from without a trace.

During the change of Item13391 the function declaration was removed but not all instance of its use removed.

[root@centos7 opt]# ls
[root@centos7 opt]# wget
--2018-08-30 10:01:08--
Resolving (,
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: [following]
--2018-08-30 10:01:09--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16528667 (16M) [application/octet-stream]
Saving to: ‘Foswiki-2.1.6.tgz’

100%[====================================================================================================================================================>] 16,528,667   755KB/s   in 22s

2018-08-30 10:01:32 (720 KB/s) - ‘Foswiki-2.1.6.tgz’ saved [16528667/16528667]

[root@centos7 opt]# tar xfz Foswiki-2.1.6.tgz
[root@centos7 opt]# ls
Foswiki-2.1.6  Foswiki-2.1.6.tgz
[root@centos7 opt]# mv Foswiki-2.1.6 foswiki
[root@centos7 opt]# cd foswiki/
[root@centos7 foswiki]# pwd
[root@centos7 foswiki]# tools/extension_installer AutoViewTemplatePlugin -r --enable install
Subroutine ask redefined at (eval 1) line 92.
Subroutine usage redefined at (eval 1) line 108.
Subroutine install redefined at (eval 1) line 179.
Could not load /opt/foswiki/tools/
There was a compile error: Undefined subroutine &Foswiki::Extender::_stop called at /opt/foswiki/tools/ line 66.

Error when trying to eval the file content: Undefined subroutine &Foswiki::Extender::_stop called at (eval 1) line 66.

[root@centos7 foswiki]# grep -r 'sub _stop' .
[root@centos7 foswiki]#

-- PeterAndrasSiklosi - 30 Aug 2018

The recommended way to do a scripted deployment it by using the tools/configure CLI utility to build the configuration. My autodeployment script looks like:
# Build the initial LocalSite.cfg (Sets all defaults and file system paths)
tools/configure -save -noprompt         
# The rest of these could all be done on one command They are separated out and whitespace added for clarity
# Set admin password, and also restrict configure to a user.                                                                                                                                             
tools/configure -save -set {Password}='somesecretpassword' 
   -set {FeatureAccess}{Configure}='JoeUser' 

# Set the web paths, including short URLs
tools/configure -save -set {DefaultUrlHost}='' 
   -set {PubUrlPath}='/pub' 
   -set {ScriptUrlPath}='/bin' 
   -set {ScriptUrlPaths}{view}='' 

# Configure email  Assumes underlying system is *nix and has sendmail or equivalent available 
-set {Email}{MailMethod}='MailProgram' -set {EnableEmail}=1 
   -set {WebMasterEmail}=''            
# Configure the page cache
tools/configure -save -set {Cache}{DBI}{MySQL}{Database}='foswiki_db' 
   -set {Cache}{DBI}{MySQL}{Password}='mysqlpassword' 
   -set {Cache}{DBI}{MySQL}{Username}='foswiki' 
   -set {Cache}{Implementation}='Foswiki::PageCache::DBI::MySQL'             

# Set a restricted path 
tools/configure -save -set {SafeEnvPath}='/bin:/usr/bin'

# Check the configuration and report any issues, or file permission errors/warnings
tools/configure -check
tools/configure -check {DataDir} -method validate_permissions
tools/configure -check {PubDir} -method validate_permissions

-- GeorgeClark - 31 Aug 2018

If you want to run a wizard to autodetect and configure email, this could be used. It will probe the server and figure out the right port & protocol to use to send email.
tools/configure -set {WebMasterEmail}='' -set {SMTP}{MAILHOST}='your.smtp.server' -set {SMTP}{Username}='smtpuser' -set {SMTP}{Password}='smtppassword' -wizard AutoConfigureEmail -method autoconfigure

And be sure all of the above all run as the web server user, so that proper ownership of logs, etc are maintained.

-- GeorgeClark - 31 Aug 2018

GeorgeClark, Thank you for your suggestions. I am definitely going to use them.

-- PeterAndrasSiklosi - 24 Sep 2018

Regarding the original task, the extension installer will attempt to "check in" topics into the store, so the installer cannot run unless the store and paths are configured. So for fixing this bug, it probably should still die, but with a meaningful error message that a configuration is required. No need for stack dumps, etc. Setting this task to confirmed.

One thing I omitted in my script demo is I do not set the Store type, so on a pristine install, this will default to the PlainFileStore. So be sure that's what you want or add the -set statements for the {Store}{Implementation}.

-- GeorgeClark - 24 Sep 2018

ItemTemplate edit

Summary Extension installer dies without a working LocalSite.cfg
ReportedBy PeterAndrasSiklosi
Codebase 2.1.6, 2.1.5
SVN Range
AppliesTo Engine
Component Configure, FoswikiUsability
Priority Normal
CurrentState Confirmed
TargetRelease n/a
ReleasedIn n/a
Topic revision: r4 - 24 Sep 2018, GeorgeClark - This page was cached on 24 Jan 2021 - 23:08.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy