Skip to content

Commit 08b1f26

Browse files
authored
chore: add INSTALL_WORKERS_PATH var and docs for it (#52)
1 parent 3ea3a12 commit 08b1f26

File tree

3 files changed

+79
-2
lines changed

3 files changed

+79
-2
lines changed

agent/docker/orb-agent-entry.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ if [ "${INSTALL_DRIVERS_PATH}" != '' ]; then
2222
pip3 install -r ${INSTALL_DRIVERS_PATH}
2323
fi
2424

25+
if [ "${INSTALL_WORKERS_PATH}" != '' ]; then
26+
cd $(dirname "$(realpath "$INSTALL_WORKERS_PATH")")
27+
echo "Installing custom orb workers"
28+
pip3 install -r ${INSTALL_WORKERS_PATH}
29+
fi
30+
2531
# check geodb folder and extract db
2632
cd /geo-db/
2733
if [ -f "asn.mmdb.gz" ]; then

docs/backends/worker.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,24 @@ orb:
4949
schedule: "* * * * *"
5050
custom_config: custom
5151
scope:
52-
custom: any
52+
custom: any
53+
```
54+
55+
### Custom Workers
56+
To specify required custom workers packages, use the environment variable `INSTALL_WORKERS_PATH`. Ensure that the required files are placed in the mounted volume (`/opt/orb`).
57+
58+
Mounted folder example:
59+
```sh
60+
/local/orb/
61+
├── agent.yaml
62+
├── workers.txt
63+
├── my-worker/
64+
└── nbl-custom-worker-1.0.2.tar.gz
65+
```
66+
67+
Example `workers.txt`:
68+
```txt
69+
my-custom-wkr==0.1.2 # try install from pypi
70+
nbl-custom-worker-1.0.2.tar.gz # try install from a tar.gz
71+
./my-worker # try to install from a folder that contains project.toml
72+
```

docs/config_samples.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,55 @@ Run command:
9696
docker run -v /local/orb:/opt/orb/ \
9797
-e DIODE_API_KEY={YOUR_API_KEY} \
9898
netboxlabs/orb-agent:latest run -c /opt/orb/agent.yaml
99-
```
99+
```
100+
101+
## Worker backend
102+
```yaml
103+
orb:
104+
config_manager:
105+
active: local
106+
backends:
107+
worker:
108+
common:
109+
diode:
110+
target: grpc://192.168.31.114:8080/diode
111+
api_key: ${DIODE_API_KEY}
112+
agent_name: agent02
113+
policies:
114+
worker:
115+
policy_1:
116+
config:
117+
package: my_worker #Required
118+
schedule: "0 */2 * * *"
119+
custom_config: config
120+
scope:
121+
custom_val: value
122+
```
123+
124+
### Custom Workers
125+
To specify required custom workers packages, use the environment variable `INSTALL_WORKERS_PATH`. Ensure that the required files are placed in the mounted volume (`/opt/orb`).
126+
127+
Mounted folder example:
128+
```sh
129+
/local/orb/
130+
├── agent.yaml
131+
├── workers.txt
132+
├── my-worker/
133+
└── nbl-custom-worker-1.0.2.tar.gz
134+
```
135+
136+
Example `workers.txt`:
137+
```txt
138+
my-custom-wkr==0.1.2 # try install from pypi
139+
nbl-custom-worker-1.0.2.tar.gz # try install from a tar.gz
140+
./my-worker # try to install from a folder that contains project.toml
141+
```
142+
143+
Run command:
144+
```sh
145+
docker run -v /local/orb:/opt/orb/ \
146+
-e DIODE_API_KEY={YOUR_API_KEY} \
147+
-e INSTALL_WORKERS_PATH=/opt/orb/workers.txt \
148+
netboxlabs/orb-agent:latest run -c /opt/orb/agent.yaml
149+
```
150+
The relative path used by `pip install` should point to the directory containing the `.txt` file.

0 commit comments

Comments
 (0)