|
1 |
| -# Relay In House Docker |
| 1 | +# NG-Relay Docker Compose |
2 | 2 |
|
3 |
| -Devo Relay scoja based docker project |
| 3 | +This repository contains an example of how to run the Devo NG-Relay and Devo |
| 4 | +NG-Relay Cli together with [docker compose](https://github.com/docker/compose). |
| 5 | +It is not mandatory, but recommended, to run both applications. |
4 | 6 |
|
5 |
| -Project to deploy a Relay using docker without to be necessary install anything. |
| 7 | +## Requirements |
6 | 8 |
|
7 |
| -To connect to relay just send your event to localhost at default ports 12999/13002 |
| 9 | +To use this docker-compose file the following requirements must be met: |
8 | 10 |
|
9 |
| -The compose is ready to share ports from 12999 to 13030 to cover more needs than default ports |
| 11 | +* docker-compose version: [v1.27+](https://github.com/docker/compose/releases) |
| 12 | +* the following folders **must exist at the same level as *docker-compose.yaml* |
| 13 | + file**: |
| 14 | + * *conf*: Stores the NG-Relay configuration. The first time the Devo NG-Relay |
| 15 | + is run, a default configuration is populated to this folder. Once the default |
| 16 | + configuration is populated, the subsequent times the Devo NG-Relay is run |
| 17 | + nothing will be populated unless the folder is empty. |
| 18 | + * *buffer*: Stores the Devo NG-Relay buffer. |
| 19 | + * *logs*: Stores the Devo NG-Relay logs. |
| 20 | +* All the above folders must have *write* and *execute* permissions for *others*. |
10 | 21 |
|
11 |
| -The first time when your run the docker Relay, remember to active the relay in Devo Website |
| 22 | +An example of the last two points may be: |
12 | 23 |
|
13 |
| -Clone or [download](https://github.com/DevoInc/devo-relay/archive/master.zip) the repository. |
| 24 | +```bash |
| 25 | +# Create the folders |
| 26 | +mkdir conf buffer logs |
14 | 27 |
|
15 |
| -Be sure that [conf/docker-start](./conf/docker-start) has executable permissions after uncompress or clone the repository |
| 28 | +# Grant write and execution for 'others' |
| 29 | +sudo chmod 777 conf/ buffer/ logs/ |
| 30 | +``` |
16 | 31 |
|
17 |
| -## Needs to run relay: (Modify in docker-devo-relay.yml) |
18 |
| -1. LOGTRUST_WEB = https://eu.devo.com | https://us.devo.com | https://es.devo.com | ... (Devo web) |
19 |
| -2. LOGTRUST_ENDPOINT = eu.elb.relay.logtrust.net | us.elb.relay.logtrust.net | ... (Devo elb) |
20 |
| -3. LOGTRUST_PORT = 443 | 6514 | 877 | ... (listening port of Devo elb) |
21 |
| -4. RELAY_NAME = The_name_for_your_relay |
22 |
| -5. RELAY_APIKEY = YOUR_API_KEY from your domain when you want to send events |
23 |
| -6. SELFSIGNED=1 Uncomment this environtment variable in [docker-devo-relay.yml](./docker-devo-relay.yml) if you are connecting the relay to endpoint/web with selfsigned certificates |
| 32 | +## Quick Start |
24 | 33 |
|
25 |
| -## Run and Stop docker Relay |
| 34 | +The recommended way to launch this docker-compose is executing the following |
| 35 | +command: |
26 | 36 |
|
27 |
| -1. Run: `DCKHUB=devoinc/ docker-compose -f docker-devo-relay.yml up -d` |
28 |
| -2. Stop: `docker-compose -f docker-devo-relay.yml down` |
| 37 | +```bash |
| 38 | +docker-compose run -rm devo-ng-relay-cli |
| 39 | +``` |
29 | 40 |
|
30 |
| -## Tips and tricks |
| 41 | +The command above will run the Devo NG-Relay and the Devo NG-Relay Cli and will |
| 42 | +present the prompt of the Devo NG-Relay Cli waiting for commands to run. |
31 | 43 |
|
32 |
| -1. Check relay using simple command |
33 |
| - 1. for i in $( seq 150 ) ; do echo "<14>$( date --iso-8601=seconds ) docker-relay test.keep.free: Docker Devo-Relay test event # $i" | nc -N localhost 13000 ; done |
34 |
| - 2. Check your test.keep.free table to see the events |
| 44 | +If you only want to launch the Devo NG-Relay, you can try one of the following |
| 45 | +commands: |
35 | 46 |
|
36 |
| -2. HowTo connect the container |
37 |
| - 1. docker exec -it Devo-Relay /bin/bash |
| 47 | +* Attached mode: |
| 48 | + ```bash |
| 49 | + docker-compose up devo-ng-relay |
| 50 | + ``` |
38 | 51 |
|
39 |
| -3. Run relay without compose and without to use this repository: |
40 |
| - 1. `docker run -it -p 12999-13030:12999-13030 -e LOGTRUST_WEB=https://eu.devo.com -e LOGTRUST_ENDPOINT=eu.elb.relay.logtrust.net -e RELAY_NAME=docker-relay-domain_name -e RELAY_APIKEY=YOUR_API_KEY --name Devo-Relay -v "$your_path_keys:/etc/logtrust/scoja/current/keys" -v "$your_path_logs:/var/log" -v "$your_path_relay-data:/opt/devo/relay-data" -v "$your_path_rules:/etc/logtrust/scoja/current/rules" -v "$your_path_unrules:/etc/logtrust/scoja/current/unrules" devoinc/devo-relay:1.1.6 /opt/devo/run/docker-start` |
41 |
| - 2. Set correct values for: |
42 |
| - 1. LOGTRUST_WEB |
43 |
| - 2. LOGTRUST_ENDPOINT |
44 |
| - 3. RELAY_NAME |
45 |
| - 4. RELAY_APIKEY |
46 |
| - 5. $your_path_xxx (absolute path required) |
| 52 | +* Detached mode: |
| 53 | + ```bash |
| 54 | + docker-compose up -d devo-ng-relay |
| 55 | + ``` |
| 56 | +If you encounter any problem, refer to the [Troubleshooting](#Troubleshooting) |
| 57 | +section. |
47 | 58 |
|
48 |
| -4. Set proxy values in [docker-devo-relay.yml](./docker-devo-relay.yml) if it's necessary for your network. Default empty values are not applied: |
49 |
| - 1. PROXY_HOST= |
50 |
| - 2. PROXY_PORT= |
51 |
| - 3. PROXY_USER= |
52 |
| - 4. PROXY_PASS= |
| 59 | +## Environment |
53 | 60 |
|
54 |
| -5. You can download the image using: `docker pull devoinc/devo-relay:1.1.6` |
| 61 | +To work with this docker-compose file, some environment variables need to be |
| 62 | +set. For this purpose, there is an environment file `.env` in which you can set |
| 63 | +them. There is a short description of each of them below: |
55 | 64 |
|
56 |
| -## Author |
| 65 | +| Name | Mandatory | Default Value | Description | |
| 66 | +| --------------------- | :-------: | :-----------: | ----------- | |
| 67 | +| NG_RELAY_VERSION | Yes | 2.0.1 | Version of the Devo NG-Relay. | |
| 68 | +| LOG_LEVEL | No | info | Sets the log level for the Devo NG-Relay. | |
| 69 | +| JAVA_OPTS | No | | space-separated quoted list in which you can activate/deactivate any of the JVM flags. | |
| 70 | +| TCP_PORT_RANGE | No | 13003-13020 | Used to open the TCP ports specified in all the user-defined rules. | |
| 71 | +| UDP_PORT_RANGE | No | 13003-13020 | Used to open the UDP ports specified in all the user-defined rules. | |
| 72 | +| NG_RELAY_CLI_VERSION | Yes | 1.0.0 | Version of the Devo NG-Relay Cli. | |
57 | 73 |
|
58 |
| - |
59 | 74 |
|
60 |
| -## Contact Us |
| 75 | +## Troubleshooting |
61 | 76 |
|
62 |
| -You can contact with us at [email protected]. |
| 77 | +### Devo NG-Relay Cli cannot connect to Devo NG-Relay |
63 | 78 |
|
64 |
| -## License |
| 79 | +Often, the first time this docker-compose is launched we might see the following |
| 80 | +message: |
65 | 81 |
|
66 |
| -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details |
| 82 | +``` |
| 83 | +*************************** |
| 84 | +APPLICATION FAILED TO START |
| 85 | +*************************** |
67 | 86 |
|
68 |
| -#### Enjoy it |
| 87 | +Description: |
| 88 | +
|
| 89 | +Error connecting to devo-ng-relay:12998 |
| 90 | +
|
| 91 | +Action: |
| 92 | +
|
| 93 | +Consider launching the application with the following arguments: |
| 94 | + --host=<HOST> |
| 95 | + --port=<PORT> |
| 96 | +
|
| 97 | +ERROR: 1 |
| 98 | +
|
| 99 | +``` |
| 100 | +This occurs because the Devo NG-Relay is not fully started when the Devo |
| 101 | +NG-Relay Cli started. To solve this, simply re-run the command below: |
| 102 | + |
| 103 | +```bash |
| 104 | +docker-compose run -rm devo-ng-relay-cli |
| 105 | +``` |
| 106 | + |
| 107 | +### When I modify an environment variable the changes are not reflected to the container |
| 108 | + |
| 109 | +After an environment variable is changed the Devo NG-Relay container needs to be |
| 110 | +re-created. To do so, just execute: |
| 111 | + |
| 112 | +```bash |
| 113 | +docker-compose up [-d] devo-ng-relay |
| 114 | +``` |
| 115 | + |
| 116 | +### Error creating volume |
| 117 | + |
| 118 | +You might see an error similar to the following if the folders for the volumes |
| 119 | +are not created: |
| 120 | + |
| 121 | +``` |
| 122 | +Creating network "xxxx_default" with the default driver |
| 123 | +Creating devo-ng-relay ... error |
| 124 | +Creating volume "xxxx_conf" with local driver |
| 125 | +ERROR: for devo-ng-relay Cannot create container for service devo-ng-relay: failed to mount local volume: mount /<your_conf_path>:/var/lib/docker/volumes/xxxx_conf/_data, flags: 0x1000: no such file or directory |
| 126 | +``` |
| 127 | + |
| 128 | +If this happens to you, please refer to the [Requirements](#Requirements) |
| 129 | +section and ensure that the folders have been created correctly. |
| 130 | + |
| 131 | +### After configuring a new relay I see exceptions thrown in the logs |
| 132 | + |
| 133 | +An example of this kind of errors is the following: |
| 134 | + |
| 135 | +``` |
| 136 | +devo-ng-relay | Aug 5 09:51:22 57b09a9df2e3 syslog.scoja.configuration: While (re)loading "/opt/devo/ng-relay/conf/relay/run/me.conf": org.scoja.common.ConfigurationException: Error while interpreting configuration file "/opt/devo/ng-relay/conf/relay/run/me.conf": Traceback (most recent call last): |
| 137 | +devo-ng-relay | File "/opt/devo/ng-relay/conf/relay/run/me.conf", line 10, in <module> |
| 138 | +devo-ng-relay | trans = outTransports( |
| 139 | +devo-ng-relay | File "/opt/devo/ng-relay/conf/relay/run/defs.py", line 113, in outTransports |
| 140 | +devo-ng-relay | buf = diskfall( |
| 141 | +devo-ng-relay | File "<scoja language definition>", line 550, in diskfall |
| 142 | +devo-ng-relay | at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) |
| 143 | +devo-ng-relay | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) |
| 144 | +devo-ng-relay | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) |
| 145 | +devo-ng-relay | at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) |
| 146 | +devo-ng-relay | at java.nio.file.Files.createDirectory(Files.java:674) |
| 147 | +devo-ng-relay | at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) |
| 148 | +devo-ng-relay | at java.nio.file.Files.createDirectories(Files.java:767) |
| 149 | +devo-ng-relay | at org.scoja.util.diskqueue.FilePairQueue.open(FilePairQueue.java:111) |
| 150 | +devo-ng-relay | at org.scoja.util.diskqueue.FilePairFall.<init>(FilePairFall.java:22) |
| 151 | +devo-ng-relay | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) |
| 152 | +devo-ng-relay | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) |
| 153 | +devo-ng-relay | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) |
| 154 | +devo-ng-relay | at java.lang.reflect.Constructor.newInstance(Constructor.java:423) |
| 155 | +devo-ng-relay | at org.python.core.PyReflectedConstructor.constructProxy(PyReflectedConstructor.java:213) |
| 156 | +devo-ng-relay | java.nio.file.AccessDeniedException: java.nio.file.AccessDeniedException: /var/logt/buffer/me |
| 157 | +``` |
| 158 | + |
| 159 | +To solve this, ensure the volume folders have the right permissions. Please |
| 160 | +refer to the [Requirements](#Requirements) section for this matter. |
| 161 | + |
| 162 | +### Useful commands for troubleshooting |
| 163 | + |
| 164 | +Below there are some useful commands to troubleshoot your docker-compose file. |
| 165 | + |
| 166 | +#### View the Devo NG-Relay logs |
| 167 | + |
| 168 | +```bash |
| 169 | +docker-compose logs -f devo-ng-relay |
| 170 | +``` |
| 171 | + |
| 172 | +#### Display information about the status and ports of containers started with this file |
| 173 | + |
| 174 | +```bash |
| 175 | +docker-compose ps -a |
| 176 | +``` |
| 177 | + |
| 178 | +#### Stop and destroy all the containers |
| 179 | + |
| 180 | +```bash |
| 181 | +docker-compose down |
| 182 | +``` |
| 183 | + |
| 184 | +### Ask for help |
| 185 | + |
| 186 | +For an extra guidance or to further support, contact to <[email protected]>. |
| 187 | + |
| 188 | +## Links |
| 189 | + |
| 190 | +[Devo](https://www.devo.com/) |
| 191 | + |
| 192 | +[Devo NG-Relay documentation](https://docs.devo.com/confluence/ndt/latest/sending-data-to-devo) |
| 193 | + |
| 194 | +[Devo in DockerHub](https://hub.docker.com/u/devoinc) |
| 195 | + |
| 196 | +## Follow us |
| 197 | + |
| 198 | +[Twitter](https://twitter.com/devo_inc) |
| 199 | + |
| 200 | +[Youtube](https://www.youtube.com/channel/UCC8gq9iZiHkZMcdztzqHP8Q) |
| 201 | + |
| 202 | +[LinkedIn](https://www.linkedin.com/company/devoinc/) |
0 commit comments