Commit 96fc5141 authored by Romain Courteaud's avatar Romain Courteaud

Install sphinx

parent d50c6b8e
...@@ -81,6 +81,7 @@ setup(name=name, ...@@ -81,6 +81,7 @@ setup(name=name,
'siptester = slapos.recipe.siptester:SipTesterRecipe', 'siptester = slapos.recipe.siptester:SipTesterRecipe',
'simplelogger = slapos.recipe.simplelogger:Recipe', 'simplelogger = slapos.recipe.simplelogger:Recipe',
'slaprunner = slapos.recipe.slaprunner:Recipe', 'slaprunner = slapos.recipe.slaprunner:Recipe',
'sphinx= slapos.recipe.sphinx:Recipe',
'stunnel = slapos.recipe.stunnel:Recipe', 'stunnel = slapos.recipe.stunnel:Recipe',
'testnode = slapos.recipe.testnode:Recipe', 'testnode = slapos.recipe.testnode:Recipe',
'vifib = slapos.recipe.vifib:Recipe', 'vifib = slapos.recipe.vifib:Recipe',
......
...@@ -103,33 +103,9 @@ class Recipe(BaseSlapRecipe): ...@@ -103,33 +103,9 @@ class Recipe(BaseSlapRecipe):
)) ))
if key_access is not None: if key_access is not None:
connection_dict['key_access'] = key_access connection_dict['key_access'] = key_access
if self.options.get('fulltext_search', None) == 'sphinx':
sphinx_searchd = self.installSphinxSearchd(ip=self.getLocalIPv4Address())
connection_dict.update(**sphinx_searchd)
self.setConnectionDict(connection_dict) self.setConnectionDict(connection_dict)
return self.path_list return self.path_list
def installSphinxSearchd(self, ip, port=9312, sql_port=9306):
data_directory = self.createDataDirectory('sphinx')
sphinx_conf_path = self.createConfigurationFile('sphinx.conf',
self.substituteTemplate(self.getTemplateFilename('sphinx.conf.in'), dict(
ip_address=ip,
port=port,
sql_port=sql_port,
data_directory=data_directory,
log_directory=self.log_directory,
)))
self.path_list.append(sphinx_conf_path)
wrapper = zc.buildout.easy_install.scripts([('sphinx_searchd',
'slapos.recipe.librecipe.execute', 'execute')], self.ws, sys.executable,
self.wrapper_directory, arguments=[
self.options['sphinx_searchd_binary'].strip(), '-c', sphinx_conf_path, '--nodetach']
)[0]
self.path_list.append(wrapper)
return dict(sphinx_searchd_ip=ip,
sphinx_searchd_port=port,
sphinx_searchd_sql_port=sql_port)
def installFrontendZopeApache(self, ip, port, name, frontend_path, backend_url, def installFrontendZopeApache(self, ip, port, name, frontend_path, backend_url,
backend_path, key, certificate, access_control_string=None): backend_path, key, certificate, access_control_string=None):
ident = 'frontend_' + name ident = 'frontend_' + name
......
##############################################################################
#
# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe):
def install(self):
# Configuration file
config = dict(
data_directory=self.options['data-directory'],
ip_address=self.options['ip'],
port=self.options['sphinx-port'],
sql_port=self.options['sql-port'],
searchd_log=self.options['searchd-log'],
query_log=self.options['query-log'],
pid=self.options['pid'],
)
sphinx_conf_path = self.createFile(
self.options['configuration-file'],
self.substituteTemplate(self.getTemplateFilename('sphinx.conf.in'),
config)
)
# Create init script
wrapper = self.createPythonScript(
self.options['wrapper'],
'slapos.recipe.librecipe.execute.executee',
[self.options['sphinx-searchd-binary'].strip(), '-c',
sphinx_conf_path, '--nodetach'],
)
return [wrapper, sphinx_conf_path]
...@@ -389,7 +389,7 @@ index erp5 ...@@ -389,7 +389,7 @@ index erp5
# #
# ondisk_dict = 1 # ondisk_dict = 1
# whether to enable in-place inversion (2x less disk, 90-95% speed) # whether to enable in-place inversion (2x less disk, 90-95%% speed)
# optional, default is 0 (use separate temporary files), indexer-only # optional, default is 0 (use separate temporary files), indexer-only
# #
# inplace_enable = 1 # inplace_enable = 1
...@@ -460,11 +460,11 @@ searchd ...@@ -460,11 +460,11 @@ searchd
# log file, searchd run info is logged here # log file, searchd run info is logged here
# optional, default is 'searchd.log' # optional, default is 'searchd.log'
log = %(log_directory)s/sphinx-searchd.log log = %(searchd_log)s
# query log file, all search queries are logged here # query log file, all search queries are logged here
# optional, default is empty (do not log queries) # optional, default is empty (do not log queries)
query_log = %(log_directory)s/sphinx-query.log query_log = %(query_log)s
# client read timeout, seconds # client read timeout, seconds
# optional, default is 5 # optional, default is 5
...@@ -480,7 +480,7 @@ searchd ...@@ -480,7 +480,7 @@ searchd
# PID file, searchd process ID file name # PID file, searchd process ID file name
# mandatory # mandatory
pid_file = %(data_directory)s/sphinx-searchd.pid pid_file = %(pid)s
# max amount of matches the daemon ever keeps in RAM, per-index # max amount of matches the daemon ever keeps in RAM, per-index
# WARNING, THERE'S ALSO PER-QUERY LIMIT, SEE SetLimits() API CALL # WARNING, THERE'S ALSO PER-QUERY LIMIT, SEE SetLimits() API CALL
...@@ -524,7 +524,7 @@ searchd ...@@ -524,7 +524,7 @@ searchd
# searchd will (try to) log crashed query to 'crash_log_path.PID' file # searchd will (try to) log crashed query to 'crash_log_path.PID' file
# optional, default is empty (do not create crash logs) # optional, default is empty (do not create crash logs)
# #
# crash_log_path = %(log_directory)s # crash_log_path = (log_directory)
# max allowed per-query filter count # max allowed per-query filter count
# optional, default is 256 # optional, default is 256
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
parts = parts =
request-mariadb request-mariadb
request-sphinx
request-cloudooo request-cloudooo
request-memcached request-memcached
request-kumofs request-kumofs
...@@ -29,6 +30,11 @@ cert-file = $${slap-connection:cert-file} ...@@ -29,6 +30,11 @@ cert-file = $${slap-connection:cert-file}
computer-id = $${slap-connection:computer-id} computer-id = $${slap-connection:computer-id}
partition-id = $${slap-connection:partition-id} partition-id = $${slap-connection:partition-id}
[request-sphinx]
<=request-common
name = Sphinx Search Engine
software-type = sphinx
[request-mariadb] [request-mariadb]
<=request-common <=request-common
name = MariaDB DataBase name = MariaDB DataBase
......
[buildout]
parts =
sphinxd-instance
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[sphinxd-instance]
recipe = slapos.cookbook:sphinx
data-directory = $${directory:sphinx-data}
configuration-file = $${rootdirectory:etc}/sphinx.conf
searchd-log = $${basedirectory:log}/sphinx-searchd.log
query-log = $${basedirectory:log}/sphinx-query.log
pid = $${basedirectory:run}/sphinx-searchd.pid
ip = $${slap-network-information:local-ipv4}
sphinx-port = 9312
sql-port = 9306
wrapper = $${basedirectory:services}/sphinxd
sphinx-searchd-binary = ${sphinx:location}/bin/searchd
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
var = $${buildout:directory}/var
srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin
[basedirectory]
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log
services = $${rootdirectory:etc}/run
run = $${rootdirectory:var}/run
[directory]
recipe = slapos.cookbook:mkdirectory
sphinx-data = $${rootdirectory:srv}/sphinx
[instance] [instance]
rdiff_backup_binary = ${buildout:bin-directory}/rdiff-backup rdiff_backup_binary = ${buildout:bin-directory}/rdiff-backup
sphinx_searchd_binary = ${sphinx:location}/bin/searchd
[buildout] [buildout]
...@@ -27,6 +26,7 @@ memcached = ${template-memcached:output} ...@@ -27,6 +26,7 @@ memcached = ${template-memcached:output}
cloudooo = ${template-cloudooo:output} cloudooo = ${template-cloudooo:output}
zope = ${template-zope:output} zope = ${template-zope:output}
mariadb = ${template-mariadb:output} mariadb = ${template-mariadb:output}
sphinx = ${template-sphinx:output}
tidstorage = $${dynamic-template-tidstorage:output} tidstorage = $${dynamic-template-tidstorage:output}
[slap-connection] [slap-connection]
......
...@@ -22,6 +22,13 @@ md5sum = 726888330d63150bedf37a8cfcbe90ea ...@@ -22,6 +22,13 @@ md5sum = 726888330d63150bedf37a8cfcbe90ea
output = ${buildout:directory}/template-mariadb.cfg output = ${buildout:directory}/template-mariadb.cfg
mode = 0644 mode = 0644
[template-sphinx]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-sphinx.cfg
md5sum = dd4d57bad35466b07c37ca5708820f0e
output = ${buildout:directory}/template-sphinx.cfg
mode = 0644
[template-zope] [template-zope]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-zope.cfg url = ${:_profile_base_location_}/instance-zope.cfg
...@@ -46,7 +53,7 @@ mode = 0644 ...@@ -46,7 +53,7 @@ mode = 0644
[template] [template]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg url = ${:_profile_base_location_}/instance.cfg
md5sum = 23f40eb3a9a51c4fcd2acd4270cfe626 md5sum = 877b508ff60f74d3915b638c6ea4f241
output = ${buildout:directory}/template.cfg output = ${buildout:directory}/template.cfg
mode = 0644 mode = 0644
...@@ -67,7 +74,7 @@ mode = 0644 ...@@ -67,7 +74,7 @@ mode = 0644
[template-erp5-production] [template-erp5-production]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-erp5-production.cfg url = ${:_profile_base_location_}/instance-erp5-production.cfg
md5sum = a29bd346eebd6a6c659bc1a3a3bdf0e1 md5sum = 09d278f233e8a8a9ad84c46f8ce7faf9
output = ${buildout:directory}/template-erp5-production.cfg output = ${buildout:directory}/template-erp5-production.cfg
mode = 0644 mode = 0644
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment