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
Labels
Merge Requests
103
Merge Requests
103
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
91483107
Commit
91483107
authored
Apr 23, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/theia: include a standalone slapos
parent
46a3d7c9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
129 additions
and
5 deletions
+129
-5
software/slapos-sr-testing/software.cfg
software/slapos-sr-testing/software.cfg
+3
-1
software/theia/buildout.hash.cfg
software/theia/buildout.hash.cfg
+1
-1
software/theia/instance.cfg.in
software/theia/instance.cfg.in
+21
-2
software/theia/software.cfg
software/theia/software.cfg
+57
-0
software/theia/test/setup.py
software/theia/test/setup.py
+1
-0
software/theia/test/test.py
software/theia/test/test.py
+46
-1
No files found.
software/slapos-sr-testing/software.cfg
View file @
91483107
...
...
@@ -291,4 +291,6 @@ mock = 2.0.0
testfixtures = 6.11
funcsigs = 1.0.2
PyPDF2 = 1.26.0
mysqlclient = 1.3.12
\ No newline at end of file
mysqlclient = 1.3.12
pexpect = 4.8.0
ptyprocess = 0.6.0
software/theia/buildout.hash.cfg
View file @
91483107
...
...
@@ -15,7 +15,7 @@
[instance]
filename = instance.cfg.in
md5sum =
1936bfae8100c5138a4ea4b13984be9d
md5sum =
83e638fca1762c197ec5847c2deec98f
[yarn.lock]
filename = yarn.lock
...
...
software/theia/instance.cfg.in
View file @
91483107
...
...
@@ -109,9 +109,27 @@ hash-existing-files =
[theia-shell]
recipe = slapos.cookbook:wrapper
wrapper-path = $${directory:bin}/$${:_buildout_section_name_}
# reset GIT_EXEC_PATH to workaround https://github.com/eclipse-theia/theia/issues/7555
# activate slapos configuration
command-line =
# reset GIT_EXEC_PATH to workaround https://github.com/eclipse-theia/theia/issues/7555
env GIT_EXEC_PATH= $SHELL
${bash:location}/bin/bash -c ". $${slapos-standalone-activate:rendered} && exec env GIT_EXEC_PATH= ${bash:location}/bin/bash"
[slapos-standalone-activate]
recipe = slapos.recipe.template:jinja2
rendered = $${directory:bin}/$${:_buildout_section_name_}
mode = 0700
# XXX maybe standalone slapos should provide an activate script like virtualenv is doing?
template =
inline:#!/bin/sh
export PATH=${buildout:bin-directory}:$PATH
${slapos-standalone:script-path} $${directory:slapos} $${:ipv4} $${:ipv6} $${:port}
export SLAPOS_CONFIGURATION=$${directory:slapos}/etc/slapos.cfg
export SLAPOS_CLIENT_CONFIGURATION=$SLAPOS_CONFIGURATION
ipv4 = $${instance-parameter:ipv4-random}
ipv6 = $${instance-parameter:ipv6-random}
port = 4000
[promises]
recipe =
...
...
@@ -171,3 +189,4 @@ pidfiles = $${:var}/run
services = $${:etc}/service
project = $${:srv}/project
slapos = $${:srv}/slapos
software/theia/software.cfg
View file @
91483107
...
...
@@ -20,6 +20,9 @@ parts =
slapos-cookbook
instance
# default for slapos-standalone
shared-part-list =
[nodejs]
<= nodejs-10.19.0
...
...
@@ -33,6 +36,60 @@ recipe = slapos.recipe.build:download-unpacked
url = https://github.com/yarnpkg/yarn/releases/download/v${:version}/yarn-v${:version}.tar.gz
md5sum = 4a02e1687a150113ad6b0215f9afdb3e
[slapos-standalone]
recipe = zc.recipe.egg
eggs =
slapos.core
scripts = ${:_buildout_section_name_}
script-path = ${buildout:bin-directory}/${:scripts}
# XXX generate a fake entry point for a non existant module, that will not
# be used because we exit in initialization step
entry-points =
${:scripts}=not_used:main
initialization =
import argparse
import os.path
import sys
import glob
import slapos.slap.standalone
parser = argparse.ArgumentParser()
parser.add_argument('base_directory')
parser.add_argument('ipv4')
parser.add_argument('ipv6')
parser.add_argument('server_port', type=int)
args = parser.parse_args()
shared_part_list = [x.strip() for x in '''${buildout:shared-part-list}'''.splitlines() if x.strip()]
standalone = slapos.slap.standalone.StandaloneSlapOS(
args.base_directory,
args.ipv4,
args.server_port,
shared_part_list=shared_part_list
)
standalone.start()
partition_count = 20
if len(glob.glob(os.path.join(standalone.instance_directory, '*'))) < partition_count:
print("Standalone SlapOS: Formatting {partition_count} partitions".format(
partition_count=partition_count))
standalone.format(
partition_count,
args.ipv4,
args.ipv6
)
print ("Standalone SlapOS for computer `{}` activated".format(standalone.computer._computer_id))
sys.exit(0)
needs-these-eggs-scripts-in-path =
${supervisor:recipe}
${slapos-command:recipe}
[supervisor]
recipe = zc.recipe.egg
eggs =
supervisor
setuptools
[python-language-server]
version = 0.19.0
...
...
software/theia/test/setup.py
View file @
91483107
...
...
@@ -45,6 +45,7 @@ setup(
'slapos.libnetworkcache'
,
'erp5.util'
,
'supervisor'
,
'pexpect'
,
'requests'
,
],
zip_safe
=
True
,
...
...
software/theia/test/test.py
View file @
91483107
...
...
@@ -24,6 +24,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
__future__
import
unicode_literals
import
os
import
textwrap
...
...
@@ -32,17 +33,18 @@ import tempfile
import
time
from
six.moves.urllib.parse
import
urlparse
import
pexpect
import
requests
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
setUpModule
,
SlapOSInstanceTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software.cfg'
)))
class
TestTheia
(
SlapOSInstanceTestCase
):
__partition_reference__
=
'T'
# for sockets in included slapos
def
setUp
(
self
):
self
.
connection_parameters
=
self
.
computer_partition
.
getConnectionParameterDict
()
...
...
@@ -61,3 +63,46 @@ class TestTheia(SlapOSInstanceTestCase):
parsed_url
.
port
)).
geturl
(),
verify
=
False
)
self
.
assertEqual
(
requests
.
codes
.
ok
,
resp
.
status_code
)
def
test_theia_slapos
(
self
):
# Make sure we can use the shell and the integrated slapos command
process
=
pexpect
.
spawnu
(
'{}/bin/theia-shell'
.
format
(
self
.
computer_partition_root_path
),
env
=
{
'HOME'
:
self
.
computer_partition_root_path
})
# use a large enough terminal so that slapos proxy show table fit in the screen
process
.
setwinsize
(
5000
,
5000
)
process
.
expect_exact
(
'Standalone SlapOS: Formatting 20 partitions'
)
process
.
expect_exact
(
'Standalone SlapOS for computer `local` activated'
)
# try to supply and install a software to check that this slapos is usable
process
.
sendline
(
'slapos supply https://lab.nexedi.com/nexedi/slapos/raw/1.0.144/software/helloworld/software.cfg local'
)
process
.
expect
(
'Requesting software installation of https://lab.nexedi.com/nexedi/slapos/raw/1.0.144/software/helloworld/software.cfg...'
)
# we pipe through cat to disable pager and prevent warnings like
# WARNING: terminal is not fully functional
process
.
sendline
(
'slapos proxy show | cat'
)
process
.
expect
(
'https://lab.nexedi.com/nexedi/slapos/raw/1.0.144/software/helloworld/software.cfg'
)
process
.
sendline
(
'slapos node software'
)
process
.
expect
(
'Installing software release https://lab.nexedi.com/nexedi/slapos/raw/1.0.144/software/helloworld/software.cfg'
)
# interrupt this, we don't want to actually wait for software installation
process
.
sendcontrol
(
'c'
)
# shutdown this slapos
process
.
sendline
(
'supervisorctl -c {}/srv/slapos/etc/supervisord.conf shutdown'
.
format
(
self
.
computer_partition_root_path
))
process
.
expect
(
'Shut down'
)
process
.
terminate
()
process
.
wait
()
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