File: creating_a_basic_network.rst

package info (click to toggle)
receptor 1.5.5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,772 kB
  • sloc: python: 1,643; makefile: 305; sh: 174
file content (107 lines) | stat: -rw-r--r-- 1,732 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

.. _creating_a_basic_network:

###############################
Creating a basic 3-node network
###############################

In this section, we will create a three-node network.
The three nodes are: foo, bar, and baz.

`foo -> bar <- baz`

foo and baz are directly connected to bar with TCP connections.

foo can reach baz by sending network packets through bar.

***********************
Receptor configurations
***********************

1. Create three configuration files, one for each node.

``foo.yml``

.. code-block:: yaml

  - node:
      id: foo

  - control-service:
      service: control
      filename: /tmp/foo.sock

  - tcp-peer:
      address: localhost:2222

  - log-level:
      level: debug

  ...

``bar.yml``

.. code-block:: yaml

  ---
  - node:
      id: bar

  - control-service:
      service: control
      filename: /tmp/bar.sock

  - tcp-listener:
      port: 2222

  - log-level:
      level: debug

  ...

``baz.yml``

.. code-block:: yaml

  ---
  - node:
      id: baz

  - control-service:
      service: control
      filename: /tmp/baz.sock

  - tcp-peer:
      address: localhost:2222

  - log-level:
      level: debug

  - work-command:
      workType: echo
      command: bash
      params: "-c \"while read -r line; do echo $line; sleep 1; done\""
      allowruntimeparams: true

  ...

2. Run the services in separate terminals.

.. code-block:: bash

    ./receptor --config foo.yml

.. code-block:: bash

    ./receptor --config bar.yml

.. code-block:: bash

    ./receptor --config baz.yml

.. seealso::

    :ref:`configuring_receptor_with_a_config_file`
        Configuring Receptor with a configuration file
    :ref:`connecting_nodes`
        Detail on connecting receptor nodes