Commit 3cc216c8 authored by Ivan Tyagov's avatar Ivan Tyagov

Add Beremiz' runtime.

parent 2f864667
Pipeline #19736 failed with stage
in 0 seconds
[instance-profile]
filename = instance.cfg.in
md5sum = ed202dc7d69f517e325f01dc3ac4fe32
#############################
#
# Deploy beremiz' runtime instance
#
#############################
[buildout]
parts =
directory
Please register or sign in to reply
publish-connection-parameter
download-plc
beremiz-runtime
# beremiz-runtime-promise
eggs-directory = {{ buildout['eggs-directory'] }}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
offline = true
extends = {{ template_monitor }}
[download-plc]
recipe = plone.recipe.command
update-command = ${:command}
url = ${instance-parameter:configuration.runtime_plc_url}
md5sum = ${instance-parameter:configuration.runtime_plc_md5sum}
# XXX: do check md5sum !
command =
wget ${:url} -O plc.tgz
tar zxvf plc.tgz
  • slapos.recipe.build:download-unpacked must be used instead (it accepts an offline option that can override buildout's)

Please register or sign in to reply
[instance-parameter]
recipe = slapos.cookbook:slapconfiguration
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
configuration.runtime_plc_url =
configuration.runtime_plc_md5sum =
# XXX: we can get rid of plc_name in future
configuration.runtime_plc_name =
configuration.autostart = 1
configuration.interface = 0.0.0.0
# XXX: randomly generated one on slap's interface?
configuration.port = 61248
configuration.plc_runtime_path = ${directory:home}/${:configuration.runtime_plc_name}
  • Reference [download-plc] and remove download-plc from ${buildout:parts}

Please register or sign in to reply
# Create all needed directories, depending on your needs
[directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
etc = ${:home}/etc
var = ${:home}/var
script = ${:etc}/run/
  • let's be consistent by removing the trailing /

    Anyway, the whole section is useless because it's already done by the monitor stack.

Please register or sign in to reply
service = ${:etc}/service
log = ${:var}/log
[beremiz-runtime]
logfile = ${directory:log}/beremiz-runtime.log
recipe = slapos.cookbook:wrapper
command-line =
{{ buildout['bin-directory'] }}/pythonwitheggs {{ buildout['directory'] }}/src/beremiz/Beremiz_service.py -a ${instance-parameter:configuration.autostart} -p ${instance-parameter:configuration.port} -i ${instance-parameter:configuration.interface} -x 1 ${directory:home}/${instance-parameter:configuration.runtime_plc_name}
  • Avoid code duplication by refering to ${beremiz:setup} and ${python-interpreter:interpreter}. By having ${instance-profile:context} referencing the 2 sections, python-interpreter can be removed from ${buildout:parts}.

Please register or sign in to reply
wrapper-path = ${directory:service}/beremiz-runtime
[beremiz-runtime-promise]
<= monitor-promise-base
module = check_port_listening
name = beremiz-runtime.py
config-hostname= ${instance-parameter:configuration.interface}
config-port = ${instance-parameter:configuration.port}
[publish-connection-parameter]
recipe = slapos.cookbook:publish
port = ${instance-parameter:configuration.port}
interface = ${instance-parameter:configuration.interface}
# the default SlapOs profile which setup a modbus server instance usually over OSIE's coupler
[buildout]
allow-picked-versions = true
Please register or sign in to reply
extensions = mr.developer
  • I think this overrides the value in stack/slapos.cfg which is also forbidden in the master branch. Also, we never used mr.developer in slapos.git and I wonder if it's fine. /cc @nexedi

Please register or sign in to reply
auto-checkout = beremiz
extends =
buildout.hash.cfg
https://lab.nexedi.com/nexedi/slapos/raw/master/stack/monitor/buildout.cfg
https://lab.nexedi.com/nexedi/slapos/raw/master/stack/slapos.cfg
https://lab.nexedi.com/nexedi/slapos/raw/master/component/python3/buildout.cfg
  • Use relative paths.

    Referencing directly component/python3 is useless.

Please register or sign in to reply
parts =
python-interpreter
slapos-cookbook
instance-profile
# fix for pypi: https://mail.python.org/pipermail/distutils-sig/2017-October/031712.html
index = https://pypi.python.org/simple/
  • We had this long time ago in stack/slapos.cfg: how did it resurrect here ?

Please register or sign in to reply
[sources]
beremiz = git https://github.com/beremiz/beremiz.git branch=default
Please register or sign in to reply
[beremiz]
recipe = zc.recipe.egg:develop
egg = beremiz
setup = ${buildout:directory}/src/beremiz
[Twisted]
recipe = zc.recipe.egg:custom
egg = Twisted
setup-eggs =
six
pathlib
[python-interpreter]
recipe = zc.recipe.egg
interpreter = pythonwitheggs
eggs = click
prompt_toolkit
pygments
bitarray
future
six
Pyro
zeroconf-py2compat
pathlib
Nevow
msgpack
autobahn
${beremiz:egg}
${Twisted:egg}
[instance-profile]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/${:filename}
mode = 0644
  • (minor because slapos.git is not cleaned up) the mode option can be removed

Please register or sign in to reply
rendered = ${buildout:directory}/instance.cfg
extensions = jinja2.ext.do
context =
section buildout buildout
raw template_monitor ${monitor2-template:rendered}
Please register or sign in to reply
# md5sum is fetched from buildout.hash.cfg and can be recalculated automatically by
# calling update-hash
[versions]
Twisted = 20.3.0
attrs = 19.2.0
Automat = 0.3.0
zope.interface = 4.4.2
Nevow = 0.14.5
PyHamcrest = 2.0.2
Pygments = 2.9.0
Pyro = 3.16
bitarray = 2.1.3
constantly = 15.1.0
future = 0.18.2
hyperlink = 21.0.0
incremental = 21.3.0
pathlib = 1.0.1
prompt-toolkit = 3.0.19
zeroconf-py2compat = 0.19.10
# Required by:
# Automat==0.3.0
characteristic = 14.3.0
# Required by:
# zeroconf-py2compat==0.19.10
ifcfg = 0.21
# Required by:
# hyperlink==21.0.0
typing = 3.10.0.0
autobahn = 19.11.2
txaio = 18.8.1
idna = 2.10
mr.developer = 2.0.1
  • This should be reverted. I don't see how it could work as is and the master branch should lead by example, at least a minimum, and here there's too much to clean.

    It can go to a branch.

    Edited by Julien Muchembled
  • @jm , this is being tested with a new type of tests: "IntegrationTests" for every commit (see " Beremiz.InterationTest-Master"). So it for sure is working, being used and for sure will be developed.

    If there are specific remarks which you mean I will be more than happy to fix thus please let me know your remarks. I will do asap.

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment