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
Romain Courteaud
slapos
Commits
c52d568a
Commit
c52d568a
authored
Jun 15, 2021
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/theia: Add standalone ready promise
parent
384b2c81
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
49 deletions
+61
-49
software/theia/buildout.hash.cfg
software/theia/buildout.hash.cfg
+1
-1
software/theia/instance-theia.cfg.jinja.in
software/theia/instance-theia.cfg.jinja.in
+7
-1
software/theia/software.cfg
software/theia/software.cfg
+53
-47
No files found.
software/theia/buildout.hash.cfg
View file @
c52d568a
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
[instance-theia]
[instance-theia]
_update_hash_filename_ = instance-theia.cfg.jinja.in
_update_hash_filename_ = instance-theia.cfg.jinja.in
md5sum =
3e7364c6790ab176df90a8cf19715a43
md5sum =
001440693adfb9583d1479aae4bfa970
[instance]
[instance]
_update_hash_filename_ = instance.cfg.in
_update_hash_filename_ = instance.cfg.in
...
...
software/theia/instance-theia.cfg.jinja.in
View file @
c52d568a
...
@@ -74,6 +74,7 @@ instance-promises =
...
@@ -74,6 +74,7 @@ instance-promises =
$${remote-additional-frontend-url-available-promise:name}
$${remote-additional-frontend-url-available-promise:name}
{% endif %}
{% endif %}
$${slapos-standalone-listen-promise:name}
$${slapos-standalone-listen-promise:name}
$${slapos-standalone-ready-promise:name}
$${slapos-autorun-promise:name}
$${slapos-autorun-promise:name}
[theia-listen-promise]
[theia-listen-promise]
...
@@ -124,10 +125,15 @@ name = standalone-listen-promise.py
...
@@ -124,10 +125,15 @@ name = standalone-listen-promise.py
config-host = $${slapos-standalone-instance:hostname}
config-host = $${slapos-standalone-instance:hostname}
config-port = $${slapos-standalone-instance:port}
config-port = $${slapos-standalone-instance:port}
[slapos-standalone-ready-promise]
<= monitor-promise-base
module = check_socket_listening
name = standalone-ready-promise.py
config-abstract = $${directory:runner}/standalone_ready
[slapos-autorun-promise]
[slapos-autorun-promise]
<= monitor-promise-base
<= monitor-promise-base
module = check_service_state
module = check_service_state
# XXX promise plugins can not contain "slapos" in their names
name = autorun-state-promise.py
name = autorun-state-promise.py
config-service = $${slapos-autorun:service-name}
config-service = $${slapos-autorun:service-name}
config-expect = $${slapos-autorun:autorun}
config-expect = $${slapos-autorun:autorun}
...
...
software/theia/software.cfg
View file @
c52d568a
...
@@ -58,9 +58,10 @@ initialization =
...
@@ -58,9 +58,10 @@ initialization =
import argparse
import argparse
import glob
import glob
import json
import json
import os.path
import os
import sys
import signal
import signal
import socket
import sys
import time
import time
import slapos.slap.standalone
import slapos.slap.standalone
...
@@ -106,7 +107,14 @@ initialization =
...
@@ -106,7 +107,14 @@ initialization =
partition_forward_configuration=partition_forward_configuration,
partition_forward_configuration=partition_forward_configuration,
slapos_bin="${buildout:bin-directory}/slapos",
slapos_bin="${buildout:bin-directory}/slapos",
)
)
def signal_handler(signum, frame):
print("Signal {signum} received".format(signum=signum))
sys.exit()
signal.signal(signal.SIGTERM, signal_handler)
standalone.start()
standalone.start()
try:
partition_count = 20
partition_count = 20
if len(glob.glob(os.path.join(standalone.instance_directory, '*'))) < partition_count:
if len(glob.glob(os.path.join(standalone.instance_directory, '*'))) < partition_count:
print("Standalone SlapOS: Formatting {partition_count} partitions".format(
print("Standalone SlapOS: Formatting {partition_count} partitions".format(
...
@@ -114,7 +122,7 @@ initialization =
...
@@ -114,7 +122,7 @@ initialization =
standalone.format(
standalone.format(
partition_count,
partition_count,
args.ipv4,
args.ipv4,
args.ipv6
args.ipv6,
)
)
print("Standalone SlapOS for computer `{}` started".format(args.computer_id))
print("Standalone SlapOS for computer `{}` started".format(args.computer_id))
# Run instance at least once, to start the supervisor managing instances.
# Run instance at least once, to start the supervisor managing instances.
...
@@ -143,20 +151,18 @@ initialization =
...
@@ -143,20 +151,18 @@ initialization =
partition_parameter_kw=params,
partition_parameter_kw=params,
)
)
quit_requested = []
s = socket.socket(socket.AF_UNIX)
def signal_handler(signum, frame):
s.bind('\0' + os.path.join(args.base_directory, 'standalone_ready'))
print("Signal {signum} received".format(signum=signum))
s.listen(5)
quit_requested.append(True)
signal.signal(signal.SIGTERM, signal_handler)
print("Standalone SlapOS ready")
print("Standalone SlapOS ready")
while not quit_requested
:
while True
:
time.sleep(.1
)
s.accept()[0].close(
)
finally:
print("Stopping standalone subsystem")
print("Stopping standalone subsystem")
standalone.stop()
standalone.stop()
print("Exiting")
print("Exiting")
sys.exit(0)
needs-these-eggs-scripts-in-path =
needs-these-eggs-scripts-in-path =
${supervisor:recipe}
${supervisor:recipe}
...
...
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