This is currently the core of Alidron project. It is the network, the fabric embodying the main concepts of Alidron.
The Docker images are accessible on:
Dockerfiles are accessible from the Github repository:
Give it a try
The natural way of running an Isac node is with its Docker containers.
$ docker pull alidron/alidron-isac $ docker run -it --rm alidron/alidron-isac python
On the Python prompt, do:
from isac import IsacNode, IsacValue my_node = IsacNode('node1') my_iv = IsacValue( my_node, 'test://my_application/a_value', # Value name, by convention a URI. You are free to give it whatever scheme, authority and path initial_value=1, # Optional survey_last_value=False, # We know it is the first value for this URI survey_static_tags=False # Faster initialisation if you don't need static tags ) def callback(iv, value, timestamp, tags): print 'Received update on %s at %s: %s' % (iv.uri, str(timestamp), str(value)) my_iv.observers += callback # observers is a set() my_node.serve_forever() # Block
In another terminal, open another node:
$ docker run -it --rm alidron/alidron-isac python
And type the following at the Python prompt:
from isac import IsacNode, IsacValue my_node = IsacNode('node2') my_iv = IsacValue(my_node, 'test://my_application/a_value') print my_iv.value, my_iv.timestamp my_iv.value += 1 # value is a property with getter and setter
With that last command you should have seen the update arrive in the first console.
To close the nodes you need to call
my_node.shutdown() before quitting as usual the Python prompt (Ctrl+D). With the first node, as it is serving forever you need to do a Ctrl+C first.
You can also try this over multiple host. Just configure your Docker services to use multi-host networking. Alternatively, you can also use the option
--net=host with the run commands if the hosts are on the same network. It is easier but less "contained" ;-).
License and contribution policy
This project is licensed under MPLv2.
To contribute, please, follow the C4.1 contribution policy.