Commit 171b3adb authored by Paul Graydon's avatar Paul Graydon

software/ors-wendelin: Add ORS Wendelin software release

parent 397d83be
[template-extend]
filename = instance.cfg.in
md5sum = 98b6392a370607647705c761c7c2993e
[template-ors-wendelin]
filename = instance-ors-wendelin.cfg.in
md5sum = 6aee4cd93fa0390d08f12057194fa8d8
\ No newline at end of file
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"properties": {
"project-title": {
"description": "Title of the ORS client project to register",
"title": "Client Project Title",
"type": "string"
},
"client-username": {
"description": "Username for the client project's user account",
"title": "Client Project Account Username",
"type": "string"
},
"ors-hostname": {
"description": "Hostname of the ORS to register to the client project",
"title": "ORS Hostname",
"type": "string"
}
}
}
\ No newline at end of file
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"properties": {
"fluentd-shared-key": {
"description": "Shared key for authentication between fluentd and the ORS' fluentbit",
"title": "Shared Key",
"type": "string"
}
}
}
\ No newline at end of file
{
"$schema": "http://json-schema.org/draft-07/schema",
"description": "Values returned by ORS Wendelin",
"type": "object",
"properties": {
"slave-amount": {
"description": "Amount of slaves attached to this instance",
"type": "number"
}
}
}
\ No newline at end of file
[buildout]
extends =
{{ instance_erp5 }}
parts +=
ors-register
ca-fluentd
[ors-register]
recipe = slapos.recipe.build
slave-instance-list = {{ dumps(slave_instance_list) }}
ors-wendelin-url = ${publish:family-default-v6}
inituser-login = ${publish:inituser-login}
inituser-password = ${publish-early:inituser-password}
update =
import slapos
import requests
import logging
log = logging.getLogger('SLAPOS-ORS-WENDELIN')
logging.basicConfig(level=logging.INFO)
slap = slapos.slap.slap()
slap_connection = self.buildout['slap-connection']
self.computer_id = slap_connection['computer-id']
self.computer_partition_id = slap_connection['partition-id']
self.server_url = slap_connection['server-url']
self.software_release_url = slap_connection['software-release-url']
self.key_file = slap_connection.get('key-file')
self.cert_file = slap_connection.get('cert-file')
self.slave_instance_list = list(self.options['slave-instance-list'])
# Redeploy instance to update published information
slap.initializeConnection(self.server_url, self.key_file, self.cert_file)
computer_partition = slap.registerComputerPartition(self.computer_id, self.computer_partition_id)
ors_wendelin_url = self.options['ors-wendelin-url']
inituser_login = self.options['inituser-login']
inituser_password = self.options['inituser-password']
for slave in self.slave_instance_list:
slave_reference = slave['slave_reference']
project_title = slave['project-title']
project_reference = project_title.replace(" ", "-").lower()
client_username = slave['client-username']
ors_hostname = slave['ors-hostname']
request_url = "%s/erp5/ERP5Site_registerOrsClientProject?project_title=%s&project_reference=%s&client_username=%s&ors_hostname=%s" % (ors_wendelin_url, project_title, project_reference, client_username, ors_hostname)
response = requests.get(request_url, verify=False, auth=(inituser_login, inituser_password))
response = response.json()
error_msg_key = "error_msg"
if error_msg_key in response:
error_msg = response[error_msg_key]
log.fatal(error_msg)
else:
try:
username = response['username']
init_password = response['init_password']
try:
log.info("Update parameters for %s" % slave_reference)
computer_partition.setConnectionDict({'username': str(username),
'init_password': str(init_password)},
slave_reference)
except Exception:
log.fatal("Error while sending slave %s information: %s",
slave_reference, traceback.format_exc())
except KeyError:
log.fatal("Error while fetching client user account credentials")
[fluentd-conf]
recipe = slapos.recipe.build
key-file = ${ca-directory:certs}/fluentd.key
cert-file = ${ca-directory:certs}/fluentd.crt
ors-wendelin-url = ${publish:family-default-v6}
inituser-login = ${publish:inituser-login}
inituser-password = ${publish-early:inituser-password}
init =
import re
options['config-contents'] = (
"<source>\n"
" @type forward\n"
" port 24224\n"
" bind ::0\n"
" add_tag_prefix ors\n"
" <transport tls>\n"
" cert_path %s\n"
" private_key_path %s\n"
" </transport>\n"
" <security>\n"
" self_hostname ors-wendelin-gateway\n"
" shared_key secret\n"
" </security>\n"
"</source>\n"
"<match ors.**>\n"
" @type wendelin\n"
" streamtool_uri %s/erp5/portal_ingestion_policies/ors_ingestion\n"
" user %s\n"
" password %s\n"
"</match>"
) % (options['cert-file'], options['key-file'], options['ors-wendelin-url'], options['inituser-login'], options['inituser-password'])
options['port-list'] = re.findall(r'<source>.*port (\d+).*<\/source>', options['config-contents'], re.DOTALL)
[fluentd-agent-conf]
recipe = slapos.recipe.template
output = ${directory:etc}/fluentd-agent.conf
inline = ${fluentd-conf:config-contents}
[service-fluentd]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/fluentd-service
command-line = {{ parameter_dict['fluentd-location'] }}/bin/fluentd -v -c ${fluentd-agent-conf:output}
environment =
GEM_PATH={{ parameter_dict['fluentd-location'] }}/lib/ruby/gems/
[ca-fluentd]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
key-file = ${fluentd-conf:key-file}
cert-file = ${fluentd-conf:cert-file}
executable = ${service-fluentd:wrapper-path}
wrapper = ${directory:services}/fluentd-service
[publish]
slave-amount = {{ len(slave_instance_list) }}
[buildout]
extends =
{{ template_base }}
[jinja2-template-extend]
recipe = slapos.recipe.template:jinja2
output = ${buildout:parts-directory}/${:_buildout_section_name_}/${:filename}
extra-context =
context =
key slapparameter_dict slap-configuration:configuration
${:extra-context}
[dynamic-template-ors-wendelin-parameters]
fluentd-location = {{ fluentd_location }}
[dynamic-template-ors-wendelin]
<= jinja2-template-extend
url = {{ template_ors_wendelin }}
filename = instance-ors-wendelin.cfg
extensions = jinja2.ext.do
extra-context =
import json_module json
section parameter_dict dynamic-template-ors-wendelin-parameters
key slave_instance_list slap-configuration:slave-instance-list
key instance_erp5 dynamic-template-erp5:output
[switch-softwaretype]
default = dynamic-template-ors-wendelin:output
[buildout]
extends =
buildout.hash.cfg
../../component/fluentd/buildout.cfg
../../software/wendelin/software.cfg
parts +=
ors-wendelin
template-extend
[eggs]
eggs +=
websocket-client
${xlte:egg}
extra-paths +=
${ors-wendelin:location}
[xlte-repository]
recipe = slapos.recipe.build:gitclone
repository = https://lab.nexedi.com/kirr/xlte.git
branch = py2
git-executable = ${git:location}/bin/git
[xlte]
recipe = zc.recipe.egg:develop
setup = ${xlte-repository:location}
egg = xlte
depends =
${numpy:egg}
${pygolang:egg}
websocket-client
[wendelin]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
repository = https://lab.nexedi.com/paul.graydon/wendelin.git
branch = ors_wendelin
revision =
[ors-wendelin]
<= erp5
repository = https://gitlab+deploy-token-64:4d_CQXzuznqyR5nbRf6R@lab.nexedi.com/paul.graydon/ors-wendelin.git
branch = master
revision =
[local-bt5-repository]
list += ${ors-wendelin:location}/bt5
[erp5_repository_list]
repository_id_list += ors-wendelin
[default-bt5]
list =
erp5_full_text_mroonga_catalog
ors_configurator
[fluentd]
gems +=
fluent-plugin-wendelin==0.5
fluent-plugin-bin==0.3
[template]
output = ${buildout:directory}/template-base.cfg
[template-extend]
recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/instance.cfg
extensions = jinja2.ext.do
context =
section buildout buildout
key template_base template:output
key template_ors_wendelin template-ors-wendelin:target
key fluentd_location fluentd:location
[download-base-extend]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:filename}
[template-ors-wendelin]
<= download-base-extend
[versions]
websocket-client = 0.59.0
backports.ssl-match-hostname = 3.7.0.1
{
"name": "ORS Wendelin",
"description": "Master instance of ORS Wendelin",
"serialisation": "xml",
"software-type": {
"default": {
"title": "Default",
"description": "ORS Wendelin",
"request": "instance-ors-wendelin-input-schema.json",
"response": "instance-ors-wendelin-output-schema.json",
"index": 0
},
"default-slave": {
"title": "Default (Shared)",
"description": "ORS Client Project Registration",
"software-type": "default",
"request": "instance-ors-shared-input-schema.json",
"response": "instance-ors-wendelin-output-schema.json",
"shared": true,
"index": 1
}
}
}
\ No newline at end of file
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