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
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
Levin Zimmermann
slapos
Commits
753d06ad
Commit
753d06ad
authored
Mar 08, 2023
by
Levin Zimmermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
components+=opcua-server;stack/erp5+=opcua-server
parent
cf1d2532
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
114 additions
and
4 deletions
+114
-4
component/opcua-server/buildout.cfg
component/opcua-server/buildout.cfg
+57
-0
stack/erp5/buildout.cfg
stack/erp5/buildout.cfg
+8
-0
stack/erp5/buildout.hash.cfg
stack/erp5/buildout.hash.cfg
+7
-3
stack/erp5/haproxy.cfg.in
stack/erp5/haproxy.cfg.in
+1
-1
stack/erp5/instance-erp5.cfg.in
stack/erp5/instance-erp5.cfg.in
+10
-0
stack/erp5/instance-opcua-server.cfg.in
stack/erp5/instance-opcua-server.cfg.in
+22
-0
stack/erp5/instance.cfg.in
stack/erp5/instance.cfg.in
+9
-0
No files found.
component/opcua-server/buildout.cfg
0 → 100644
View file @
753d06ad
[buildout]
parts = opcua-server
[opcua-server]
recipe = zc.recipe.egg
eggs = asyncua
egg-versions =
asyncua = 1.0.1
sortedcontainers = 2.4.0
aiosqlite = 0.18.0:whl
aiofiles = 23.1.0
python-dateutil = 2.8.2:whl
entry-points = ${:_buildout_section_name_}=__main__:main
initialization =
import sys
ip = sys.argv[1]
port = 2262 # hard coded here + in stack/erp5/haproxy.cfg.in
# Adjusted minimal server example from opcua-asyncio documentation
# https://opcua-asyncio.readthedocs.io/en/latest/usage/get-started/minimal-server.html
import asyncio
import logging
from asyncua import Server, ua
from asyncua.common.methods import uamethod
@uamethod
def func(parent, value):
return value * 2
async def main():
_logger = logging.getLogger(__name__)
# setup our server
server = Server()
await server.init()
server.set_endpoint(f"tcp://{ip}:{port}")
# setup our own namespace, not really necessary but should as spec
uri = "http://examples.freeopcua.github.io"
idx = await server.register_namespace(uri)
# populating our address space
# server.nodes, contains links to very common nodes like objects and root
myobj = await server.nodes.objects.add_object(idx, "MyObject")
myvar = await myobj.add_variable(idx, "MyVariable", 6.7)
# Set MyVariable to be writable by clients
await myvar.set_writable()
await server.nodes.objects.add_method(
ua.NodeId("ServerMethod", idx),
ua.QualifiedName("ServerMethod", idx),
func,
[ua.VariantType.Int64],
[ua.VariantType.Int64],
)
_logger.info("Starting server!")
async with server:
while True:
await asyncio.sleep(1)
new_val = await myvar.get_value() + 0.1
_logger.info("Set value of %s to %.1f", myvar, new_val)
await myvar.write_value(new_val)
logging.basicConfig(level=logging.DEBUG)
asyncio.run(main(), debug=True)
stack/erp5/buildout.cfg
View file @
753d06ad
...
...
@@ -63,6 +63,7 @@ extends =
../../component/pygolang/buildout.cfg
../../component/bcrypt/buildout.cfg
../../component/python-pynacl/buildout.cfg
../../component/opcua-server/buildout.cfg
../../stack/caucase/buildout.cfg
../../software/neoppod/software-common.cfg
# keep neoppod extends last
...
...
@@ -91,6 +92,9 @@ parts +=
# jupyter
# jupyter-notebook-initialized-scripts
# opcua-server
opcua-server
# override instance-jupyter-notebook not to render into default template.cfg
[instance-jupyter-notebook]
output = ${buildout:directory}/template-jupyter.cfg
...
...
@@ -221,6 +225,7 @@ context =
key template_postfix_main_cf template-postfix-main-cf:target
key template_postfix_master_cf template-postfix-master-cf:target
key instance_wcfs_cfg_in instance-wcfs.cfg.in:target
key instance_opcua_server_cfg_in instance-opcua-server.cfg.in:target
key template_zeo template-zeo:target
key template_zodb_base template-zodb-base:target
key template_zope template-zope:target
...
...
@@ -293,6 +298,9 @@ fontconfig-includes =
[instance-wcfs.cfg.in]
<= download-base
[instance-opcua-server.cfg.in]
<= download-base
[erp5-bin]
<= erp5
repository = https://lab.nexedi.com/nexedi/erp5-bin.git
...
...
stack/erp5/buildout.hash.cfg
View file @
753d06ad
...
...
@@ -70,11 +70,11 @@ md5sum = b95084ae9eed95a68eada45e28ef0c04
[template]
filename = instance.cfg.in
md5sum =
a75e8cf8fd664de164a88a680ddd2c9e
md5sum =
e08141edfda8d4159e26898000e991f3
[template-erp5]
filename = instance-erp5.cfg.in
md5sum =
3d8f3a440b7423c3b947c6ea4d775c6e
md5sum =
1204f50c488d929711719e2e66e71e1a
[template-zeo]
filename = instance-zeo.cfg.in
...
...
@@ -94,7 +94,7 @@ md5sum = b0751d3d12cfcc8934cb1027190f5e5e
[template-haproxy-cfg]
filename = haproxy.cfg.in
md5sum =
1645ef8990ab2b50f91a4c02f0cf8882
md5sum =
27f03cd0e9f2e3cd0d2b7a4aa6dccb25
[template-rsyslogd-cfg]
filename = rsyslogd.cfg.in
...
...
@@ -103,3 +103,7 @@ md5sum = 5cf0316fdd17a940031e4083bbededd8
[instance-wcfs.cfg.in]
filename = instance-wcfs.cfg.in
md5sum = eb4be2669a9a56187cc4366272e11d18
[instance-opcua-server.cfg.in]
filename = instance-opcua-server.cfg.in
md5sum = aeb48d87bac998402aba6ca829d62466
stack/erp5/haproxy.cfg.in
View file @
753d06ad
...
...
@@ -227,7 +227,7 @@ backend backend_{{ group_name }}_{{ name }}
# <<<<<<
# Adhoc added opcua server listener
{% set opcua_port = 2262 }
{% set opcua_port = 2262
%
}
frontend opcuaFrontend
mode tcp
...
...
stack/erp5/instance-erp5.cfg.in
View file @
753d06ad
...
...
@@ -427,6 +427,16 @@ config-url = ${request-jupyter:connection-url}
key_config=balancer_key_config_dict,
) }}
{{ request(
'opcua-server',
'opcua-server',
'opcua-server',
{},
{}
) }}
{% do root_common.section('request-opcua-server') -%}
[request-frontend-base]
{% if has_frontend -%}
<= request-common
...
...
stack/erp5/instance-opcua-server.cfg.in
0 → 100644
View file @
753d06ad
{% set ipv4 = (ipv4_set | list)[0] -%}
[buildout]
extends = {{ template_monitor }}
parts +=
opcua-server
[directory]
recipe = slapos.cookbook:mkdirectory
etc = ${buildout:directory}/etc
log = ${:var}/log
run = ${:var}/run
services = ${:etc}/run
service-on-watch = ${:etc}/service
srv = ${buildout:directory}/srv
tmp = ${buildout:directory}/tmp
var = ${buildout:directory}/var
[opcua-server]
recipe = slapos.cookbook:wrapper
command-line = {{ bin_directory }}/opcua-server {{ ipv4 }}
wrapper-path = ${directory:service-on-watch}/opcua-server
stack/erp5/instance.cfg.in
View file @
753d06ad
...
...
@@ -209,6 +209,14 @@ extra-context =
import-list =
file instance_zodb_base context:template-zodb-base
[dynamic-template-opcua-server]
<= jinja2-template-base
url = {{ instance_opcua_server_cfg_in }}
filename = instance_opcua_server.cfg
extra-context =
section parameter_dict dynamic-template-zope-parameters
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
override = {{ dumps(override_switch_softwaretype |default) }}
...
...
@@ -228,6 +236,7 @@ zodb-neo = neo:output
zope = dynamic-template-zope:output
jupyter = dynamic-template-jupyter:output
wcfs = dynamic-template-wcfs:output
opcua-server = dynamic-template-opcua-server:output
# Keep cloudooo backward compatibility
cloudooo = dynamic-template-legacy:output
...
...
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