Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Roque
slapos
Commits
1aa17677
Commit
1aa17677
authored
Jul 05, 2023
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Plain Diff
software/theia: Use IPv6 range when available
See merge request
!1403
parents
63078069
1cbfa70e
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
26 deletions
+49
-26
software/slapos-sr-testing/buildout.hash.cfg
software/slapos-sr-testing/buildout.hash.cfg
+1
-1
software/slapos-sr-testing/instance.cfg
software/slapos-sr-testing/instance.cfg
+10
-3
software/theia/buildout.hash.cfg
software/theia/buildout.hash.cfg
+3
-3
software/theia/instance-theia.cfg.jinja.in
software/theia/instance-theia.cfg.jinja.in
+5
-5
software/theia/instance.cfg.in
software/theia/instance.cfg.in
+2
-1
software/theia/slapos_standalone_script.py.jinja
software/theia/slapos_standalone_script.py.jinja
+11
-11
software/theia/test/test.py
software/theia/test/test.py
+14
-0
software/theia/test/test_resiliency.py
software/theia/test/test_resiliency.py
+2
-1
stack/slapos.cfg
stack/slapos.cfg
+1
-1
No files found.
software/slapos-sr-testing/buildout.hash.cfg
View file @
1aa17677
...
@@ -15,4 +15,4 @@
...
@@ -15,4 +15,4 @@
[template]
[template]
filename = instance.cfg
filename = instance.cfg
md5sum =
06379c0ed1fe0df409c7b8f61fc218eb
md5sum =
ed0f91f39d5eda903938aa527625f40d
software/slapos-sr-testing/instance.cfg
View file @
1aa17677
...
@@ -28,13 +28,20 @@ test-working-dir = ${buildout:directory}/tmp
...
@@ -28,13 +28,20 @@ test-working-dir = ${buildout:directory}/tmp
nxdtest-working-dir = ${:var}/nxdtest
nxdtest-working-dir = ${:var}/nxdtest
[slapos-test-runner-nxdtest-environment.sh]
[slapos-test-runner-nxdtest-environment.sh]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
:jinja2
output = ${directory:etc}/${:_buildout_section_name_}
output = ${directory:etc}/${:_buildout_section_name_}
PATH={{ buildout['bin-directory'] }}:{{ curl_location }}/bin:{{ faketime_location }}/bin:{{ openssl_location }}/bin:/usr/bin:/bin
context =
section slap slap-configuration
key ipv6_random slap-configuration:ipv6-random
{%- raw %}
inline =
inline =
export PATH=
{{ buildout['bin-directory'] }}:{{ curl_location }}/bin:{{ faketime_location }}/bin:{{ openssl_location }}/bin:/usr/bin:/bin
export PATH=
${:PATH}
export SLAPOS_TEST_IPV4=${slap-configuration:ipv4-random}
export SLAPOS_TEST_IPV4=${slap-configuration:ipv4-random}
export SLAPOS_TEST_IPV6=
${slap-configuration:ipv6-random
}
export SLAPOS_TEST_IPV6=
{{ slap.get('ipv6-range-network') or ipv6_random }
}
export SLAPOS_TEST_WORKING_DIR=${directory:test-working-dir}
export SLAPOS_TEST_WORKING_DIR=${directory:test-working-dir}
{%- endraw %}
[slapos-test-runner-dot-nxdtest]
[slapos-test-runner-dot-nxdtest]
recipe = slapos.recipe.template:jinja2
recipe = slapos.recipe.template:jinja2
...
...
software/theia/buildout.hash.cfg
View file @
1aa17677
...
@@ -15,11 +15,11 @@
...
@@ -15,11 +15,11 @@
[instance-theia]
[instance-theia]
_update_hash_filename_ = instance-theia.cfg.jinja.in
_update_hash_filename_ = instance-theia.cfg.jinja.in
md5sum =
a9d4ace568acdd5002d587816ab91737
md5sum =
d8fa4bed6b7d7c77b0aec53abae32426
[instance]
[instance]
_update_hash_filename_ = instance.cfg.in
_update_hash_filename_ = instance.cfg.in
md5sum =
08b8aa2b7f59ac0e4e5d4ca18005493
7
md5sum =
f322033a7670b9be29b1bf1bf9024b8
7
[instance-import]
[instance-import]
_update_hash_filename_ = instance-import.cfg.jinja.in
_update_hash_filename_ = instance-import.cfg.jinja.in
...
@@ -35,7 +35,7 @@ md5sum = ad9499e7355ded4975ad313442cecb7a
...
@@ -35,7 +35,7 @@ md5sum = ad9499e7355ded4975ad313442cecb7a
[slapos-standalone-script]
[slapos-standalone-script]
_update_hash_filename_ = slapos_standalone_script.py.jinja
_update_hash_filename_ = slapos_standalone_script.py.jinja
md5sum =
6792d29057db35ea69b01e72a5c913e3
md5sum =
93c492cc5c186989f104f37de43f25c5
[theia-common]
[theia-common]
_update_hash_filename_ = theia_common.py
_update_hash_filename_ = theia_common.py
...
...
software/theia/instance-theia.cfg.jinja.in
View file @
1aa17677
...
@@ -38,7 +38,7 @@ additional-url = $${remote-additional-frontend:connection-secure_access}
...
@@ -38,7 +38,7 @@ additional-url = $${remote-additional-frontend:connection-secure_access}
username = $${frontend-instance-password:username}
username = $${frontend-instance-password:username}
password = $${frontend-instance-password:passwd}
password = $${frontend-instance-password:passwd}
backend-url = $${frontend-instance:url}
backend-url = $${frontend-instance:url}
ipv6 = {{ ipv6_
random
}}
ipv6 = {{ ipv6_
theia
}}
[directory]
[directory]
recipe = slapos.cookbook:mkdirectory
recipe = slapos.cookbook:mkdirectory
...
@@ -227,7 +227,7 @@ storage-path = $${buildout:parts-directory}/.$${:_buildout_section_name_}
...
@@ -227,7 +227,7 @@ storage-path = $${buildout:parts-directory}/.$${:_buildout_section_name_}
recipe = slapos.cookbook:free_port
recipe = slapos.cookbook:free_port
minimum = 3000
minimum = 3000
maximum = 3100
maximum = 3100
ip = {{ ipv6_
random
}}
ip = {{ ipv6_
theia
}}
[frontend-instance-certificate]
[frontend-instance-certificate]
recipe = plone.recipe.command
recipe = plone.recipe.command
...
@@ -421,7 +421,7 @@ inline =
...
@@ -421,7 +421,7 @@ inline =
#!/bin/sh
#!/bin/sh
export HOME=$${directory:home}
export HOME=$${directory:home}
export PATH=${cli-utilities:PATH}:$HOME/.cargo/bin:$HOME/.local/bin:$PATH
export PATH=${cli-utilities:PATH}:$HOME/.cargo/bin:$HOME/.local/bin:$PATH
export IPV6_SLAPRUNNER={{ ipv6_
random
}}
export IPV6_SLAPRUNNER={{ ipv6_
theia
}}
# Theia Backend
# Theia Backend
# -------------
# -------------
...
@@ -566,7 +566,7 @@ ip = {{ ipv4_random }}
...
@@ -566,7 +566,7 @@ ip = {{ ipv4_random }}
[slapos-standalone-config]
[slapos-standalone-config]
ipv4 = {{ ipv4_random }}
ipv4 = {{ ipv4_random }}
ipv6 = {{
ipv6_random
}}
ipv6 = {{
slap_resource.get('ipv6-range-network') or ipv6_theia
}}
port = $${slapos-standalone-port:port}
port = $${slapos-standalone-port:port}
base-directory = $${directory:runner}
base-directory = $${directory:runner}
software-root = $${directory:runner}/software
software-root = $${directory:runner}/software
...
@@ -603,7 +603,7 @@ context =
...
@@ -603,7 +603,7 @@ context =
key home_path directory:home
key home_path directory:home
key forward_frontend_requests :forward-frontend-requests
key forward_frontend_requests :forward-frontend-requests
section slap_connection slap-connection
section slap_connection slap-connection
section
slapos_standalone_
config slapos-standalone-config
section config slapos-standalone-config
forward-frontend-requests = {{ parameter_dict['forward-slapos-frontend-requests'] }}
forward-frontend-requests = {{ parameter_dict['forward-slapos-frontend-requests'] }}
url = ${slapos-standalone-script:output}
url = ${slapos-standalone-script:output}
...
...
software/theia/instance.cfg.in
View file @
1aa17677
...
@@ -37,8 +37,9 @@ context =
...
@@ -37,8 +37,9 @@ context =
key parameter_dict slap-configuration:configuration
key parameter_dict slap-configuration:configuration
key root_title slap-configuration:root-instance-title
key root_title slap-configuration:root-instance-title
key partition_root_path buildout:directory
key partition_root_path buildout:directory
key ipv6_
random
slap-configuration:ipv6-random
key ipv6_
theia
slap-configuration:ipv6-random
key ipv4_random slap-configuration:ipv4-random
key ipv4_random slap-configuration:ipv4-random
section slap_resource slap-configuration
import os os
import os os
import json json
import json json
default-parameters =
default-parameters =
...
...
software/theia/slapos_standalone_script.py.jinja
View file @
1aa17677
...
@@ -70,23 +70,23 @@ def setupStandalone():
...
@@ -70,23 +70,23 @@ def setupStandalone():
shared_parts = {{ repr(shared_part_list) }}
shared_parts = {{ repr(shared_part_list) }}
shared_part_list = [x.strip() for x in shared_parts.splitlines() if x.strip()]
shared_part_list = [x.strip() for x in shared_parts.splitlines() if x.strip()]
standalone = slapos.slap.standalone.StandaloneSlapOS(
standalone = slapos.slap.standalone.StandaloneSlapOS(
{{ repr(
slapos_standalone_
config['base-directory']) }},
{{ repr(config['base-directory']) }},
{{ repr(
slapos_standalone_
config['ipv4']) }},
{{ repr(config['ipv4']) }},
{{
slapos_standalone_
config['port'] }},
{{ config['port'] }},
computer_id={{ repr(
slapos_standalone_
config['computer-id']) }},
computer_id={{ repr(config['computer-id']) }},
shared_part_list=shared_part_list,
shared_part_list=shared_part_list,
software_root={{ repr(
slapos_standalone_
config['software-root']) }},
software_root={{ repr(config['software-root']) }},
instance_root={{ repr(
slapos_standalone_
config['instance-root']) }},
instance_root={{ repr(config['instance-root']) }},
partition_forward_configuration=partition_forward_configuration,
partition_forward_configuration=partition_forward_configuration,
slapos_bin={{ repr(
slapos_standalone_
config['slapos-bin']) }},
slapos_bin={{ repr(config['slapos-bin']) }},
local_software_release_root={{ repr(
slapos_standalone_
config['local-software-release-root']) }},
local_software_release_root={{ repr(config['local-software-release-root']) }},
)
)
standalone.start()
standalone.start()
try:
try:
partition_count = 20
partition_count = 20
logging.info("Standalone SlapOS: Formatting %d partitions", partition_count)
logging.info("Standalone SlapOS: Formatting %d partitions", partition_count)
standalone.format(partition_count, {{ repr(
slapos_standalone_config['ipv4']) }}, {{ repr(slapos_standalone_
config['ipv6']) }})
standalone.format(partition_count, {{ repr(
config['ipv4']) }}, {{ repr(
config['ipv6']) }})
logging.info("Standalone SlapOS for computer `%s` started", {{ repr(
slapos_standalone_
config['computer-id']) }})
logging.info("Standalone SlapOS for computer `%s` started", {{ repr(config['computer-id']) }})
# Run instance at least once, to start the supervisor managing instances.
# Run instance at least once, to start the supervisor managing instances.
try:
try:
standalone.waitForInstance(max_retry=0)
standalone.waitForInstance(max_retry=0)
...
@@ -179,7 +179,7 @@ def main():
...
@@ -179,7 +179,7 @@ def main():
s = socket.socket(socket.AF_UNIX)
s = socket.socket(socket.AF_UNIX)
s.bind({{ repr('\0' +
slapos_standalone_
config['abstract-socket-path']) }})
s.bind({{ repr('\0' + config['abstract-socket-path']) }})
s.listen(5)
s.listen(5)
logging.info("Standalone SlapOS ready")
logging.info("Standalone SlapOS ready")
...
...
software/theia/test/test.py
View file @
1aa17677
...
@@ -34,6 +34,7 @@ import subprocess
...
@@ -34,6 +34,7 @@ import subprocess
import
sqlite3
import
sqlite3
import
time
import
time
import
netaddr
import
pexpect
import
pexpect
import
psutil
import
psutil
import
requests
import
requests
...
@@ -241,6 +242,19 @@ class TestTheia(TheiaTestCase):
...
@@ -241,6 +242,19 @@ class TestTheia(TheiaTestCase):
self
.
assertIn
(
b'slaprunner'
,
self
.
captureSlapos
(
'proxy'
,
'show'
))
self
.
assertIn
(
b'slaprunner'
,
self
.
captureSlapos
(
'proxy'
,
'show'
))
self
.
assertIn
(
b'slaprunner'
,
self
.
captureSlapos
(
'computer'
,
'list'
))
self
.
assertIn
(
b'slaprunner'
,
self
.
captureSlapos
(
'computer'
,
'list'
))
def
test_ipv6_range
(
self
):
proxy_path
=
self
.
getPath
(
'srv'
,
'runner'
,
'var'
,
'proxy.db'
)
query
=
"SELECT partition_reference, address FROM partition_network%s"
%
DB_VERSION
with
sqlite3
.
connect
(
proxy_path
)
as
db
:
rows
=
db
.
execute
(
query
).
fetchall
()
partitions
=
set
(
p
for
p
,
_
in
rows
)
ipv6
=
set
(
addr
for
_
,
addr
in
rows
if
netaddr
.
valid_ipv6
(
addr
))
# Check that each partition has a different IPv6
self
.
assertEqual
(
len
(
partitions
),
len
(
ipv6
))
# Check that no partition has the same IPv6 as theia
self
.
assertNotIn
(
self
.
connection_parameters
[
'ipv6'
],
ipv6
)
class
TestTheiaWithNonAsciiInstanceName
(
TestTheia
):
class
TestTheiaWithNonAsciiInstanceName
(
TestTheia
):
default_partition_reference
=
'💥'
default_partition_reference
=
'💥'
...
...
software/theia/test/test_resiliency.py
View file @
1aa17677
...
@@ -435,7 +435,8 @@ class TestTheiaExportAndImport(ResilienceMixin, ExportAndImportMixin, ResilientT
...
@@ -435,7 +435,8 @@ class TestTheiaExportAndImport(ResilienceMixin, ExportAndImportMixin, ResilientT
class
TakeoverMixin
(
ExportAndImportMixin
):
class
TakeoverMixin
(
ExportAndImportMixin
):
def
_getTakeoverUrlAndPassword
(
self
,
scope
=
"theia-1"
):
def
_getTakeoverUrlAndPassword
(
self
,
scope
=
"theia-1"
):
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
partition
=
self
.
requestDefaultInstance
()
# re-request for up-to-date info
parameter_dict
=
partition
.
getConnectionParameterDict
()
takeover_url
=
parameter_dict
[
"takeover-%s-url"
%
scope
]
takeover_url
=
parameter_dict
[
"takeover-%s-url"
%
scope
]
takeover_password
=
parameter_dict
[
"takeover-%s-password"
%
scope
]
takeover_password
=
parameter_dict
[
"takeover-%s-password"
%
scope
]
return
takeover_url
,
takeover_password
return
takeover_url
,
takeover_password
...
...
stack/slapos.cfg
View file @
1aa17677
...
@@ -297,7 +297,7 @@ simplegeneric = 0.8.1
...
@@ -297,7 +297,7 @@ simplegeneric = 0.8.1
singledispatch = 3.4.0.3
singledispatch = 3.4.0.3
six = 1.16.0
six = 1.16.0
slapos.cookbook = 1.0.326
slapos.cookbook = 1.0.326
slapos.core = 1.10.
0
slapos.core = 1.10.
1
slapos.extension.shared = 1.0
slapos.extension.shared = 1.0
slapos.libnetworkcache = 0.25
slapos.libnetworkcache = 0.25
slapos.rebootstrap = 4.5
slapos.rebootstrap = 4.5
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment