Commit 9f4fdbbb authored by Ivan Tyagov's avatar Ivan Tyagov

Publish OPC-UA port. Refactor.

parent f39b4438
[instance-profile]
filename = instance.cfg.in
md5sum = 1f4b1cf38898beab3f170482d1008b01
md5sum = 8154af3eab2c255330fcfae9278a2b83
......@@ -7,8 +7,8 @@
parts =
directory
publish-connection-parameter
coupler
coupler-promise
coupler-modbus
coupler-modbus-promise
coupler-opc-ua
# Define egg directories to be the one from Software Release
......@@ -46,7 +46,8 @@ cert = ${slap-connection:cert-file}
# All possible parameters should have a default.
# In our use case, we are expecting from the user to specify one (optional) parameter: "name". We put the default value here if he doesn't specify it, so that it doesn't crash.
configuration.interface = 0.0.0.0
configuration.port = 1502
configuration.modbus_port = 1502
configuration.opc_ua_port = 4840
# If our use case requires that the user can specify a mail address so that his instance can mail to him (for example), we can do:
# configuration.mail-address =
# If the user doesn't specify it, it won't break and the recipe can handle it (i.e don't send any mail for example).
......@@ -64,32 +65,33 @@ service = ${:etc}/service
# Path of the log directory used by our service (see [helloweb])
log = ${:var}/log
[coupler]
[coupler-modbus]
# the service will log here
logfile = ${directory:log}/coupler.log
logfile = ${directory:log}/coupler-modbus.log
# Actual script that starts the service:
# This recipe will try to "exec" the command-line after separating parameters.
recipe = slapos.cookbook:wrapper
command-line =
{{ buildout['bin-directory'] }}/pythonwitheggs {{ buildout['parts-directory'] }}/osie/eggs/osie_coupler/osie_modbus.py -p ${instance-parameter:configuration.port}
{{ buildout['bin-directory'] }}/pythonwitheggs {{ buildout['parts-directory'] }}/osie/eggs/osie_coupler/osie_modbus.py -p ${instance-parameter:configuration.modbus_port}
# Put this shell script in the "etc/service" directory. Each executable of this
# repository will be started and monitored by supervisord. If a service
# exits/crashes, it will trigger a "bang" and cause a re-run of the instance.
wrapper-path = ${directory:service}/coupler
wrapper-path = ${directory:service}/coupler-modbus
# promise, that checks that helloweb service is alive
[coupler-promise]
[coupler-modbus-promise]
<= monitor-promise-base
module = check_port_listening
name = coupler.py
config-hostname= ${instance-parameter:configuration.interface}
config-port = ${instance-parameter:configuration.port}
config-port = ${instance-parameter:configuration.modbus_port}
# Publish all the parameters needed for the user to connect to the instance.
# It can be anything: URL(s), password(s), or arbitrary parameters.
# Here we'll just echo back the entered name as instance parameter
[publish-connection-parameter]
recipe = slapos.cookbook:publish
port = ${instance-parameter:configuration.port}
modbus_port = ${instance-parameter:configuration.modbus_port}
opc_ua_port = ${instance-parameter:configuration.opc_ua_port}
interface = ${instance-parameter:configuration.interface}
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