Item14754: Extension installer dies without a working LocalSite.cfg
Priority: Normal
Current State: Confirmed
Released In: n/a
Target Release: n/a
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 extension.pl 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 https://github.com/foswiki/distro/releases/download/FoswikiRelease02x01x06/Foswiki-2.1.6.tgz
--2018-08-30 10:01:08-- https://github.com/foswiki/distro/releases/download/FoswikiRelease02x01x06/Foswiki-2.1.6.tgz
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/23052818/6a0a1414-1df7-11e8-9e95-ae065731fa15?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20180830%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180830T065809Z&X-Amz-Expires=300&X-Amz-Signature=144bd6e1e5347727e5940336a3b70018d86a47100162af5fdae4cc77ecd61729&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DFoswiki-2.1.6.tgz&response-content-type=application%2Foctet-stream [following]
--2018-08-30 10:01:09-- https://github-production-release-asset-2e65be.s3.amazonaws.com/23052818/6a0a1414-1df7-11e8-9e95-ae065731fa15?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20180830%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180830T065809Z&X-Amz-Expires=300&X-Amz-Signature=144bd6e1e5347727e5940336a3b70018d86a47100162af5fdae4cc77ecd61729&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DFoswiki-2.1.6.tgz&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.20.115
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.20.115|: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
/opt/foswiki
[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/extender.pl
There was a compile error: Undefined subroutine &Foswiki::Extender::_stop called at /opt/foswiki/tools/extender.pl 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}='http://wiki.mysite.com'
-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}='JoeAdmin@mysite.com'
# 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}='user@yoursite.com' -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