Bug 10733 - Memcached on package installs
Summary: Memcached on package installs
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Packaging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 11167
  Show dependency treegraph
 
Reported: 2013-08-14 19:42 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2014-05-26 21:04 UTC (History)
4 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 10733 - Memcached on package installs (9.51 KB, patch)
2013-08-14 19:56 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Removed some cruft from other tries. (8.49 KB, patch)
2013-08-14 22:09 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 10733: Memcached on package installs (8.00 KB, patch)
2013-08-14 22:29 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 10733: add 'memcached' as suggested dependency (904 bytes, patch)
2013-08-14 22:29 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 10733: Follow-up - use koha-sites.conf (6.68 KB, patch)
2013-08-15 13:23 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 10733: Follow-up - Forgot apache-site.conf.in (1.27 KB, patch)
2013-08-21 21:46 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 10733: Memcached on package installs (12.77 KB, patch)
2013-09-11 23:30 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 10733: Memcached on package installs (13.11 KB, patch)
2013-09-12 18:16 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 10733: Follow up - unset variables from koha-sites.conf if USE_MEMCACHED=no (1.01 KB, patch)
2013-09-13 13:17 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
[SIGNED OFF] Bug 10733: add 'memcached' as suggested dependency (974 bytes, patch)
2013-09-14 01:29 UTC, Mark Tompsett
Details | Diff | Splinter Review
[SIGNED OFF] Bug 10733: Memcached on package installs (13.18 KB, patch)
2013-09-14 01:30 UTC, Mark Tompsett
Details | Diff | Splinter Review
[SIGNED OFF] Bug 10733: Follow up - unset variables from koha-sites.conf if USE_MEMCACHED=no (998 bytes, patch)
2013-09-14 01:30 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 10733: add 'memcached' as suggested dependency (1007 bytes, patch)
2013-09-30 02:17 UTC, Robin Sheat
Details | Diff | Splinter Review
Bug 10733: Memcached on package installs (13.22 KB, patch)
2013-09-30 02:17 UTC, Robin Sheat
Details | Diff | Splinter Review
Bug 10733: Follow up - unset variables from koha-sites.conf if USE_MEMCACHED=no (1.01 KB, patch)
2013-09-30 02:17 UTC, Robin Sheat
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2013-08-14 19:42:47 UTC
We should provide a proper way of configuring the use of memcached on packages setups.
Comment 1 Tomás Cohen Arazi (tcohen) 2013-08-14 19:56:12 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi (tcohen) 2013-08-14 22:09:49 UTC Comment hidden (obsolete)
Comment 3 Tomás Cohen Arazi (tcohen) 2013-08-14 22:29:37 UTC Comment hidden (obsolete)
Comment 4 Tomás Cohen Arazi (tcohen) 2013-08-14 22:29:49 UTC Comment hidden (obsolete)
Comment 5 Robin Sheat 2013-08-15 06:47:27 UTC
I wonder if it should also listen to koha-sites for its default.
Comment 6 Tomás Cohen Arazi (tcohen) 2013-08-15 12:31:36 UTC
(In reply to Robin Sheat from comment #5)
> I wonder if it should also listen to koha-sites for its default.

It does Robin. But it is not advertised. Maybe I should change MEMCACHED_NAMESPACE for MEMCACHED_PREFFIX.
Comment 7 Tomás Cohen Arazi (tcohen) 2013-08-15 13:23:25 UTC Comment hidden (obsolete)
Comment 8 Tomás Cohen Arazi (tcohen) 2013-08-21 21:46:26 UTC Comment hidden (obsolete)
Comment 9 Tomás Cohen Arazi (tcohen) 2013-09-11 23:30:43 UTC Comment hidden (obsolete)
Comment 10 Tomás Cohen Arazi (tcohen) 2013-09-11 23:32:29 UTC
Please note I forgot to fix the commit message and --memcached-namespace is no longer the option switch but --memcached-prefix.
Comment 11 Mark Tompsett 2013-09-12 01:22:43 UTC
Perhaps some QA people might be able to comment on the parsing or lack of parsing for the --memcached-servers parameter.

    SetEnv MEMCACHED_SERVERS "machinea:9671111"

Does that make sense?! BTW, 967-1111 is Pizza pizza's phone number (www.pizzapizza.ca). ;) Should the string be parsed and validated?

Now to re-test this squashed version.
Comment 12 Mark Tompsett 2013-09-12 03:40:28 UTC
Test cases 2, 4, and 6 all result in blank results, though that may not be expected. After brief discussions on the IRC channel (http://irc.koha-community.org/koha/2013-09-12#i_1382768), I think adding an error message and failing is probably best. As such, I've held off on signing. Hope this feedback is helpful. :)

sudo koha-create --create-db memctest0
sudo grep -i memcache /etc/apache2/sites-available/memctest0
sudo grep -i memcache /etc/koha/sites/memctest0/koha-conf.xml
RESULTS: Blank as expected

sudo koha-create --create-db memctest1 --use-memcached
sudo grep -i memcache /etc/apache2/sites-available/memctest1
sudo grep -i memcache /etc/koha/sites/memctest1/koha-conf.xml
RESULTS: 127.0.0.1:11211 used for server, namespace is koha_memctest1
         All as expected

sudo koha-create --create-db memctest2 --memcached-servers "machinea:911"
sudo grep -i memcache /etc/apache2/sites-available/memctest2
sudo grep -i memcache /etc/koha/sites/memctest2/koha-conf.xml
RESULTS: All blank. I'm not sure what to expect, since the --memcached-servers implies --use-memcached. I was thinking an error message say missing parameter --use-memcached?

sudo koha-create --create-db memctest3 --use-memcached --memcached-servers "machinea:911"
sudo grep -i memcache /etc/apache2/sites-available/memctest3
sudo grep -i memcache /etc/koha/sites/memctest3/koha-conf.xml
RESULTS: machinea:911 used for server, namespace is koha_memctest4
         All as expected.

sudo koha-create --create-db memctest4 --memcached-prefix "test_"
sudo grep -i memcache /etc/apache2/sites-available/memctest4
sudo grep -i memcache /etc/koha/sites/memctest4/koha-conf.xml
RESULTS: All blank. I'm not sure what to expect, since the --memcached-prefix implies --use-memcached. I was thinking an error message say missing parameter --use-memcached?

sudo koha-create --create-db memctest5 --use-memcached --memcached-prefix "test_"
sudo grep -i memcache /etc/apache2/sites-available/memctest5
sudo grep -i memcache /etc/koha/sites/memctest5/koha-conf.xml
RESULTS: 127.0.0.1:11211 used for server, namespace is test_memctest5
         All as expected

sudo koha-create --create-db memctest6 --memcached-servers "machinea:911" --memcached-prefix "test_"
sudo grep -i memcache /etc/apache2/sites-available/memctest6
sudo grep -i memcache /etc/koha/sites/memctest6/koha-conf.xml
RESULTS: All blank. I'm not sure what to expect, since the parameters both imply --use-memcached. I was thinking an error message say missing parameter --use-memcached?

sudo koha-create --create-db memctest7 --use-memcached --memcached-servers "machinea:911" --memcached-prefix "test_"
sudo grep -i memcache /etc/apache2/sites-available/memctest7
sudo grep -i memcache /etc/koha/sites/memctest7/koha-conf.xml
RESULTS: machinea:911 used for server, namespace is test_memctest7
         All as expected
Comment 13 Tomás Cohen Arazi (tcohen) 2013-09-12 18:16:16 UTC Comment hidden (obsolete)
Comment 14 Tomás Cohen Arazi (tcohen) 2013-09-13 13:17:26 UTC Comment hidden (obsolete)
Comment 15 Mark Tompsett 2013-09-13 13:41:24 UTC
I generated a generic koha-sites.conf:
DOMAIN=".myDNSname.org"  # Change this to be your domain.
INTRAPORT="80"
INTRAPREFIX=""
INTRASUFFIX="-intra"
DEFAULTSQL=""
OPACPORT="80"
OPACPREFIX=""
OPACSUFFIX=""
ZEBRA_MARC_FORMAT="marc21"
ZEBRA_LANGUAGE="en"
# Create 0-7 based on this binary scheme. Similar to command-line cases.
USE_MEMCACHED="no"    # no=0, yes=1
MEMCACHED_SERVERS=""  # ""=0, "machinea:911"=1
MEMCACHED_PREFIX=""   # ""=0, "test_"=1


My test cases that I started with, but haven't had a chance to restart:
sudo cp /etc/koha/koha-sites.conf_0 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest0
sudo grep -i memcache /etc/apache2/sites-available/memctest0
sudo grep -i memcache /etc/koha/sites/memctest0/koha-conf.xml

sudo cp /etc/koha/koha-sites.conf_1 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest1
sudo grep -i memcache /etc/apache2/sites-available/memctest1
sudo grep -i memcache /etc/koha/sites/memctest1/koha-conf.xml

sudo cp /etc/koha/koha-sites.conf_2 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest2
sudo grep -i memcache /etc/apache2/sites-available/memctest2
sudo grep -i memcache /etc/koha/sites/memctest2/koha-conf.xml

sudo cp /etc/koha/koha-sites.conf_3 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest3
sudo grep -i memcache /etc/apache2/sites-available/memctest3
sudo grep -i memcache /etc/koha/sites/memctest3/koha-conf.xml

sudo cp /etc/koha/koha-sites.conf_4 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest4
sudo grep -i memcache /etc/apache2/sites-available/memctest4
sudo grep -i memcache /etc/koha/sites/memctest4/koha-conf.xml

sudo cp /etc/koha/koha-sites.conf_5 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest5
sudo grep -i memcache /etc/apache2/sites-available/memctest5
sudo grep -i memcache /etc/koha/sites/memctest5/koha-conf.xml

sudo cp /etc/koha/koha-sites.conf_6 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest6
sudo grep -i memcache /etc/apache2/sites-available/memctest6
sudo grep -i memcache /etc/koha/sites/memctest6/koha-conf.xml

sudo cp /etc/koha/koha-sites.conf_7 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest7
sudo grep -i memcache /etc/apache2/sites-available/memctest7
sudo grep -i memcache /etc/koha/sites/memctest7/koha-conf.xml

I hope to see the command-line test cases 2, 4, and 6 behave similarly to the koha-sites.conf versions.
Comment 16 Mark Tompsett 2013-09-13 20:32:12 UTC
sudo rm /etc/koha/koha-site.conf

sudo koha-create --create-db memctest0
sudo grep -i memcache /etc/apache2/sites-available/memctest0
sudo grep -i memcache /etc/koha/sites/memctest0/koha-conf.xml
RESULTS: Blank as expected

sudo koha-create --create-db memctest1 --use-memcached
sudo grep -i memcache /etc/apache2/sites-available/memctest1
sudo grep -i memcache /etc/koha/sites/memctest1/koha-conf.xml
RESULTS: 127.0.0.1:11211 used for server, namespace is koha_memctest1
         All as expected

sudo koha-create --create-db memctest2 --memcached-servers "machinea:911"
sudo grep -i memcache /etc/apache2/sites-available/memctest2
sudo grep -i memcache /etc/koha/sites/memctest2/koha-conf.xml
RESULTS: Nothing generated. Error message given. All as expected.

sudo koha-create --create-db memctest3 --use-memcached --memcached-servers "machinea:911"
sudo grep -i memcache /etc/apache2/sites-available/memctest3
sudo grep -i memcache /etc/koha/sites/memctest3/koha-conf.xml
RESULTS: machinea:911 used for server, namespace is koha_memctest3
         All as expected.

sudo koha-create --create-db memctest4 --memcached-prefix "test_"
sudo grep -i memcache /etc/apache2/sites-available/memctest4
sudo grep -i memcache /etc/koha/sites/memctest4/koha-conf.xml
RESULTS: Nothing generated. Error message given. All as expected.

sudo koha-create --create-db memctest5 --use-memcached --memcached-prefix "test_"
sudo grep -i memcache /etc/apache2/sites-available/memctest5
sudo grep -i memcache /etc/koha/sites/memctest5/koha-conf.xml
RESULTS: 127.0.0.1:11211 used for server, namespace is test_memctest5
         All as expected

sudo koha-create --create-db memctest6 --memcached-servers "machinea:911" --memcached-prefix "test_"
sudo grep -i memcache /etc/apache2/sites-available/memctest6
sudo grep -i memcache /etc/koha/sites/memctest6/koha-conf.xml
RESULTS: Nothing generated. Error message given. All as expected.

sudo koha-create --create-db memctest7 --use-memcached --memcached-servers "machinea:911" --memcached-prefix "test_"
sudo grep -i memcache /etc/apache2/sites-available/memctest7
sudo grep -i memcache /etc/koha/sites/memctest7/koha-conf.xml
RESULTS: machinea:911 used for server, namespace is test_memctest7
         All as expected

sudo koha-remove `koha-list`

Here is what I put in my test koha-site.conf files:
sudo vi /etc/koha/koha-sites.conf_7
DOMAIN=".mydnsname.org"
OPACPORT="80"
OPACSUFFIX=""
OPACPREFIX=""
INTRAPORT="80"
INTRASUFFIX="-intra"
INTRAPREFIX=""
ZEBRA_MARC_FORMAT="marc21"
ZEBRA_LANGUAGE="en"
USE_MEMCACHED="yes"
MEMCACHED_SERVERS="machinea:911"
MEMCACHED_PREFIX="test_"

sudo vi /etc/koha/koha-sites.conf_6
DOMAIN=".mydnsname.org"
OPACPORT="80"
OPACSUFFIX=""
OPACPREFIX=""
INTRAPORT="80"
INTRASUFFIX="-intra"
INTRAPREFIX=""
ZEBRA_MARC_FORMAT="marc21"
ZEBRA_LANGUAGE="en"
USE_MEMCACHED="no"
MEMCACHED_SERVERS="machinea:911"
MEMCACHED_PREFIX="test_"

sudo vi /etc/koha/koha-sites.conf_5
DOMAIN=".mydnsname.org"
OPACPORT="80"
OPACSUFFIX=""
OPACPREFIX=""
INTRAPORT="80"
INTRASUFFIX="-intra"
INTRAPREFIX=""
ZEBRA_MARC_FORMAT="marc21"
ZEBRA_LANGUAGE="en"
USE_MEMCACHED="yes"
MEMCACHED_SERVERS=""
MEMCACHED_PREFIX="test_"

sudo vi /etc/koha/koha-sites.conf_4
DOMAIN=".mydnsname.org"
OPACPORT="80"
OPACSUFFIX=""
OPACPREFIX=""
INTRAPORT="80"
INTRASUFFIX="-intra"
INTRAPREFIX=""
ZEBRA_MARC_FORMAT="marc21"
ZEBRA_LANGUAGE="en"
USE_MEMCACHED="no"
MEMCACHED_SERVERS=""
MEMCACHED_PREFIX="test_"

sudo vi /etc/koha/koha-sites.conf_3
DOMAIN=".mydnsname.org"
OPACPORT="80"
OPACSUFFIX=""
OPACPREFIX=""
INTRAPORT="80"
INTRASUFFIX="-intra"
INTRAPREFIX=""
ZEBRA_MARC_FORMAT="marc21"
ZEBRA_LANGUAGE="en"
USE_MEMCACHED="yes"
MEMCACHED_SERVERS="machinea:911"
MEMCACHED_PREFIX=""

sudo vi /etc/koha/koha-sites.conf_2
DOMAIN=".mydnsname.org"
OPACPORT="80"
OPACSUFFIX=""
OPACPREFIX=""
INTRAPORT="80"
INTRASUFFIX="-intra"
INTRAPREFIX=""
ZEBRA_MARC_FORMAT="marc21"
ZEBRA_LANGUAGE="en"
USE_MEMCACHED="no"
MEMCACHED_SERVERS="machinea:911"
MEMCACHED_PREFIX=""

sudo vi /etc/koha/koha-sites.conf_1
DOMAIN=".mydnsname.org"
OPACPORT="80"
OPACSUFFIX=""
OPACPREFIX=""
INTRAPORT="80"
INTRASUFFIX="-intra"
INTRAPREFIX=""
ZEBRA_MARC_FORMAT="marc21"
ZEBRA_LANGUAGE="en"
USE_MEMCACHED="yes"
MEMCACHED_SERVERS=""
MEMCACHED_PREFIX=""

sudo vi /etc/koha/koha-sites.conf_0
DOMAIN=".mydnsname.org"
OPACPORT="80"
OPACSUFFIX=""
OPACPREFIX=""
INTRAPORT="80"
INTRASUFFIX="-intra"
INTRAPREFIX=""
ZEBRA_MARC_FORMAT="marc21"
ZEBRA_LANGUAGE="en"
USE_MEMCACHED="no"
MEMCACHED_SERVERS=""
MEMCACHED_PREFIX=""

sudo cp /etc/koha/koha-sites.conf_0 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest0
sudo grep -i memcache /etc/apache2/sites-available/memctest0
sudo grep -i memcache /etc/koha/sites/memctest0/koha-conf.xml
RESULTS: Blank as expected

sudo cp /etc/koha/koha-sites.conf_1 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest1
sudo grep -i memcache /etc/apache2/sites-available/memctest1
sudo grep -i memcache /etc/koha/sites/memctest1/koha-conf.xml
RESULTS: 127.0.0.1:11211 used for server, namespace is koha_memctest1
         All as expected

sudo cp /etc/koha/koha-sites.conf_2 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest2
sudo grep -i memcache /etc/apache2/sites-available/memctest2
sudo grep -i memcache /etc/koha/sites/memctest2/koha-conf.xml
RESULTS: Blank. Perhaps some sort of warning is in order?

sudo cp /etc/koha/koha-sites.conf_3 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest3
sudo grep -i memcache /etc/apache2/sites-available/memctest3
sudo grep -i memcache /etc/koha/sites/memctest3/koha-conf.xml
RESULTS: machinea:911 used for server, namespace is koha_memctest3
         All as expected.

sudo cp /etc/koha/koha-sites.conf_4 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest4
sudo grep -i memcache /etc/apache2/sites-available/memctest4
sudo grep -i memcache /etc/koha/sites/memctest4/koha-conf.xml
RESULTS: Blank. Perhaps some sort of warning is in order?

sudo cp /etc/koha/koha-sites.conf_5 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest5
sudo grep -i memcache /etc/apache2/sites-available/memctest5
sudo grep -i memcache /etc/koha/sites/memctest5/koha-conf.xml
RESULTS: 127.0.0.1:11211 used for server, namespace is test_memctest5
         All as expected

sudo cp /etc/koha/koha-sites.conf_6 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest6
sudo grep -i memcache /etc/apache2/sites-available/memctest6
sudo grep -i memcache /etc/koha/sites/memctest6/koha-conf.xml
RESULTS: Blank. Perhaps some sort of warning is in order?

sudo cp /etc/koha/koha-sites.conf_7 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest7
sudo grep -i memcache /etc/apache2/sites-available/memctest7
sudo grep -i memcache /etc/koha/sites/memctest7/koha-conf.xml
RESULTS: machinea:911 used for server, namespace is test_memctest7
         All as expected.

sudo cp /etc/koha/koha-sites.conf_7 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest8 --memcached-servers "skynet:2025" --memcached-prefix "override1_"
sudo grep -i memcache /etc/apache2/sites-available/memctest8
sudo grep -i memcache /etc/koha/sites/memctest8/koha-conf.xml
RESULTS: skynet:2025 used for server, namespace is override1_memctest8
         All as expected.

sudo cp /etc/koha/koha-sites.conf_6 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest9 --use-memcached
sudo grep -i memcache /etc/apache2/sites-available/memctest9
sudo grep -i memcache /etc/koha/sites/memctest9/koha-conf.xml
RESULTS: machinea:911 used for server, namespace is test_memctest9
         All as expected. Cool mixture to get it to work.

sudo cp /etc/koha/koha-sites.conf_2 /etc/koha/koha-sites.conf
sudo koha-create --create-db memctest10 --memcached-servers "skynet:2025" --memcached-prefix "override_"
sudo grep -i memcache /etc/apache2/sites-available/memctest10
sudo grep -i memcache /etc/koha/sites/memctest10/koha-conf.xml
RESULTS: Nothing generated. Error message given. All as expected.

man koha-create
RESULTS: All as expected.

koha-create --help
RESULTS: All as expected.

As far as I can tell everything is okay. Though, the blank without warning (koha-sites.conf) vs. error (command-line) discrepancy bothers me. The latter makes sense to me. The former is asking for confusion as to why something isn't working. However, I'll leave that issue as a QA issue to discuss.

Now to figure out how to sign these off.
Comment 17 Mark Tompsett 2013-09-14 01:29:42 UTC Comment hidden (obsolete)
Comment 18 Mark Tompsett 2013-09-14 01:30:09 UTC Comment hidden (obsolete)
Comment 19 Mark Tompsett 2013-09-14 01:30:24 UTC Comment hidden (obsolete)
Comment 20 Mark Tompsett 2013-09-14 01:32:21 UTC
Hopefully I did the sign off correctly. This is my first time ever.
Comment 21 Robin Sheat 2013-09-30 02:17:17 UTC
Created attachment 21617 [details] [review]
Bug 10733: add 'memcached' as suggested dependency

Adds 'memcached' to the control.in file so the user is suggested by apt
to install it.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Comment 22 Robin Sheat 2013-09-30 02:17:21 UTC
Created attachment 21618 [details] [review]
Bug 10733: Memcached on package installs

This patch makes the koha-create script adjust the koha-conf.xml file
with the proper string substitutions to enable the use of memcached
for the created Koha instance.

It adds three option switches that control this:

 --use-memcached (defaults to "no")
 --memcached-servers "host1:port1,..." (defaults to '127.0.0.1:11211')
 --memcached-prefix "desired_namespace prefix" (defaults to 'koha_')

It respects the current schema configuration schema, where configuration values are
pondered like this:

hardcoded < koha-sites.conf < koha-create option switches

koha-sites.conf is read for USE_MEMCACHED, MEMCACHED_SERVERS and MEMCACHED_PREFIX.

Note: the docs discourage setting user's own namespace prefix.

Using memcached is off as the default. The relevant configuration variables will remain empty
if the user doesn't pass --use-memcached to the command. It matches the current behaviour.

To test:
- Apply the patch
- Build your own packages and install them on a test server
a) Create a new instance without using the new switches like:
 $ koha-create --create-db memctest
 - Check that /etc/koha/sites/memctest/koha-conf.xml contains:
   * Empty <memcached_servers> tag.
   * Empty <memcached_namespace> tag.

b) Play with the possible combination of option switches
(Note that the code defaults to empty and will remain like that if --use-memcached is not
used, so less tests...)

 $ koha-create --create-db --use-memcached memctest
 $ koha-create --create-db --use-memcached --memcached-servers "anything:xxx" memctest
 $ koha-create --create-db --use-memcached --memcached-servers "anything:xxx" --memcached-prefix "something" memctest
 $ koha-create --create-db --use-memcached --memcached-prefix "something" memctest

 - Check the koha-conf.xml and /etc/apache2/sites-enabled/memctest file reflect the chosen options.

c) Run
 $ koha-create --help
 - It should advertise this addition accordingly.

d) Run
 $ man koha-create
 - Man page for koha-create should provide good information on the new switches behaviour

Enjoy
To+

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Comment 23 Robin Sheat 2013-09-30 02:17:25 UTC
Created attachment 21619 [details] [review]
Bug 10733: Follow up - unset variables from koha-sites.conf if USE_MEMCACHED=no

As configuration variables from koha-sites.conf overwrite the ones in the
koha-create script we need to unset them in case we have USE_MEMCACHED="no".

Regards
To+

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Comment 24 Robin Sheat 2013-09-30 02:20:24 UTC
These look fine to me. One suggestion might be having a default prefix relating to the instance name, as this will reduce the chance of a collision a lot.
Comment 25 Galen Charlton 2013-10-30 03:31:04 UTC
Pushed to master.  Thanks, Tomás!
Comment 26 Magnus Enger 2013-10-30 11:16:17 UTC
Attachment 21618 [details] adds MEMCACHED placeholders both to debian/templates/apache-site.conf.in and debian/templates/koha-conf-site.xml.in. The former is correct, the latter is obsolete. 

I propose to remove the unnecessary memcached config lines from debian/templates/koha-conf-site.xml.in on bug 11167.