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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roque
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
Changes
1
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