Commit cbcf3c5a authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Update Release Candidate

parents 93c3563a 1d57188a
...@@ -64,6 +64,7 @@ patch-binary = ${patch:location}/bin/patch ...@@ -64,6 +64,7 @@ patch-binary = ${patch:location}/bin/patch
patch-options = -p1 patch-options = -p1
patches = patches =
${:_profile_base_location_}/libsanitizer_Use_pre-computed_size_of_struct_ustat_for_Linux.patch#1e5f33e89f9fe1ca3e406eabcc621762 ${:_profile_base_location_}/libsanitizer_Use_pre-computed_size_of_struct_ustat_for_Linux.patch#1e5f33e89f9fe1ca3e406eabcc621762
${:_profile_base_location_}/glibc2.30-ipc_perm.patch#563b7f5a38c2ea6bf741c328422b4c98
[gcc-8.4] [gcc-8.4]
<= gcc-common <= gcc-common
......
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2020-02-28 11:49:29.763277856 +0000
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2020-02-28 11:49:45.092909823 +0000
@@ -198,8 +198,7 @@
unsigned long long __unused1;
unsigned long long __unused2;
#else
- unsigned short mode;
- unsigned short __pad1;
+ unsigned int mode;
unsigned short __seq;
unsigned short __pad2;
#if defined(__x86_64__) && !defined(_LP64)
[buildout] [buildout]
extends = extends =
../patch/buildout.cfg
../perl/buildout.cfg ../perl/buildout.cfg
parts = parts =
...@@ -9,11 +8,8 @@ parts = ...@@ -9,11 +8,8 @@ parts =
[openblas] [openblas]
recipe = slapos.recipe.cmmi recipe = slapos.recipe.cmmi
shared = true shared = true
url = http://github.com/xianyi/OpenBLAS/archive/v0.2.18.tar.gz url = https://github.com/xianyi/OpenBLAS/archive/v0.3.10.tar.gz
md5sum = 805e7f660877d588ea7e3792cda2ee65 md5sum = 4727a1333a380b67c8d7c7787a3d9c9a
patch-options = -p0
patches =
${:_profile_base_location_}/disable_openmp_if_single_core.patch#ee553ccaf9dd4bc37374588e49956f62
build-common-options = NO_STATIC=1 USE_OPENMP=1 USE_THREAD=1 DYNAMIC_ARCH=1 build-common-options = NO_STATIC=1 USE_OPENMP=1 USE_THREAD=1 DYNAMIC_ARCH=1
...@@ -35,4 +31,4 @@ make-options = ...@@ -35,4 +31,4 @@ make-options =
make-targets = make-targets =
PREFIX="@@LOCATION@@" install PREFIX="@@LOCATION@@" install
environment = environment =
PATH=${patch:location}/bin:${perl:location}/bin:%(PATH)s PATH={perl:location}/bin:%(PATH)s
diff --git Makefile.system Makefile.system
index 42ad498..d43aa7a 100644
--- Makefile.system
+++ Makefile.system
@@ -171,6 +171,7 @@ endif
ifeq ($(NUM_THREADS), 1)
override USE_THREAD = 0
+override USE_OPENMP = 0
endif
ifdef USE_THREAD
...@@ -37,21 +37,9 @@ interpreter = python ...@@ -37,21 +37,9 @@ interpreter = python
# interpreter code that buildout generates cannot process `-m pytest --<pytest-option>` # interpreter code that buildout generates cannot process `-m pytest --<pytest-option>`
# -> use pymain from gpython to workaround that. # -> use pymain from gpython to workaround that.
initialization = initialization =
# minimal support for -O argument.
if '-O' in sys.argv:
import os
with open(sys.argv[0]) as f:
executable = f.readlines()[0][2:-1]
sys.argv.remove('-O')
os.execve(executable, sys.argv, dict(os.environ, PYTHONOPTIMIZE='1'))
# set sys.executable to self, so that subprocess and friends go through us
# and this way spawn children with correct sys.path where all eggs that
# parent have are present. TODO consider migrating this into pymain
sys.executable = sys.argv[0]
# tail to pymain # tail to pymain
from gpython import pymain from gpython import pymain
pymain(sys.argv[1:]) pymain(sys.argv)
sys.exit(0) sys.exit(0)
# don't install scripts from listed eggs (avoid conflict with other sections # don't install scripts from listed eggs (avoid conflict with other sections
# that use zc.recipe.egg with eggs overlapping with ${:eggs} - ex neoppod) # that use zc.recipe.egg with eggs overlapping with ${:eggs} - ex neoppod)
...@@ -62,4 +50,4 @@ scripts = ${:interpreter} ...@@ -62,4 +50,4 @@ scripts = ${:interpreter}
[versions] [versions]
pygolang = 0.0.7.post1 pygolang = 0.0.8
...@@ -28,7 +28,7 @@ from setuptools import setup, find_packages ...@@ -28,7 +28,7 @@ from setuptools import setup, find_packages
import glob import glob
import os import os
version = '1.0.167' version = '1.0.171'
name = 'slapos.cookbook' name = 'slapos.cookbook'
long_description = open("README.rst").read() long_description = open("README.rst").read()
...@@ -116,8 +116,6 @@ setup(name=name, ...@@ -116,8 +116,6 @@ setup(name=name,
'ipv6toipv4 = slapos.recipe.6tunnel:SixToFour', 'ipv6toipv4 = slapos.recipe.6tunnel:SixToFour',
'jsondump = slapos.recipe.jsondump:Recipe', 'jsondump = slapos.recipe.jsondump:Recipe',
'kvm.frontend = slapos.recipe.kvm_frontend:Recipe', 'kvm.frontend = slapos.recipe.kvm_frontend:Recipe',
'libcloud = slapos.recipe.libcloud:Recipe',
'libcloudrequest = slapos.recipe.libcloudrequest:Recipe',
'logrotate = slapos.recipe.logrotate:Recipe', 'logrotate = slapos.recipe.logrotate:Recipe',
'logrotate.d = slapos.recipe.logrotate:Part', 'logrotate.d = slapos.recipe.logrotate:Part',
'mkdirectory = slapos.recipe.mkdirectory:Recipe', 'mkdirectory = slapos.recipe.mkdirectory:Recipe',
...@@ -159,7 +157,6 @@ setup(name=name, ...@@ -159,7 +157,6 @@ setup(name=name,
'signalwrapper= slapos.recipe.signal_wrapper:Recipe', 'signalwrapper= slapos.recipe.signal_wrapper:Recipe',
'simplelogger = slapos.recipe.simplelogger:Recipe', 'simplelogger = slapos.recipe.simplelogger:Recipe',
'simplehttpserver = slapos.recipe.simplehttpserver:Recipe', 'simplehttpserver = slapos.recipe.simplehttpserver:Recipe',
'siptester = slapos.recipe.siptester:SipTesterRecipe',
'slapconfiguration = slapos.recipe.slapconfiguration:Recipe', 'slapconfiguration = slapos.recipe.slapconfiguration:Recipe',
'slapconfiguration.serialised = slapos.recipe.slapconfiguration:Serialised', 'slapconfiguration.serialised = slapos.recipe.slapconfiguration:Serialised',
'slapconfiguration.jsondump = slapos.recipe.slapconfiguration:JsonDump', 'slapconfiguration.jsondump = slapos.recipe.slapconfiguration:JsonDump',
......
libcloud
========
Slapified recipe to interact with any libcloud supported IaaS system
from slapos.recipe.librecipe import BaseSlapRecipe
import os
import sys
import zc.buildout
import zc.recipe.egg
from slapos.slap.slap import ServerError
from slapos.tool.cloudmgr.cloudinterface import NodeInterface
from pprint import pformat
class SlavePartitionError(Exception):
pass
class Recipe(BaseSlapRecipe):
SECURITY_GROUP_NAME = 'VifibEC2Security'
def __init__(self, buildout, name, options):
BaseSlapRecipe.__init__(self, buildout, name, options)
self.destroy_wrapper_location = os.path.join(self.bin_directory, 'destroy')
self.running_wrapper_location = os.path.join(self.bin_directory, 'run')
# wrapper parts
options['scripts'] = '''
run
destroy
'''
options['entry-points'] = '''
run=slapos.recipe.libcloud.run:run
destroy=slapos.recipe.libcloud.destroy:destroy
'''
self.egg = zc.recipe.egg.Egg(buildout, '', options)
self.configuration_file = os.path.join(self.etc_directory, 'cloudmgr.cnf')
def _loadSecretAndKey(self):
"""Loads security parameters for connection"""
self.secret = open(os.path.join(self.work_directory, 'secret.txt')
).read().strip()
self.key = open(os.path.join(self.work_directory, 'key.txt')
).read().strip()
def _updateConfigurationFile(self):
configuration_dict = dict(
key=self.key,
secret=self.secret,
node_list=self.slave_partition_configuration_dict_list
)
self._writeFile(self.configuration_file, pformat(configuration_dict))
def _install(self):
"""libcloud compatible machine is installed by creating wrapper, which
will run succesfully as long as the machine is available.
"""
self._loadSecretAndKey()
self.slave_partition_configuration_dict_list = []
self.egg.extra_paths = sys.path
for slave_partition in [self.slap.registerComputerPartition(
self.computer_id, slave_id) for slave_id in self.computer_partition\
.getInstanceParameterDict()['slave_id_list']]:
try:
self.slave_partition_configuration_dict_list.append(
self._installSlavePartition(slave_partition))
except SlavePartitionError as e:
self.logger.warning('Slave Parttion %r not installed, issue: %r'%(
slave_partition.getId(), e))
# Installs wrappers
self._updateConfigurationFile()
self.options['arguments'] = "server_binary = %r, configuration_file = %r"%(
self.options['server_binary'], self.configuration_file)
self.egg.install()
os.chmod(os.path.join(
self.running_wrapper_location), int('0700', 8))
os.chmod(os.path.join(
self.destroy_wrapper_location), int('0700', 8))
return []
def _installSlavePartition(self, slave_partition):
requested_dict = slave_partition.getInstanceParameterDict()
requested_dict.setdefault('service', 'EC2_EU_WEST')
requested_dict.setdefault('location', '0')
requested_dict.setdefault('image', 'ami-05cae171')
requested_dict.setdefault('size', 'm1.smal')
requested_dict.setdefault('security_group', 'VifibEC2Security')
connection_dict = slave_partition.getConnectionDict()
node_kw = dict(
key = self.key,
secret = self.secret,
service = requested_dict['service'],
location = requested_dict['location'],
node_uuid = connection_dict.get('node_uuid', None),
ssh_key = connection_dict.get('ssh_key', None)
)
node = NodeInterface(**node_kw)
update_kw = dict(
image = requested_dict['image'],
size = requested_dict['size'],
security_group = requested_dict['security_group'],
)
self.logger.info('Updating %r' % slave_partition.getId())
connection_dict.update(node.update(**update_kw))
self.logger.info('Fetching public ip of %r' % slave_partition.getId())
connection_dict.update(node.getPublicIpList())
slave_partition.available()
connection_dict.setdefault('username', 'root')
slave_partition.setConnectionDict(connection_dict)
requested_dict.update(connection_dict)
slave_partition_state = slave_partition.getState()
# as cloudmgr is not related with slap and runs as async process to recipe
# assume that whatever came from slave is correctly done
if slave_partition_state in ['started', 'stopped']:
# stopped cannot be supported, because in case of libcloud it is equal
# to destroyed
# even worse: stopped is the first state for installed partition
try:
getattr(slave_partition, slave_partition_state)()
except ServerError:
# Recipe is becoming responsible for system state, so it have to
# not die in case of slap server error
pass
requested_dict['requested_state'] = 'started'
elif slave_partition_state == 'destroyed':
requested_dict['requested_state'] = slave_partition_state
try:
slave_partition.destroyed()
except ServerError:
# Recipe is becoming responsible for system state, so it have to
# not die in case of slap server error
pass
return requested_dict
from os import execl
import sys
def run(server_binary, configuration_file):
sys.stdout.flush()
execl(server_binary, server_binary, configuration_file)
from slapos.recipe.librecipe import BaseSlapRecipe
import zc.buildout
class Recipe(BaseSlapRecipe):
def _install(self):
amazon = self.request(
'https://svn.erp5.org/repos/public/slapos/trunk/software_release/libcloud/software.cfg',
'Amazon EC Image',
'Amazon EC Connector Partition',
True)
amazon_dict = amazon.getConnectionDict()
if amazon_dict == {}:
raise zc.buildout.UserError('Slave not installed yet')
self.computer_partition.setConnectionDict(amazon.getConnectionDict())
return []
import os
import pkg_resources
from slapos.recipe.librecipe import BaseSlapRecipe
class SipTesterRecipe(BaseSlapRecipe):
def __init__(self, buildout, name, options):
BaseSlapRecipe.__init__(self, buildout, name, options)
self.pjsua_configuration_file = os.path.join(self.etc_directory,
'pjsua.conf')
def _createPJSUAConfiguration(self, template_name):
pjsua_input = pkg_resources.resource_string(__name__, os.path.join(
'template', template_name))
if self._writeFile(self.pjsua_configuration_file,
pjsua_input % self.options):
# XXX: How to inform slap/slapgrid that something changed and it might
# be not bad idea to restart CP?
pass
return self.pjsua_configuration_file
def _install(self):
path = self._createPJSUAConfiguration(self.config_template)
d = {}
d.update(self.options)
d['pjsua_configuration_file'] = self.pjsua_configuration_file
# XXX Hardcoded path
d['pjsua_binary'] = os.path.join(self.buildout['software_definition'
]['software_home'].strip(), 'parts', 'pjproject-1.7', 'bin', 'pjsua')
d['siptester_binary'] = os.path.join(self.buildout['software_definition'
]['software_home'].strip(), 'bin', 'siptester')
self.running_wrapper_location = pkg_resources.resource_filename(__name__, os.path.join(
'template',
self.wrapper_template))
self._createRunningWrapper(d)
return [path, wrapper_path]
update = install
class ReceiverRecipe(SipTesterRecipe):
config_template = "pjsua_receiver.conf.in"
wrapper_template = "init_receiver.in"
class CallerRecipe(SipTesterRecipe):
config_template = "pjsua_caller.conf.in"
wrapper_template = "init_caller.in"
def _install(self):
# First of all, ask for a sipreceiver
self.request(self.software_release_url, 'sipreceiver')
return SipTesterRecipe._install(self)
#!/bin/sh
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
exec %(siptester_binary)s %(pjsua_binary)s %(pjsua_configuration_file)s %(caller_destination)s
#!/bin/sh
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
exec %(siptester_binary)s %(pjsua_binary)s %(pjsua_configuration_file)s
#
# Logging options:
#
--log-level 0
--app-log-level 0
#
# Account 0:
#
--id %(caller_id)s
--registrar %(caller_registrar)s
--realm %(caller_realm)s
--username %(caller_username)s
--password %(caller_password)s
--reg-timeout 300
#
# Network settings:
#
--local-port 5060
#
# Media settings:
#
--null-audio
--playback-lat 100
--rtp-port 4000
#
# User agent:
#
--max-calls 4
--duration 300
#
# Logging options:
#
--log-level 0
--app-log-level 0
#
# Account 0:
#
--id %(receiver_id)s
--registrar %(receiver_registrar)s
--realm %(receiver_realm)s
--username %(receiver_username)s
--password %(receiver_password)s
--reg-timeout 300
#
# Network settings:
#
--local-port 5060
#
# Media settings:
#
--null-audio
--auto-play
--play-file %(wav_path)s
--playback-lat 100
--rtp-port 4000
#
# User agent:
#
--auto-answer 200
--max-calls 4
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
# #
############################################################################## ##############################################################################
import ConfigParser from six.moves import configparser
import os import os
import zc.buildout import zc.buildout
...@@ -53,7 +53,7 @@ class WriteRecipe(GenericBaseRecipe): ...@@ -53,7 +53,7 @@ class WriteRecipe(GenericBaseRecipe):
def install(self): def install(self):
# Set up the parser, and write config file if needed # Set up the parser, and write config file if needed
self.parser = ConfigParser.ConfigParser() self.parser = configparser.ConfigParser()
try: try:
self.parser.read(self.path) self.parser.read(self.path)
#clean_options(options) #clean_options(options)
...@@ -63,7 +63,7 @@ class WriteRecipe(GenericBaseRecipe): ...@@ -63,7 +63,7 @@ class WriteRecipe(GenericBaseRecipe):
with open(self.path, 'w') as file: with open(self.path, 'w') as file:
self.parser.write(file) self.parser.write(file)
# If the file or section do not exist # If the file or section do not exist
except (ConfigParser.NoSectionError, IOError) as e: except (configparser.NoSectionError, IOError) as e:
self.full_install() self.full_install()
def full_install(self): def full_install(self):
...@@ -94,7 +94,7 @@ class ReadRecipe(GenericBaseRecipe): ...@@ -94,7 +94,7 @@ class ReadRecipe(GenericBaseRecipe):
self.path = options['file-path'].strip() self.path = options['file-path'].strip()
# Set up the parser, and write config file if needed # Set up the parser, and write config file if needed
self.parser = ConfigParser.ConfigParser() self.parser = configparser.ConfigParser()
if os.path.exists(self.path): if os.path.exists(self.path):
self.parser.read(self.path) self.parser.read(self.path)
for section in self.parser.sections(): for section in self.parser.sections():
......
import os
import shutil
import tempfile
import unittest
import zc.buildout.testing
from slapos.recipe import zero_knowledge
class ZeroKnowledgeTest(unittest.TestCase):
def setUp(self):
self.tmp_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, self.tmp_dir)
self.buildout = zc.buildout.testing.Buildout()
self.buildout['buildout']['directory'] = self.tmp_dir
def test_write_read(self):
buildout = self.buildout
buildout['zero-knowledge-write'] = {
'filename': 'zero-knowledge.cfg',
'recipe': 'slapos.cookbook:zero-knowledge.read',
'secret': '?',
}
buildout['zero-knowledge-read'] = {
'filename': 'zero-knowledge.cfg',
'recipe': 'slapos.cookbook:zero-knowledge.read',
}
write_recipe = zero_knowledge.WriteRecipe(
buildout,
'zero-knowledge-write',
buildout['zero-knowledge-write'],
)
write_recipe.install()
self.assertTrue(os.path.exists(os.path.join(self.tmp_dir, 'zero-knowledge.cfg',)))
zero_knowledge.ReadRecipe(
buildout,
'zero-knowledge-read',
buildout['zero-knowledge-read'],
)
self.assertEqual(buildout['zero-knowledge-read']['secret'], '?')
...@@ -18,7 +18,7 @@ changes to the code, run tests and publish changes. ...@@ -18,7 +18,7 @@ changes to the code, run tests and publish changes.
```bash ```bash
# install this software release and request an instance # install this software release and request an instance
SR=https://lab.nexedi.com/nexedi/slapos/raw/1.0/software/slapos-sr-testing/software.cfg SR=https://lab.nexedi.com/nexedi/slapos/raw/1.0/software/slapos-sr-testing/software.cfg
COMP=slaprunner # or "local" if using theia COMP=slaprunner
INSTANCE_NAME=$COMP INSTANCE_NAME=$COMP
slapos supply $SR $COMP slapos supply $SR $COMP
......
...@@ -5,8 +5,8 @@ extends = ...@@ -5,8 +5,8 @@ extends =
[python] [python]
part = python3 part = python3
[eggs] [python-interpreter]
eggs += extra-eggs +=
# plantuml 0.3.0 is only available for Python 3 # plantuml 0.3.0 is only available for Python 3
${slapos.test.plantuml-setup:egg} ${slapos.test.plantuml-setup:egg}
......
...@@ -167,9 +167,9 @@ branch = master ...@@ -167,9 +167,9 @@ branch = master
egg = slapos.core egg = slapos.core
setup = ${slapos.core-repository:location} setup = ${slapos.core-repository:location}
[eggs] [python-interpreter]
<= python-interpreter eggs += ${:extra-eggs}
eggs += extra-eggs =
${lxml-python:egg} ${lxml-python:egg}
${slapos.core-setup:egg} ${slapos.core-setup:egg}
${pillow-python:egg} ${pillow-python:egg}
...@@ -216,7 +216,7 @@ PyPDF2-patch-options = -p1 ...@@ -216,7 +216,7 @@ PyPDF2-patch-options = -p1
[eggs/scripts] [eggs/scripts]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = ${eggs:eggs} eggs = ${python-interpreter:eggs}
scripts = scripts =
slapos slapos
supervisord supervisord
...@@ -243,7 +243,7 @@ context = ...@@ -243,7 +243,7 @@ context =
key nxdtest_instance nxdtest-instance.cfg:rendered key nxdtest_instance nxdtest-instance.cfg:rendered
key git_location git:location key git_location git:location
key slapos_location slapos-repository:location key slapos_location slapos-repository:location
key interpreter eggs:interpreter key interpreter python-interpreter:interpreter
key curl_location curl:location key curl_location curl:location
key openssl_location openssl-output:bin key openssl_location openssl-output:bin
key faketime_location faketime:location key faketime_location faketime:location
...@@ -272,7 +272,6 @@ extra = ...@@ -272,7 +272,6 @@ extra =
gitlab ${slapos.test.gitlab-setup:setup} gitlab ${slapos.test.gitlab-setup:setup}
cloudooo ${slapos.test.cloudooo-setup:setup} cloudooo ${slapos.test.cloudooo-setup:setup}
dream ${slapos.test.dream-setup:setup} dream ${slapos.test.dream-setup:setup}
repman ${slapos.test.repman-setup:setup}
[versions] [versions]
# slapos.core is used from the clone always # slapos.core is used from the clone always
......
...@@ -160,8 +160,8 @@ class TestTheiaEmbeddedSlapOSShutdown(SlapOSInstanceTestCase): ...@@ -160,8 +160,8 @@ class TestTheiaEmbeddedSlapOSShutdown(SlapOSInstanceTestCase):
os.path.join( os.path.join(
self.computer_partition_root_path, self.computer_partition_root_path,
'srv', 'srv',
'slapos', 'runner',
'inst', 'instance',
), self.logger) ), self.logger)
# Wait a bit for this supervisor to be started. # Wait a bit for this supervisor to be started.
......
...@@ -15,8 +15,12 @@ ...@@ -15,8 +15,12 @@
[instance-cfg] [instance-cfg]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = d027a2dccaf15ae6e7d3a28cc02d70c3 md5sum = 776c7de2054f78ba79382c22d85018be
[template-turnserver] [template-turnserver]
filename = instance-turnserver.cfg.jinja2.in filename = instance-turnserver.cfg.jinja2.in
md5sum = 539417d669c15b853ac8525f8d5cbc44 md5sum = df8768f165036dbe0435bd1678b9deb3
[template-insecure-turnserver]
filename = instance-insecure-turnserver.cfg.jinja2.in
md5sum = 0e0807eef75a1ee6f9aef3a6a566a729
{% set part_list = [] -%}
{% set server_name = slapparameter_dict.get('server-name', 'turn.example.com') -%}
[directory]
recipe = slapos.cookbook:mkdirectory
etc = ${buildout:directory}/etc
bin = ${buildout:directory}/bin
srv = ${buildout:directory}/srv
var = ${buildout:directory}/var
run = ${:var}/run
log = ${:var}/log
scripts = ${:etc}/run
services = ${:etc}/service
plugins = ${:etc}/plugin
[turnserver-password]
recipe = slapos.cookbook:generate.password
bytes = 8
{% set turn_port = slapparameter_dict.get('port', 3478) -%}
{% set turn_tls_port = slapparameter_dict.get('tls-port', 5349) -%}
{% set listining_ip = slapparameter_dict.get('listening-ip', (ipv4 | list)[0]) -%}
[turnserver-config]
recipe = collective.recipe.template
user = nxdturn
input = inline:
listening-port={{ turn_port }}
lt-cred-mech
realm={{ server_name }}
{% if slapparameter_dict.get('external-ip', '') %}
external-ip={{ slapparameter_dict['external-ip'] }}
{% endif %}
fingerprint
listening-ip={{ listining_ip }}
server-name={{ server_name }}
no-stdout-log
simple-log
log-file=${directory:log}/turnserver.log
pidfile=${directory:run}/turnserver.pid
verbose
user=${:user}:${turnserver-password:passwd}
output = ${directory:etc}/turnserver.conf
mode = 644
[turnserver-wrapper]
recipe = slapos.cookbook:wrapper
# XXX on first invocation of read-secret, the secret file is not yet generated
# so on first buildout run turnserver-config has an empty secret.
# We don't want to start the server when config file is not complete.
command-line =
{{ parameter_dict['turnserver-location'] }}/bin/turnserver -c ${turnserver-config:output}
wrapper-path = ${directory:services}/turnserver
hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
[promise-check-turnserver-port]
<= monitor-promise-base
module = check_port_listening
name = turnserver-port-listening.py
config-hostname = {{ listining_ip }}
config-port = {{ turn_port }}
[promise-check-turnserver-tls-port]
<= monitor-promise-base
module = check_port_listening
name = turnserver-tls-port-listening.py
config-hostname = {{ listining_ip }}
config-port = {{ turn_tls_port }}
[publish-connection-information]
<= monitor-publish
recipe = slapos.cookbook:publish
turn-url = {{ server_name ~ ':' ~ turn_port }}
user = ${turnserver-config:user}
password = ${turnserver-password:passwd}
[buildout]
extends = {{ template_monitor }}
parts =
publish-connection-information
# Complete parts with sections
{{ part_list | join('\n ') }}
# turn server
turnserver-wrapper
promise-check-turnserver-tls-port
promise-check-turnserver-port
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
...@@ -99,6 +99,7 @@ input = inline: ...@@ -99,6 +99,7 @@ input = inline:
no-tlsv1 no-tlsv1
no-tlsv1_1 no-tlsv1_1
no-stdout-log no-stdout-log
simple-log
log-file=${directory:log}/turnserver.log log-file=${directory:log}/turnserver.log
userdb=${directory:srv}/turndb userdb=${directory:srv}/turndb
pidfile=${directory:run}/turnserver.pid pidfile=${directory:run}/turnserver.pid
......
...@@ -10,6 +10,7 @@ offline = true ...@@ -10,6 +10,7 @@ offline = true
[switch-softwaretype] [switch-softwaretype]
recipe = slapos.cookbook:softwaretype recipe = slapos.cookbook:softwaretype
default = $${dynamic-template-turnserver:rendered} default = $${dynamic-template-turnserver:rendered}
insecure = $${dynamic-template-insecure-turnserver:rendered}
RootSoftwareInstance = $${:default} RootSoftwareInstance = $${:default}
[slap-configuration] [slap-configuration]
...@@ -50,3 +51,10 @@ template = ${template-turnserver:location}/${template-turnserver:filename} ...@@ -50,3 +51,10 @@ template = ${template-turnserver:location}/${template-turnserver:filename}
filename = instance-turnserver.cfg filename = instance-turnserver.cfg
extra-context = extra-context =
section parameter_dict dynamic-template-turnserver-parameters section parameter_dict dynamic-template-turnserver-parameters
[dynamic-template-insecure-turnserver]
<= jinja2-template-base
template = ${template-insecure-turnserver:location}/${template-insecure-turnserver:filename}
filename = instance-insecure-turnserver.cfg
extra-context =
section parameter_dict dynamic-template-turnserver-parameters
...@@ -28,5 +28,8 @@ output = ${buildout:directory}/instance.cfg ...@@ -28,5 +28,8 @@ output = ${buildout:directory}/instance.cfg
[template-turnserver] [template-turnserver]
<= download-base <= download-base
[template-insecure-turnserver]
<= download-base
[versions] [versions]
slapos.recipe.template = 4.4 slapos.recipe.template = 4.4
...@@ -188,3 +188,61 @@ verbose""" % {'instance_path': self.partition_path, ...@@ -188,3 +188,61 @@ verbose""" % {'instance_path': self.partition_path,
current_config = f.read().strip() current_config = f.read().strip()
self.assertEqual(current_config.splitlines(), expected_config.splitlines()) self.assertEqual(current_config.splitlines(), expected_config.splitlines())
class TestInsecureServices(TurnServerTestCase):
@classmethod
def getInstanceSoftwareType(cls):
return 'insecure'
def test_process_list(self):
hash_list = [
'software_release/buildout.cfg',
]
expected_process_names = [
'bootstrap-monitor',
'turnserver-{hash}-on-watch',
'certificate_authority-{hash}-on-watch',
'crond-{hash}-on-watch',
'monitor-httpd-{hash}-on-watch',
'monitor-httpd-graceful',
]
with self.slap.instance_supervisor_rpc as supervisor:
process_name_list = [process['name']
for process in supervisor.getAllProcessInfo()]
hash_file_list = [os.path.join(self.computer_partition_root_path, path)
for path in hash_list]
for name in expected_process_names:
h = generateHashFromFiles(hash_file_list)
expected_process_name = name.format(hash=h)
self.assertIn(expected_process_name, process_name_list)
def test_default_deployment(self):
self.assertTrue(os.path.exists(self.partition_path))
connection_parameter_dict = self.computer_partition\
.getConnectionParameterDict()
password = connection_parameter_dict['password']
expected_config = """listening-port=3478
lt-cred-mech
realm=turn.example.com
fingerprint
listening-ip=%(ipv4)s
server-name=turn.example.com
no-stdout-log
simple-log
log-file=%(instance_path)s/var/log/turnserver.log
pidfile=%(instance_path)s/var/run/turnserver.pid
verbose
user=nxdturn:%(password)""" % {'instance_path': self.partition_path, 'password': password, 'ipv4': self._ipv4_address}
with open(os.path.join(self.partition_path, 'etc/turnserver.conf')) as f:
current_config = f.read().strip()
self.assertEqual(current_config.splitlines(), expected_config.splitlines())
# Version: 0.0.1
[buildout]
parts =
libcloud-requester
# instance shall be offline
offline = true
eggs-directory = ${software_definition:software_home}/eggs
develop-eggs-directory = ${software_definition:software_home}/develop-eggs
[libcloud-requester]
# slap connection information
slap_computer_id = ${slap_computer_id}
slap_computer_partition_id = ${slap_computer_partition_id}
slap_server_url = ${slap_server_url}
slap_software_release_url = ${slap_software_release_url}
# select recipe
recipe = slapos.recipe.libcloudrequest
# Version: 0.0.1
[buildout]
parts =
workaround-downloadcache
libcloudrequestertemplate
eggs
find-links =
http://www.nexedi.org/static/packages/source/slapos.buildout/
versions = versions
[workaround-downloadcache]
recipe = plone.recipe.command
command =
rm -rf ${buildout:directory}/downloads
update-command = ${:command}
[libcloudrequestertemplate]
recipe = slapos.recipe.hrdownload
url = ${:_profile_base_location_}/instance.cfg
filename = template.cfg
destination = ${buildout:directory}
download-only = true
[eggs]
recipe = zc.recipe.egg
eggs =
slapos.recipe.libcloudrequest
[versions]
zc.buildout = 1.5.3-dev-SlapOS-001
# Version: 0.0.4dev
[buildout]
parts =
libcloud-instance
# instance shall be offline
offline = true
eggs-directory = ${software_definition:software_home}/eggs
develop-eggs-directory = ${software_definition:software_home}/develop-eggs
[libcloud-instance]
# slap connection information
slap_computer_id = ${slap_computer_id}
slap_computer_partition_id = ${slap_computer_partition_id}
slap_server_url = ${slap_server_url}
slap_software_release_url = ${slap_software_release_url}
# select recipe
recipe = slapos.recipe.libcloud
server_binary = ${software_definition:software_home}/bin/cloudmgr
# Version: 0.0.5dev
[buildout]
parts =
workaround-downloadcache
libcloudtemplate
paramiko-wrokaround-dependency
paramiko-wrokaround
eggs
versions = paramiko-workaround-versions
[paramiko-workaround-versions]
paramiko = 1.7.6
[paramiko-wrokaround-dependency]
recipe = zc.recipe.egg
eggs =
pycrypto
[paramiko-wrokaround]
recipe = zc.recipe.egg
index =
eggs =
paramiko
[workaround-downloadcache]
recipe = plone.recipe.command
command =
rm -rf ${buildout:directory}/downloads
update-command = ${:command}
[libcloudtemplate]
recipe = slapos.recipe.hrdownload
url =
filename = template.cfg
destination = ${buildout:directory}
download-only = true
[eggs]
recipe = zc.recipe.egg
eggs =
slapos.tool.cloudmgr
slapos.recipe.libcloud
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