fix configs for docker-compose

This commit is contained in:
Krispin 2024-02-09 18:31:29 +01:00
parent 817e41ebe1
commit 44fb8e61a9
7 changed files with 27 additions and 21 deletions

View File

@ -23,7 +23,7 @@ up: .env ## Start local dev environment with docker-compose
@docker-compose -p "${PROJECT}" up --force-recreate @docker-compose -p "${PROJECT}" up --force-recreate
down: .env ## Stop local dev environment with docker-compose down: .env ## Stop local dev environment with docker-compose
@docker-compose -p "${PROJECT}" down @docker-compose -p "${PROJECT}" down -v
ansible-requirements: ## Install ansible requirements via ansible-galaxy. ansible-requirements: ## Install ansible requirements via ansible-galaxy.
ansible-galaxy collection install -r ./ansible/requirements.yaml ansible-galaxy collection install -r ./ansible/requirements.yaml

0
adapters/actor.py Normal file → Executable file
View File

4
adapters/actor.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
echo "Bash actor called with $@" > /tmp/act
echo "Bash actor called with: $@"

4
adapters/fail-actor.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
echo "This is some error output" > /dev/stderr
exit 115

View File

@ -21,17 +21,15 @@
-- If you don't specify a port bffh will use the default of `59661` -- If you don't specify a port bffh will use the default of `59661`
-- 'address' can be a IP address or a hostname -- 'address' can be a IP address or a hostname
-- If bffh can not bind a port for the specified combination if will log an error but *continue with the remaining ports* -- If bffh can not bind a port for the specified combination if will log an error but *continue with the remaining ports*
{ address = "127.0.0.1", port = 59661 }, { address = "127.0.0.1", port = 59661 }
{ address = "::1", port = 59661 },
{ address = "steak.fritz.box", port = 59661 }
], ],
-- Configure TLS. BFFH requires a PEM-encoded certificate and the associated key as two separate files -- Configure TLS. BFFH requires a PEM-encoded certificate and the associated key as two separate files
certfile = "examples/self-signed-cert.pem", certfile = "/etc/cert/cert.pem",
keyfile = "examples/self-signed-key.pem", keyfile = "/etc/cert/key.pem",
-- BFFH right now requires a running MQTT broker. -- BFFH right now requires a running MQTT broker.
mqtt_url = "tcp://localhost:1883", mqtt_url = "tcp://mosquitto:1883",
-- Path to the database file for bffh. bffh will in fact create two files; ${db_path} and ${db_path}.lock. -- Path to the database file for bffh. bffh will in fact create two files; ${db_path} and ${db_path}.lock.
-- BFFH will *not* create any directories so ensure that the directory exists and the user running bffh has write -- BFFH will *not* create any directories so ensure that the directory exists and the user running bffh has write
@ -174,7 +172,7 @@
-- which is configured by the (required) 'cmd' parameter. Paths are relative to PWD of bffh. Systemd -- which is configured by the (required) 'cmd' parameter. Paths are relative to PWD of bffh. Systemd
-- and similar process managers may change this PWD so it's usually the most future-proof to use -- and similar process managers may change this PWD so it's usually the most future-proof to use
-- absolute paths. -- absolute paths.
cmd = "./examples/actor.sh", cmd = "/usr/local/lib/bffh/adapters/actor.sh",
-- You can pass static args in here, these will be passed to every invocation of the command by this actor. -- You can pass static args in here, these will be passed to every invocation of the command by this actor.
-- args passed here are split by whitespace, so these here will be passed as 5 separate arguments -- args passed here are split by whitespace, so these here will be passed as 5 separate arguments
args = "your ad could be here" args = "your ad could be here"
@ -182,7 +180,7 @@
}, },
DoorControl1 = { DoorControl1 = {
-- This actor calls the actor.py script in examples/ -- This actor calls the actor.py script in /usr/local/lib/bffh/adapters/
-- It gets passed it's own name, so you can have several actors -- It gets passed it's own name, so you can have several actors
-- from the same script. -- from the same script.
-- If you need to pass more arguments to the command you can use the `args` key in -- If you need to pass more arguments to the command you can use the `args` key in
@ -190,22 +188,22 @@
module = "Process", module = "Process",
-- the `args` are passed in front of all other parameters so they are best suited to -- the `args` are passed in front of all other parameters so they are best suited to
-- optional parameters like e.g. the verboseness -- optional parameters like e.g. the verboseness
params = { cmd = "./examples/actor.py", args = "-vvv" } params = { cmd = "/usr/local/lib/bffh/adapters/actor.py", args = "-vvv" }
}, },
DoorControl2 = { DoorControl2 = {
module = "Process", module = "Process",
params = { cmd = "./examples/actor.py" } params = { cmd = "/usr/local/lib/bffh/adapters/actor.py" }
}, },
DoorControl3 = { DoorControl3 = {
-- This is an example for how it looks like if an actor is misconfigured. -- This is an example for how it looks like if an actor is misconfigured.
-- the actor.py doesn't know anything about DoorControl3 and, if this actor is enabled, -- the actor.py doesn't know anything about DoorControl3 and, if this actor is enabled,
-- will return with an error showing up in the server logs. -- will return with an error showing up in the server logs.
module = "Process", module = "Process",
params = { cmd = "./examples/actor.py" } params = { cmd = "/usr/local/lib/bffh/adapters/actor.py" }
}, },
Bash2 = { module = "Process", params = { cmd = "./examples/actor.sh" , args = "this is a different one" }}, Bash2 = { module = "Process", params = { cmd = "/usr/local/lib/bffh/adapters/actor.sh" , args = "this is a different one" }},
FailBash = { module = "Process", params = { cmd = "./examples/fail-actor.sh" }} FailBash = { module = "Process", params = { cmd = "/usr/local/lib/bffh/adapters/fail-actor.sh" }}
}, },
-- Linkng up machines to actors -- Linkng up machines to actors

View File

@ -1,3 +1,3 @@
persistence true #persistence true
persistence_location /mosquitto/data/ #persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log #log_dest file /mosquitto/log/mosquitto.log

View File

@ -11,12 +11,12 @@ services:
# generate a sample config.toml by running "docker run registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest --print-default > examples/config.toml" from the project root. You may have to delete the ipv6 listen section. # generate a sample config.toml by running "docker run registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest --print-default > examples/config.toml" from the project root. You may have to delete the ipv6 listen section.
- "./config/bffh:/etc/bffh" - "./config/bffh:/etc/bffh"
- "./adapters:/usr/local/lib/bffh/adapters" - "./adapters:/usr/local/lib/bffh/adapters"
- "./config/cert:/etc/letsencrypt" - "./config/cert:/etc/cert"
- data:/var/lib/bffh - data:/var/lib/bffh
links: depends_on:
- mqtt - mosquitto
mqtt: mosquitto:
image: eclipse-mosquitto:1.6.15 image: eclipse-mosquitto:1.6.15
ports: ports:
- "1883:1883" - "1883:1883"