Use simple-server as reference for a very simple OPC UA server.
Use demo-server (this project) for a more full-featured server that demonstrates the following.
- Exposes static and dynamically changing variables
- Variables of every supported data type including arrays
- Events
- Http access to diagnostics and other info
- More sophisticated logging and data capture
- Be used for testing / verification purposes
The demo-server enables the http feature in opcua-server so it can display metrics
from http://localhost:8585, however you must start it from the demo-server directory so it can find its html
and other resources.
cd opcua/samples/demo-server
cargo run
If you are using the demo server for testing a client you must do a few things depending on what you're testing against.
- Copy
sample.server.test.confto../server.test.conf. Thedemo-serverwill load this file if it exists. - Edit
../server.test.conf - Set
tcp_config.hostanddiscovery_urlsto the IP address of the server host. Do not set it to localhost - Set
create_sample_keypairto false - Generate a PKI keypair that is acceptable to your test environment and matches the IP address you set in the config. Copy
this to
pki/own/cert.derandpki/private/private.pem.
- It is best to try opening Project settings in test harness and browsing to server first to ensure trust is possible, and to troubleshoot any basic connection issues.
- Check logs if certs are rejected.
- If you get
BadCertificateTimeInvalidreturned to the test harness, try settingcheck_timetofalsein theserver.test.conf. For some reason test harness uses certs which can be out of date. - If the network is IPv6, use
127.0.0.1instead of the machine name orlocalhost
If you want to build the demo server and don't have a development environment then another option is to use docker as follows:
cd opcua
docker build -t opcua-rs/demo-server:latest . -f samples/demo-server/DockerfileAnd then to run it:
docker run -d opcua-rs/demo-server:latest