Commit dcabf1b1 authored by Xavier Thompson's avatar Xavier Thompson

Update Release Candidate

parents 89e64228 2112ee3c
......@@ -9,17 +9,17 @@ parts = dcron-output
[dcron]
recipe = slapos.recipe.cmmi
shared = false
url = http://www.jimpryor.net/linux/releases/dcron-4.4.tar.gz
md5sum = 02d848ba043a9df5bf2102a9f4bc04bd
url = http://www.jimpryor.net/linux/releases/dcron-4.5.tar.gz
md5sum = 078833f3281f96944fc30392b1888326
configure-command = true
patch-binary = ${patch:location}/bin/patch
patches =
${:_profile_base_location_}/dcron-4.4.noroot.no.globals.patch#d5408ab682b65cc1eda40d588fcd7db8
${:_profile_base_location_}/noroot-no-globals.patch#623379916f48bd8292a28057c8bd30f7
patch-options = -p1
make-options =
PREFIX=${buildout:parts-directory}/${:_buildout_section_name_}
post-make-hook = ${:_profile_base_location_}/dcron-hooks.py#d7985eef1ceef01af00ffb1d38708c8d:post_make_hook
environment =
PATH=${patch:location}/bin:%(PATH)s
post-install =
chmod u-s %(location)s/bin/crontab
dummy = ${randomsleep:recipe}
[dcron-output]
......
import os
import shutil
def post_make_hook(options, buildout):
crontab_path = os.path.join(options['location'], 'bin', 'crontab')
os.chmod(crontab_path, 0o750)
diff -ru dcron-4.4.org/chuser.c dcron-4.4/chuser.c
--- dcron-4.4.org/chuser.c 2010-01-18 16:27:31.000000000 +0100
+++ dcron-4.4/chuser.c 2013-07-18 18:17:16.342147418 +0200
@@ -14,47 +14,6 @@
--- dcron-4.5/chuser.c
+++ dcron-4.5/chuser.c
@@ -14,6 +14,7 @@
int
ChangeUser(const char *user, char *dochdir)
{
- struct passwd *pas;
-
- /*
- * Obtain password entry and change privilages
- */
-
- if ((pas = getpwnam(user)) == 0) {
- printlogf(LOG_ERR, "failed to get uid for %s\n", user);
- return(-1);
- }
- setenv("USER", pas->pw_name, 1);
- setenv("HOME", pas->pw_dir, 1);
- setenv("SHELL", "/bin/sh", 1);
-
- /*
- * Change running state to the user in question
- */
-
- if (initgroups(user, pas->pw_gid) < 0) {
- printlogf(LOG_ERR, "initgroups failed: %s %s\n", user, strerror(errno));
- return(-1);
- }
- if (setregid(pas->pw_gid, pas->pw_gid) < 0) {
- printlogf(LOG_ERR, "setregid failed: %s %d\n", user, pas->pw_gid);
- return(-1);
- }
- if (setreuid(pas->pw_uid, pas->pw_uid) < 0) {
- printlogf(LOG_ERR, "setreuid failed: %s %d\n", user, pas->pw_uid);
- return(-1);
- }
- if (dochdir) {
- /* try to change to $HOME */
- if (chdir(pas->pw_dir) < 0) {
- printlogf(LOG_ERR, "chdir failed: %s %s\n", user, pas->pw_dir);
- /* dochdir is a backup directory, usually /tmp */
- if (chdir(dochdir) < 0) {
- printlogf(LOG_ERR, "chdir failed: %s %s\n", user, dochdir);
- return(-1);
- }
- }
- }
- return(pas->pw_uid);
+ return getpwnam(user);
+#if 0
struct passwd *pas;
/*
@@ -57,5 +58,8 @@
}
}
return(pas->pw_uid);
+#else
+ return getpwnam(user);
+#endif
}
diff -ru dcron-4.4.org/crontab.c dcron-4.4/crontab.c
--- dcron-4.4.org/crontab.c 2010-01-18 16:27:31.000000000 +0100
+++ dcron-4.4/crontab.c 2013-07-18 18:18:07.768535485 +0200
--- dcron-4.5/crontab.c
+++ dcron-4.5/crontab.c
@@ -88,7 +88,7 @@
break;
case 'c':
......@@ -81,9 +47,8 @@ diff -ru dcron-4.4.org/crontab.c dcron-4.4/crontab.c
if ((ptr = getenv("EDITOR")) == NULL || strlen(ptr) >= sizeof(visual))
if ((ptr = getenv("VISUAL")) == NULL || strlen(ptr) >= sizeof(visual))
ptr = PATH_VI;
diff -ru dcron-4.4.org/job.c dcron-4.4/job.c
--- dcron-4.4.org/job.c 2010-01-18 16:27:31.000000000 +0100
+++ dcron-4.4/job.c 2013-07-18 18:17:16.342147418 +0200
--- dcron-4.5/job.c
+++ dcron-4.5/job.c
@@ -62,14 +62,6 @@
* Change running state to the user in question
*/
......@@ -114,9 +79,8 @@ diff -ru dcron-4.4.org/job.c dcron-4.4/job.c
/* from this point we are unpriviledged */
/*
diff -ru dcron-4.4.org/Makefile dcron-4.4/Makefile
--- dcron-4.4.org/Makefile 2010-01-18 16:27:31.000000000 +0100
+++ dcron-4.4/Makefile 2013-07-18 18:17:16.342147418 +0200
--- dcron-4.5/Makefile
+++ dcron-4.5/Makefile
@@ -3,7 +3,6 @@
# these variables can be configured by e.g. `make SCRONTABS=/different/path`
......@@ -137,9 +101,9 @@ diff -ru dcron-4.4.org/Makefile dcron-4.4/Makefile
+INSTALL_DATA = $(INSTALL) -D -m0644
+INSTALL_DIR = $(INSTALL) -d -m0755
CFLAGS ?= -O2
CFLAGS += -Wall -Wstrict-prototypes
CFLAGS += -Wall -Wstrict-prototypes -Wno-missing-field-initializers
SRCS = main.c subs.c database.c job.c concat.c chuser.c
@@ -44,7 +43,6 @@
@@ -45,7 +44,6 @@
echo "SBINDIR = $(SBINDIR)" >> config
echo "BINDIR = $(BINDIR)" >> config
echo "MANDIR = $(MANDIR)" >> config
......@@ -147,8 +111,8 @@ diff -ru dcron-4.4.org/Makefile dcron-4.4/Makefile
echo "SCRONTABS = $(SCRONTABS)" >> config
echo "CRONTABS = $(CRONTABS)" >> config
echo "CRONSTAMPS = $(CRONSTAMPS)" >> config
@@ -62,13 +60,10 @@
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $< -o $@
@@ -63,13 +61,10 @@
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(DEFS) $< -o $@
install:
- $(INSTALL_PROGRAM) -m0700 -g root crond $(DESTDIR)$(SBINDIR)/crond
......
......@@ -44,8 +44,8 @@ environment-extra =
[golang1.15]
<= golang-common
url = https://golang.org/dl/go1.15.11.src.tar.gz
md5sum = bd7617d2b959eb6e0b0df2a19e435a06
url = https://golang.org/dl/go1.15.12.src.tar.gz
md5sum = b3a5dafa7028fa00083ce4aeaf5bcb9a
# go1.15 needs go1.4 to bootstrap
environment-extra =
......@@ -53,8 +53,8 @@ environment-extra =
[golang1.16]
<= golang-common
url = https://golang.org/dl/go1.16.3.src.tar.gz
md5sum = 48183a40d6522f1ea59b7d63377b7072
url = https://golang.org/dl/go1.16.4.src.tar.gz
md5sum = 5884a4cb49067b9bcf6e69a1ef44259c
# go1.16 needs go1.4 to bootstrap
environment-extra =
......
......@@ -2,7 +2,7 @@
#
# Should go away once wendelin.core 2 lands to nexedi/wendelin.core@master.
# Must be extended from last, for example:
#
#
# [buildout]
# extends =
# .../stack/erp5/buildout.cfg
......@@ -11,4 +11,4 @@
[wendelin.core-repository]
repository = https://lab.nexedi.com/kirr/wendelin.core.git
branch = t
revison =
revision =
......@@ -26,7 +26,7 @@ md5sum = dd6542a91746e6e3720eaa1590792dbe
[profile-caddy-replicate]
filename = instance-apache-replicate.cfg.in
md5sum = 1248911409cbeea980a838b04ee451d2
md5sum = ec421617d4932e8e1ae1e55a41fbfaab
[profile-slave-list]
_update_hash_filename_ = templates/apache-custom-slave-list.cfg.in
......@@ -106,11 +106,11 @@ md5sum = 38792c2dceae38ab411592ec36fff6a8
[profile-kedifa]
filename = instance-kedifa.cfg.in
md5sum = 3daebc4b37088fa01183a853920d4143
md5sum = 225ce18b9218de4169327a206051a92e
[template-backend-haproxy-rsyslogd-conf]
_update_hash_filename_ = templates/backend-haproxy-rsyslogd.conf.in
md5sum = 3ec9e088817f6a0e3b3b71919590e6b3
md5sum = 3336d554661b138dcef97b1d1866803c
[template-slave-introspection-httpd-nginx]
_update_hash_filename_ = templates/slave-introspection-httpd-nginx.conf.in
......
......@@ -474,6 +474,7 @@ kedifa = ${request-kedifa:connection-monitor-base-url}
recipe = slapos.cookbook:mkdirectory
bin = ${buildout:directory}/bin/
srv = ${buildout:directory}/srv/
tmp = ${buildout:directory}/tmp/
backup = ${:srv}/backup
# CAUCASE directories
caucased = ${:srv}/caucased
......@@ -887,9 +888,10 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
backup_dir='${directory:backup-caucased}',
data_dir='${directory:caucased}',
netloc=caucase_netloc,
tmp='${directory:tmp}',
service_auto_approve_count=0,
user_auto_approve_count=1,
key_len=2048,
key_len=2048
)}}
[buildout]
......
......@@ -41,9 +41,10 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
backup_dir='${directory:backup-caucased}',
data_dir='${directory:caucased}',
netloc=caucase_netloc,
tmp='${directory:tmp}',
service_auto_approve_count=0,
user_auto_approve_count=1,
key_len=2048,
key_len=2048
)}}
# Create all needed directories
......
......@@ -16,7 +16,7 @@ $Umask 0022
$WorkDirectory {{ configuration['spool-directory'] }}
# Setup logging per slave, by extracting the slave name from the log stream
{%- set regex = ".*-backend (.*)-http.{0,1}/" %}
{%- set regex = ".*-backend (.*)-http.{0,1}(|-failover)/" %}
template(name="extract_slave_name" type="string" string="%msg:R,ERE,1,FIELD:{{ regex }}--end%")
set $!slave_name = exec_template("extract_slave_name");
template(name="slave_output" type="string" string="{{ configuration['caddy-log-directory'] }}/%$!slave_name%_backend_log")
......
......@@ -51,6 +51,8 @@ import urlparse
import socket
import sys
import logging
import random
import string
try:
......@@ -527,6 +529,15 @@ class TestHandler(BaseHTTPRequestHandler):
response = None
status_code = 200
timeout = int(self.headers.dict.get('timeout', '0'))
if 'x-maximum-timeout' in self.headers.dict:
maximum_timeout = int(self.headers.dict['x-maximum-timeout'])
timeout = random.randrange(maximum_timeout)
if 'x-response-size' in self.headers.dict:
min_response, max_response = [
int(q) for q in self.headers.dict['x-response-size'].split(' ')]
reponse_size = random.randrange(min_response, max_response)
response = ''.join(
random.choice(string.lowercase) for x in range(reponse_size))
compress = int(self.headers.dict.get('compress', '0'))
header_dict = {}
prefix = 'x-reply-header-'
......@@ -1190,6 +1201,16 @@ class SlaveHttpFrontendTestCase(HttpFrontendTestCase):
return parameter_dict
def assertLastLogLineRegexp(self, log_name, log_regexp):
log_file = glob.glob(
os.path.join(
self.instance_path, '*', 'var', 'log', 'httpd', log_name
))[0]
self.assertRegexpMatches(
open(log_file, 'r').readlines()[-1],
log_regexp)
class TestMasterRequestDomain(HttpFrontendTestCase, TestDataMixin):
@classmethod
......@@ -1880,38 +1901,24 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
result.headers['Set-Cookie']
)
# check access log
log_file = glob.glob(
os.path.join(
self.instance_path, '*', 'var', 'log', 'httpd', '_Url_access_log'
))[0]
log_regexp = r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} - - ' \
r'\[\d{2}\/.{3}\/\d{4}\:\d{2}\:\d{2}\:\d{2} \+\d{4}\] ' \
r'"GET \/test-path\/deep\/..\/.\/deeper HTTP\/1.1" \d{3} ' \
r'\d+ "-" "TEST USER AGENT" \d+'
self.assertRegexpMatches(
open(log_file, 'r').readlines()[-1],
log_regexp)
# check backend log
log_file = glob.glob(
os.path.join(
self.instance_path, '*', 'var', 'log', 'httpd', '_Url_backend_log'
))[0]
log_regexp = r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+ ' \
r'\[\d{2}\/.{3}\/\d{4}\:\d{2}\:\d{2}\:\d{2}.\d{3}\] ' \
r'http-backend _Url-http\/_Url-backend ' \
r'\d+/\d+\/\d+\/\d+\/\d+ ' \
r'200 \d+ - - ---- ' \
r'\d+\/\d+\/\d+\/\d+\/\d+ \d+\/\d+ ' \
r'"GET /test-path/deeper HTTP/1.1"'
self.assertLastLogLineRegexp(
'_Url_access_log',
r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} - - '
r'\[\d{2}\/.{3}\/\d{4}\:\d{2}\:\d{2}\:\d{2} \+\d{4}\] '
r'"GET \/test-path\/deep\/..\/.\/deeper HTTP\/1.1" \d{3} '
r'\d+ "-" "TEST USER AGENT" \d+'
)
self.assertRegexpMatches(
open(log_file, 'r').readlines()[-1],
log_regexp)
self.assertLastLogLineRegexp(
'_Url_backend_log',
r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+ '
r'\[\d{2}\/.{3}\/\d{4}\:\d{2}\:\d{2}\:\d{2}.\d{3}\] '
r'http-backend _Url-http\/_Url-backend '
r'\d+/\d+\/\d+\/\d+\/\d+ '
r'200 \d+ - - ---- '
r'\d+\/\d+\/\d+\/\d+\/\d+ \d+\/\d+ '
r'"GET /test-path/deeper HTTP/1.1"'
)
result_http = fakeHTTPResult(
parameter_dict['domain'],
......@@ -7322,9 +7329,32 @@ backend _health-check-default-http
self.assertEqualResultJson(
result, 'Path', '/failover-https-url?a=b&c=/failoverpath')
self.assertLastLogLineRegexp(
'_health-check-failover-url_backend_log',
r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+ '
r'\[\d{2}\/.{3}\/\d{4}\:\d{2}\:\d{2}\:\d{2}.\d{3}\] '
r'https-backend _health-check-failover-url-https-failover'
r'\/_health-check-failover-url-backend '
r'\d+/\d+\/\d+\/\d+\/\d+ '
r'200 \d+ - - ---- '
r'\d+\/\d+\/\d+\/\d+\/\d+ \d+\/\d+ '
r'"GET /failoverpath HTTP/1.1"'
)
result = fakeHTTPResult(parameter_dict['domain'], '/failoverpath')
self.assertEqualResultJson(
result, 'Path', '/failover-url?a=b&c=/failoverpath')
self.assertLastLogLineRegexp(
'_health-check-failover-url_backend_log',
r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+ '
r'\[\d{2}\/.{3}\/\d{4}\:\d{2}\:\d{2}\:\d{2}.\d{3}\] '
r'http-backend _health-check-failover-url-http-failover'
r'\/_health-check-failover-url-backend '
r'\d+/\d+\/\d+\/\d+\/\d+ '
r'200 \d+ - - ---- '
r'\d+\/\d+\/\d+\/\d+\/\d+ \d+\/\d+ '
r'"GET /failoverpath HTTP/1.1"'
)
def test_health_check_failover_url_auth_to_backend(self):
parameter_dict = self.assertSlaveBase(
......
......@@ -15,7 +15,7 @@
# not need these here).
[instance-caucased]
filename = instance-caucased.cfg.jinja2
md5sum = 8081efb41f12592033283db9841178ea
md5sum = 2e7c1d8c553b398dd68c875a9fa38cdb
[instance]
filename = instance.cfg.jinja2
......
......@@ -6,6 +6,7 @@ recipe = slapos.cookbook:mkdirectory
etc = ${buildout:directory}/etc
service-on-watch = ${:etc}/service
srv = ${buildout:directory}/srv
tmp = ${buildout:directory}/tmp
{{ caucase.caucased(
prefix='caucased',
......@@ -13,6 +14,7 @@ srv = ${buildout:directory}/srv
caucased_path='${directory:service-on-watch}/caucased',
data_dir='${directory:srv}/caucased',
netloc=netloc,
tmp='%{directory:tmp}',
service_auto_approve_count=slapparameter_dict.get('service-auto-approve-amount', 0),
user_auto_approve_count=slapparameter_dict.get('user-auto-approve-amount', 1),
key_len=slapparameter_dict.get('key-length', 2048),
......
......@@ -14,7 +14,7 @@
# not need these here).
[template-erp5]
filename = instance-erp5.cfg.in
md5sum = eba73f868a5bbfb942323eadcd88cb16
md5sum = c341609c8d0cfe240a3a2ae35bd713b6
[template-balancer]
filename = instance-balancer.cfg.in
......
......@@ -89,6 +89,7 @@ backup-caucased = ${:srv}/backup/caucased
backup_dir='${directory:backup-caucased}',
data_dir='${directory:srv}/caucased',
netloc=caucase_netloc,
tmp='${directory:tmp}',
service_auto_approve_count=caucase_dict.get('service-auto-approve-amount', 1),
user_auto_approve_count=caucase_dict.get('user-auto-approve-amount', 0),
key_len=caucase_dict.get('key-length', 2048),
......@@ -252,7 +253,7 @@ config-wendelin-core-zblk-fmt = {{ dumps(slapparameter_dict.get('wendelin-core-z
config-wsgi = {{ dumps(slapparameter_dict.get('wsgi', True)) }}
config-test-runner-enabled = {{ dumps(test_runner_enabled) }}
config-test-runner-node-count = {{ dumps(test_runner_node_count) }}
config-wcfs_enable = {{ wcfs_enable }}
config-wcfs_enable = {{ dumps(wcfs_enable) }}
software-type = zope
{% set global_publisher_timeout = slapparameter_dict.get('publisher-timeout') -%}
......@@ -374,6 +375,7 @@ ca-dir = ${buildout:directory}/srv/ssl
{% endif -%}
bin = ${buildout:directory}/bin
etc = ${buildout:directory}/etc
tmp = ${buildout:directory}/tmp
services = ${:etc}/run
requests = ${:ca-dir}/requests
private = ${:ca-dir}/private
......
[buildout]
extends =
../../software/erp5/software.cfg
../../component/wendelin.core/activate-WC2-preview.cfg
buildout.hash.cfg
parts +=
......@@ -14,6 +15,8 @@ parts +=
[ZODB]
major = 4-wc2
[erp5-defaults]
wcfs-enable-default = true
[local-bt5-repository]
# Same as bt5-repository, but only local repository.
......
......@@ -296,6 +296,7 @@ tests =
fluentd ${slapos.test.fluentd-setup:setup}
kvm ${slapos.test.kvm-setup:setup}
slaprunner ${slapos.test.slaprunner-setup:setup}
theia ${slapos.test.theia-setup:setup}
metabase ${slapos.test.metabase-setup:setup}
###
${:extra}
......@@ -314,7 +315,6 @@ extra =
jstestnode ${slapos.test.jstestnode-setup:setup}
nextcloud ${slapos.test.nextcloud-setup:setup}
turnserver ${slapos.test.turnserver-setup:setup}
theia ${slapos.test.theia-setup:setup}
grafana ${slapos.test.grafana-setup:setup}
gitlab ${slapos.test.gitlab-setup:setup}
cloudooo ${slapos.test.cloudooo-setup:setup}
......
......@@ -14,29 +14,29 @@
# not need these here).
[instance-theia]
filename = instance-theia.cfg.jinja.in
md5sum = 65c66a4cc4eb1d074dcafddf945a34d4
_update_hash_filename_ = instance-theia.cfg.jinja.in
md5sum = 942e269192d284e563a84ae710c0595b
[instance]
filename = instance.cfg.in
md5sum = 43923e3e1f27c43696ecbca9ee147bdb
_update_hash_filename_ = instance.cfg.in
md5sum = 9a5d6ac099c460481af7c1bdfd8de770
[yarn.lock]
filename = yarn.lock
_update_hash_filename_ = yarn.lock
md5sum = 80e7ad91deea54cebcccef5a83fdb380
[python-language-server-requirements.txt]
filename = python-language-server-requirements.txt
_update_hash_filename_ = python-language-server-requirements.txt
md5sum = 9f478fd1b03b7738f3de549cb899bf54
[preloadTemplate.html]
filename = preloadTemplate.html
_update_hash_filename_ = preloadTemplate.html
md5sum = 8157c22134200bd862a07c6521ebf799
[slapos.css.in]
filename = slapos.css.in
_update_hash_filename_ = slapos.css.in
md5sum = d2930ec3ef973b7908f0fa896033fd64
[logo.png]
filename = logo.png
_update_hash_filename_ = logo.png
md5sum = 97bd0f828ffbac2681af0f4bd72cba27
......@@ -23,6 +23,47 @@
"title": "Embedded Software Type",
"description": "Type of the optional embedded software",
"type": "string"
},
"embedded-instance-parameters": {
"title": "Embedded Instance Parameters",
"description": "Parameters for the embedded instance, as a JSON dict",
"type": "string"
},
"frontend-guid": {
"title": "Frontend Instance ID",
"description": "Unique identifier of the frontend instance, like \"SOFTINST-11031\".",
"type": "string"
},
"frontend-sr": {
"title": "Frontend Software URL",
"description": "Software Release URL of the frontend instance, like \"http://example.com/path/to/software.cfg\".",
"type": "string",
"format": "uri",
"default": "http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg"
},
"frontend-sr-type": {
"title": "Frontend Software Type",
"description": "Type of the frontend instance, like \"frontend\".",
"type": "string",
"default": "RootSoftwareInstance"
},
"additional-frontend-guid": {
"title": "Additional Frontend Instance ID",
"description": "Unique identifier of the additional frontend instance, like \"SOFTINST-11031\", if empty won't be requested.",
"type": "string"
},
"additional-frontend-sr": {
"title": "Additional Frontend Software URL",
"description": "Software Release URL of the frontend instance, like \"http://example.com/path/to/software.cfg\".",
"type": "string",
"format": "uri",
"default": "http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg"
},
"additional-frontend-sr-type": {
"title": "Additional Frontend Software Type",
"description": "Type of the frontend instance, like \"frontend\".",
"type": "string",
"default": "RootSoftwareInstance"
}
}
}
{% set additional_frontend = slapconfiguration_section['configuration.additional-frontend-guid'] %}
{% set parameter_dict = dict(default_parameter_dict, **parameter_dict) %}
{% set additional_frontend = parameter_dict['additional-frontend-guid'] %}
[buildout]
extends =
......@@ -26,12 +27,6 @@ develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[instance-parameter]
{% for k, v in slapconfiguration_section.items() -%}
{{ k }} = {{ v }}
{% endfor -%}
[publish-connection-parameter]
<= monitor-publish
recipe = slapos.cookbook:publish
......@@ -142,18 +137,18 @@ return = domain secure_access
[remote-frontend]
<= remote-frontend-base
name = $${instance-parameter:configuration.frontend-name}
software-url = $${instance-parameter:configuration.frontend-sr}
software-type = $${instance-parameter:configuration.frontend-sr-type}
sla-instance_guid = $${instance-parameter:configuration.frontend-guid}
name = {{ parameter_dict['frontend-name'] }}
software-url = {{ parameter_dict['frontend-sr'] }}
software-type = {{ parameter_dict['frontend-sr-type'] }}
sla-instance_guid = {{ parameter_dict['frontend-guid'] }}
{% if additional_frontend %}
[remote-additional-frontend]
<= remote-frontend-base
name = $${instance-parameter:configuration.additional-frontend-name}
software-url = $${instance-parameter:configuration.additional-frontend-sr}
software-type = $${instance-parameter:configuration.additional-frontend-sr-type}
sla-instance_guid = $${instance-parameter:configuration.additional-frontend-guid}
name = {{ parameter_dict['additional-frontend-name'] }}
software-url = {{ parameter_dict['additional-frontend-sr'] }}
software-type = {{ parameter_dict['additional-frontend-sr-type'] }}
sla-instance_guid = {{ parameter_dict['additional-frontend-guid'] }}
{% endif %}
......@@ -169,7 +164,7 @@ bytes = 12
recipe = slapos.cookbook:free_port
minimum = 3000
maximum = 3100
ip = $${instance-parameter:ipv6-random}
ip = {{ ipv6_random }}
[frontend-instance-certificate]
recipe = plone.recipe.command
......@@ -311,9 +306,6 @@ mode = 0700
template =
inline:
#!/bin/sh
. ${gowork:env.sh}
# reset PS1 from gowork
export PS1='$ '
export HOME=$${buildout:directory}
export PATH=${python-language-server:location}/bin:${java-jdk:location}/bin:${cli-utilities:PATH}:$HOME/.cargo/bin:$PATH
......@@ -325,7 +317,7 @@ template =
recipe = slapos.cookbook:free_port
minimum = 3500
maximum = 3600
ip = $${instance-parameter:ipv4-random}
ip = {{ ipv4_random }}
[theia-service]
recipe = slapos.recipe.template:jinja2
......@@ -336,6 +328,7 @@ template =
{{ "{% raw %}" }}
{% raw %}
export THEIA_WEBVIEW_EXTERNAL_ENDPOINT='{{hostname}}'
export THEIA_MINI_BROWSER_HOST_PATTERN='{{hostname}}'
{% endraw %}
{{ "{% endraw %}" }}
export THEIA_OPEN_EDITOR_TOKEN=$(${openssl:location}/bin/openssl rand -hex 32)
......@@ -360,7 +353,7 @@ command-line = $${theia-service:rendered} --hostname=$${:hostname} --port=$${:p
hash-existing-files =
${yarn.lock:output}
${theia-wrapper:rendered}
ip = $${instance-parameter:ipv4-random}
ip = {{ ipv4_random }}
hostname = $${:ip}
port = $${theia-service:port}
base-url = $${theia-service:base-url}
......@@ -416,11 +409,11 @@ command =
recipe = slapos.cookbook:free_port
minimum = 4000
maximum = 4100
ip = $${instance-parameter:ipv4-random}
ip = {{ ipv4_random }}
[slapos-standalone-config]
ipv4 = $${instance-parameter:ipv4-random}
ipv6 = $${instance-parameter:ipv6-random}
ipv4 = {{ ipv4_random }}
ipv6 = {{ ipv6_random }}
port = $${slapos-standalone-port:port}
slapos-configuration = $${directory:runner}/etc/slapos.cfg
computer-id = slaprunner
......@@ -451,8 +444,11 @@ template =
$${slapos-standalone-config:ipv6} \
$${slapos-standalone-config:port} \
$${slapos-standalone-config:computer-id} \
--sr='$${instance-parameter:configuration.embedded-sr}' \
--srtype='$${instance-parameter:configuration.embedded-sr-type}' \
{% if parameter_dict.get('embedded-sr') %} \
--sr='{{ parameter_dict['embedded-sr'] }}' \
--srtype='{{ parameter_dict['embedded-sr-type'] }}' \
--srparams='$${embedded-instance-parameters:rendered}' \
{% endif %} \
$${slap-connection:server-url} \
$${slap-connection:computer-id} \
$${slap-connection:partition-id} \
......@@ -482,7 +478,7 @@ command =
update-command = $${:command}
service-name = slapos-node-auto
supervisor-conf = $${directory:runner}/etc/supervisord.conf
autorun = $${instance-parameter:configuration.autorun}
autorun = {{ parameter_dict['autorun'] }}
# Theia Local Environment Setup
......@@ -579,6 +575,14 @@ recipe = slapos.cookbook:symbolic.link
target-directory = $${directory:project}
link-binary = $${directory:runner}
{% if parameter_dict.get('embedded-sr') -%}
[embedded-instance-parameters]
recipe = slapos.recipe.template:jinja2
rendered = $${directory:etc}/$${:_buildout_section_name_}.json
template =
inline:{{ parameter_dict['embedded-instance-parameters'] | indent(2) }}
{%- endif %}
[request-script-template]
recipe = slapos.recipe.template:jinja2
rendered = $${directory:project}/$${:_buildout_section_name_}.sh
......
......@@ -12,20 +12,6 @@ partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}
;Theia default configuration
configuration.autorun = running
configuration.embedded-sr =
configuration.embedded-sr-type =
;Frontend default configuration
configuration.frontend-name = Theia Frontend
configuration.frontend-sr = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
configuration.frontend-sr-type = RootSoftwareInstance
configuration.frontend-guid =
;Additional frontend default configuration
configuration.additional-frontend-name = Theia Additional Frontend
configuration.additional-frontend-sr = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
configuration.additional-frontend-sr-type = RootSoftwareInstance
configuration.additional-frontend-guid =
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
......@@ -39,4 +25,23 @@ template = ${instance-theia:output}
rendered = $${buildout:directory}/instance-theia.cfg
mode = 0644
context =
section slapconfiguration_section slap-configuration
jsonkey default_parameter_dict :default-parameters
key parameter_dict slap-configuration:configuration
key ipv6_random slap-configuration:ipv6-random
key ipv4_random slap-configuration:ipv4-random
default-parameters =
{
"autorun": "running",
"embedded-sr": null,
"embedded-sr-type": null,
"embedded-instance-parameters": "null",
"frontend-name": "Theia Frontend",
"frontend-sr": "$${:frontend-sr}",
"frontend-sr-type": "RootSoftwareInstance",
"frontend-guid": null,
"additional-frontend-name":"Theia Additional Frontend",
"additional-frontend-sr": "$${:frontend-sr}",
"additional-frontend-sr-type": "RootSoftwareInstance",
"additional-frontend-guid": null
}
frontend-sr = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
[buildout]
extends =
software.cfg
[python]
part = python3
......@@ -53,6 +53,7 @@ entry-points =
initialization =
import argparse
import glob
import json
import os.path
import sys
import signal
......@@ -68,6 +69,7 @@ initialization =
parser.add_argument('computer_id')
parser.add_argument('--sr')
parser.add_argument('--srtype')
parser.add_argument('--srparams')
forwarded_arguments = parser.add_argument_group('forwarded')
forwarded_arguments.add_argument('master_url')
forwarded_arguments.add_argument('computer')
......@@ -118,9 +120,24 @@ initialization =
print("Error instanciating: {}".format(e))
if args.sr:
print("Supplying and Requesting Embedded Software {}".format(args.sr))
try:
with open(args.srparams) as f:
params = json.load(f)
except Exception:
params = None
if not isinstance(params, dict):
params = None
print("Supplying and Requesting Embedded Software {sr} with type {srtype}".format(
sr=args.sr, srtype=args.srtype))
print("With parameters {param_dict} parsed from '{srparams}'".format(
param_dict=params, srparams=args.srparams))
standalone.supply(args.sr)
standalone.request(args.sr, "Embedded Instance", args.srtype or None)
standalone.request(
args.sr,
"Embedded Instance",
args.srtype or None,
partition_parameter_kw=params,
)
quit_requested = []
def signal_handler(signum, frame):
......@@ -149,9 +166,14 @@ eggs =
[template-base]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
url = ${:_profile_base_location_}/${:_update_hash_filename_}
output = ${buildout:parts-directory}/${:_buildout_section_name_}
mode = 0644
[download-base]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_update_hash_filename_}
destination = ${buildout:directory}/${:_buildout_section_name_}
output = ${:destination}
[python-language-server]
version = 0.19.0
......@@ -164,7 +186,7 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_}
stop-on-error = true
[python-language-server-requirements.txt]
<= template-base
<= download-base
[theia]
recipe = plone.recipe.command
......@@ -194,16 +216,16 @@ install =
os.chmod(destination_dir, 0o750)
[yarn.lock]
<= template-base
<= download-base
[preloadTemplate.html]
<= template-base
<= download-base
[slapos.css.in]
<= template-base
<= download-base
[logo.png]
<= template-base
<= download-base
[package.json]
recipe = slapos.recipe.template:jinja2
......@@ -293,7 +315,6 @@ template =
}
}
rendered = ${buildout:directory}/${:_buildout_section_name_}
mode = 0644
[gowork]
......@@ -308,7 +329,6 @@ PATH = ${nodejs:location}/bin:${bash:location}/bin:${fish-shell:location}/bin:${
[theia-wrapper]
recipe = slapos.recipe.template:jinja2
rendered = ${buildout:bin-directory}/${:_buildout_section_name_}
mode = 0755
template =
inline:
#!/bin/sh
......@@ -318,7 +338,6 @@ template =
[theia-open]
recipe = slapos.recipe.template:jinja2
rendered = ${buildout:bin-directory}/${:_buildout_section_name_}
mode = 0755
template =
inline:
#!/bin/sh
......
......@@ -40,15 +40,17 @@ import pexpect
import psutil
import requests
import sqlite3
import six
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
from slapos.grid.svcbackend import getSupervisorRPC
from slapos.grid.svcbackend import _getSupervisordSocketPath
software_cfg = 'software%s.cfg' % ('-py3' if six.PY3 else '')
setUpModule, SlapOSInstanceTestCase = makeModuleSetUpAndTestCaseClass(
os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', 'software.cfg')))
os.path.join(os.path.dirname(__file__), '..', software_cfg)))
class TheiaTestCase(SlapOSInstanceTestCase):
......@@ -190,9 +192,9 @@ class TestTheia(TheiaTestCase):
def test_slapos_cli(self):
slapos = self._getSlapos()
proxy_show_output = subprocess.check_output((slapos, 'proxy', 'show'))
self.assertIn('slaprunner', proxy_show_output)
self.assertIn(b'slaprunner', proxy_show_output)
computer_list_output = subprocess.check_output((slapos, 'computer', 'list'))
self.assertIn('slaprunner', computer_list_output)
self.assertIn(b'slaprunner', computer_list_output)
class TestTheiaEmbeddedSlapOSShutdown(TheiaTestCase):
......@@ -230,22 +232,27 @@ class TestTheiaEmbeddedSlapOSShutdown(TheiaTestCase):
class TestTheiaWithSR(TheiaTestCase):
sr_url = 'bogus/software.cfg'
sr_type = 'bogus_type'
instance_parameters = '{\n"bogus_param": "bogus_value"\n}'
@classmethod
def getInstanceParameterDict(cls):
return {
'embedded-sr': cls.sr_url,
'embedded-sr-type': cls.sr_type,
'embedded-instance-parameters': cls.instance_parameters
}
def test(self):
slapos = self._getSlapos()
info = subprocess.check_output((slapos, 'proxy', 'show'))
info = subprocess.check_output((slapos, 'proxy', 'show'), universal_newlines=True)
instance_name = "Embedded Instance"
self.assertIsNotNone(re.search(r"%s\s+slaprunner\s+available" % (self.sr_url,), info), info)
self.assertIsNotNone(re.search(r"%s\s+%s\s+%s" % (self.sr_url, self.sr_type, instance_name), info), info)
service_info = subprocess.check_output((slapos, 'service', 'info', instance_name), universal_newlines=True)
self.assertIn("{'bogus_param': 'bogus_value'}", service_info)
class TestTheiaFrontend(TheiaTestCase):
@classmethod
......
......@@ -15,4 +15,4 @@
[caucase-jinja2-library]
filename = caucase.jinja2.library
md5sum = b8a5a93b8a7bacd6ebd4b6df24c7c828
md5sum = 27aba89543032f3c7026ab566f3aa41b
......@@ -4,6 +4,7 @@
caucased_path,
data_dir,
netloc,
tmp,
service_auto_approve_count=0,
user_auto_approve_count=1,
key_len=None,
......@@ -18,6 +19,11 @@ mode = 0750
[{{ prefix }}]
recipe = slapos.cookbook:wrapper
wrapper-path = {{ caucased_path }}
{%- if tmp %}
environment =
TMP={{ tmp }}
TMPDIR={{ tmp }}
{%- endif %}
command-line = '{{ buildout_bin_directory }}/caucased'
--db '${ {{- prefix }}-directory:data-dir}/caucase.sqlite'
--server-key '${ {{- prefix }}-directory:data-dir}/server.key.pem'
......
......@@ -74,7 +74,7 @@ md5sum = 8bd7f89b7c1e453ecc952659a01347e6
[template-erp5]
filename = instance-erp5.cfg.in
md5sum = 79f092c54998918423257f4b676425ea
md5sum = f33e82cb68924decb77142b79dce4fab
[template-zeo]
filename = instance-zeo.cfg.in
......
......@@ -71,6 +71,7 @@ recipe = slapos.cookbook:mkdirectory
bin = ${buildout:directory}/bin
service-on-watch = ${buildout:directory}/etc/service
srv = ${buildout:directory}/srv
tmp = {$buildout:directory}/tmp
backup-caucased = ${:srv}/backup/caucased
{% if not caucase_url -%}
......@@ -89,6 +90,7 @@ backup-caucased = ${:srv}/backup/caucased
backup_dir='${directory:backup-caucased}',
data_dir='${directory:srv}/caucased',
netloc=caucase_netloc,
tmp='${directory:tmp}',
service_auto_approve_count=caucase_dict.get('service-auto-approve-amount', 1),
user_auto_approve_count=caucase_dict.get('user-auto-approve-amount', 0),
key_len=caucase_dict.get('key-length', 2048),
......@@ -257,7 +259,7 @@ config-wendelin-core-zblk-fmt = {{ dumps(slapparameter_dict.get('wendelin-core-z
config-wsgi = {{ dumps(slapparameter_dict.get('wsgi', True)) }}
config-test-runner-enabled = {{ dumps(test_runner_enabled) }}
config-test-runner-node-count = {{ dumps(test_runner_node_count) }}
config-wcfs_enable = {{ wcfs_enable }}
config-wcfs_enable = {{ dumps(wcfs_enable) }}
software-type = zope
{% set global_publisher_timeout = slapparameter_dict.get('publisher-timeout') -%}
......
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