Commit e63c9c59 authored by Xavier Thompson's avatar Xavier Thompson

software/theia: Add frontend configuration options

parent cb40e46f
......@@ -15,11 +15,11 @@
[instance-theia]
filename = instance-theia.cfg.jinja.in
md5sum = a5a7db274eb11c022a12142fabc9a355
md5sum = 65c66a4cc4eb1d074dcafddf945a34d4
[instance]
filename = instance.cfg.in
md5sum = eb4ee219603da65b748cb912685b9b17
md5sum = 43923e3e1f27c43696ecbca9ee147bdb
[yarn.lock]
filename = yarn.lock
......
{% set additional_frontend = slapconfiguration_section['configuration.additional-frontend-guid'] %}
[buildout]
extends =
${monitor-template:rendered}
......@@ -33,7 +35,10 @@ offline = true
[publish-connection-parameter]
<= monitor-publish
recipe = slapos.cookbook:publish
url = $${apache-frontend:connection-secure_access}
url = $${remote-frontend:connection-secure_access}
{% if additional_frontend %}
additional-url = $${remote-additional-frontend:connection-secure_access}
{% endif %}
username = $${frontend-instance-password:username}
password = $${frontend-instance-password:passwd}
backend-url = $${frontend-instance:url}
......@@ -68,7 +73,10 @@ recipe =
instance-promises =
$${theia-listen-promise:name}
$${frontend-listen-promise:name}
$${apache-frontend-url-available-promise:name}
$${remote-frontend-url-available-promise:name}
{% if additional_frontend %}
$${remote-additional-frontend-url-available-promise:name}
{% endif %}
$${slapos-standalone-listen-promise:name}
$${slapos-autorun-promise:name}
......@@ -86,13 +94,22 @@ name = $${:_buildout_section_name_}.py
config-hostname = $${frontend-instance:ip}
config-port = $${frontend-instance:port}
[apache-frontend-url-available-promise]
[remote-frontend-url-available-promise]
<= monitor-promise-base
module = check_url_available
name = $${:_buildout_section_name_}.py
config-url = $${apache-frontend:connection-secure_access}
config-url = $${remote-frontend:connection-secure_access}
config-check-secure = 1
{% if additional_frontend %}
[remote-additional-frontend-url-available-promise]
<= monitor-promise-base
module = check_url_available
name = $${:_buildout_section_name_}.py
config-url = $${remote-additional-frontend:connection-secure_access}
config-check-secure = 1
{% endif %}
[slapos-standalone-listen-promise]
<= monitor-promise-base
module = check_port_listening
......@@ -110,15 +127,12 @@ config-service = $${slapos-autorun:service-name}
config-expect = $${slapos-autorun:autorun}
# Remote Apache Frontend
# ----------------------
# Remote Caddy Frontend
# ---------------------
[apache-frontend]
[remote-frontend-base]
<= slap-connection
recipe = slapos.cookbook:requestoptional
name = Theia Frontend
# XXX We have hardcoded SR URL here.
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
slave = true
config-url = $${frontend-instance:url}
config-https-only = true
......@@ -126,6 +140,22 @@ config-type = websocket
config-websocket-path-list = /services /file-upload
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}
{% 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}
{% endif %}
# Local Caddy Frontend
# --------------------
......
......@@ -12,9 +12,20 @@ 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
......
......@@ -247,6 +247,22 @@ class TestTheiaWithSR(TheiaTestCase):
self.assertIsNotNone(re.search(r"%s\s+%s\s+%s" % (self.sr_url, self.sr_type, instance_name), info), info)
class TestTheiaFrontend(TheiaTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {
'additional-frontend-guid': 'SOMETHING'
}
def setUp(self):
self.connection_parameters = self.computer_partition.getConnectionParameterDict()
def test_http_get(self):
for key in ('url', 'additional-url'):
resp = requests.get(self.connection_parameters[key], verify=False)
self.assertEqual(requests.codes.unauthorized, resp.status_code)
class TestTheiaEnv(TheiaTestCase):
dummy_software_path = os.path.abspath('dummy/software.cfg')
......
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