Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
0cc0c34f
Commit
0cc0c34f
authored
Jan 25, 2021
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slap/standalone: add slapos-node-auto service
See merge request
nexedi/slapos.core!280
parent
08487a16
Pipeline
#13541
failed with stage
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
slapos/slap/standalone.py
slapos/slap/standalone.py
+31
-0
No files found.
slapos/slap/standalone.py
View file @
0cc0c34f
...
...
@@ -231,6 +231,29 @@ class SlapOSCommandWriter(ConfigWriter):
os
.
chmod
(
path
,
0o755
)
class
SlapOSNodeAutoWriter
(
ConfigWriter
):
"""Write a bin/slapos-node-auto wrapper.
"""
def
writeConfig
(
self
,
path
):
with
open
(
path
,
'w'
)
as
f
:
f
.
write
(
textwrap
.
dedent
(
"""
\
#!/bin/sh
while true
do
for i in $(seq 1 60)
do
supervisorctl -c {self._standalone_slapos._supervisor_config} start slapos-node-software &
supervisorctl -c {self._standalone_slapos._supervisor_config} start slapos-node-instance &
sleep 60
done
supervisorctl -c {self._standalone_slapos._supervisor_config} start slapos-node-report &
done
"""
).
format
(
**
locals
()))
os
.
chmod
(
path
,
0o755
)
class
PartitionForwardConfiguration
(
object
):
"""Specification of request forwarding to another master, requested as user.
"""
...
...
@@ -345,6 +368,12 @@ class StandaloneSlapOS(object):
'slapos node report --cfg {self._slapos_config} {debug_args}'
,
'stdout_logfile'
:
'{self._log_directory}/slapos-node-report.log'
,
},
'slapos-node-auto'
:
{
'command'
:
'{self._slapos_node_auto_bin}'
,
'stdout_logfile'
:
'{self._log_directory}/slapos-node-auto.log'
,
}
}
self
.
_computer_id
=
computer_id
...
...
@@ -396,6 +425,7 @@ class StandaloneSlapOS(object):
ensureDirectoryExists
(
bin_directory
)
self
.
_slapos_bin
=
os
.
path
.
join
(
bin_directory
,
'slapos'
)
self
.
_slapos_node_auto_bin
=
os
.
path
.
join
(
bin_directory
,
'slapos-node-auto'
)
self
.
_log_directory
=
os
.
path
.
join
(
var_directory
,
'log'
)
ensureDirectoryExists
(
self
.
_log_directory
)
...
...
@@ -413,6 +443,7 @@ class StandaloneSlapOS(object):
SupervisorConfigWriter
(
self
).
writeConfig
(
self
.
_supervisor_config
)
SlapOSConfigWriter
(
self
).
writeConfig
(
self
.
_slapos_config
)
SlapOSCommandWriter
(
self
).
writeConfig
(
self
.
_slapos_bin
)
SlapOSNodeAutoWriter
(
self
).
writeConfig
(
self
.
_slapos_node_auto_bin
)
self
.
start
()
...
...
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