From 7b2081b94cd87d06140de3bce0c0233763f643c3 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sun, 8 Feb 2026 22:28:14 +0000 Subject: [PATCH] Updated docker compose syntax with respect to dependencies to maintain consistency with the upstream docker-compose role. --- tasks/main.yml | 11 +++++++++-- templates/nats/nats.conf.j2 | 9 ++++++--- templates/weatherprocessor/config.yml.j2 | 20 ++++++++++++++++++++ vars/containers/nats.yml | 5 ++++- vars/containers/weatherfeeder.yml | 4 ++++ vars/containers/weatherprocessor.yml | 7 +++++-- 6 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 templates/weatherprocessor/config.yml.j2 diff --git a/tasks/main.yml b/tasks/main.yml index ce81f42..1ea32b0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,10 +1,11 @@ --- - - name: Create the directory for the weatherfeeder configuration file if it doesn't already exist. + - name: Create directories for the container data and configuration files. file: path: "{{ docker_appdata_directory}}/{{ feedstack_directory_item }}" state: directory loop: - weatherfeeder + - weatherprocessor - nats/config - nats/data loop_control: @@ -17,7 +18,13 @@ src: "weatherfeeder/config.yml.j2" dest: "{{ docker_appdata_directory }}/weatherfeeder/config.yml" become: true - + + - name: Create the weatherprocessor configuration file from the provided template. + template: + src: "weatherprocessor/config.yml.j2" + dest: "{{ docker_appdata_directory }}/weatherprocessor/config.yml" + become: true + - name: Create the nats configuration file from the provided template. template: src: "nats/nats.conf.j2" diff --git a/templates/nats/nats.conf.j2 b/templates/nats/nats.conf.j2 index f0daabf..f6e2f86 100644 --- a/templates/nats/nats.conf.j2 +++ b/templates/nats/nats.conf.j2 @@ -1,6 +1,9 @@ # Single-node NATS configuration for local app-to-app messaging. # WeatherFeeder can publish to this server without authentication. +# Listen on all IPv4 and IPv6 interfaces +listen: "[::]:4222" + # Client connections (WeatherFeeder + consumers). port: 4222 @@ -8,6 +11,6 @@ port: 4222 monitor_port: 8222 # Optional persistence for future stream use. -jetstream { - store_dir: "/data" -} +#jetstream { +# store_dir: "/data" +#} diff --git a/templates/weatherprocessor/config.yml.j2 b/templates/weatherprocessor/config.yml.j2 new file mode 100644 index 0000000..ea0e3b3 --- /dev/null +++ b/templates/weatherprocessor/config.yml.j2 @@ -0,0 +1,20 @@ +--- +sources: + - name: WeatherfeederNATS + driver: nats + params: + url: nats://nats:4222 + subject: weatherfeeder + # Optional source tuning: + # max_batch: 256 + # receive_wait: 25ms + +sinks: + - name: stdout + driver: stdout + params: {} + +routes: + - sink: stdout + kinds: [] +... diff --git a/vars/containers/nats.yml b/vars/containers/nats.yml index 990a191..4bd2750 100644 --- a/vars/containers/nats.yml +++ b/vars/containers/nats.yml @@ -10,10 +10,13 @@ nats: # Define the path where application data for this container will be stored. appdata_directory: "{{ docker_appdata_directory }}/nats" + # Needed to set the config file. + command: "-c /nats.conf" + # Define the volumes that should be mounted into the container. volumes: - "{{ docker_appdata_directory }}/nats/data:/data" - - "{{ docker_appdata_directory }}/nats/config/nats.conf:/etc/nats/nats.conf:ro" + - "{{ docker_appdata_directory }}/nats/config/nats.conf:/nats.conf:ro" # Define the ports that should be opened to the outside world. ports: diff --git a/vars/containers/weatherfeeder.yml b/vars/containers/weatherfeeder.yml index a06f681..82b9959 100644 --- a/vars/containers/weatherfeeder.yml +++ b/vars/containers/weatherfeeder.yml @@ -17,6 +17,10 @@ weatherfeeder: # Define the ports that should be opened to the outside world. #ports: [] + # Define the dependencies for this container. + dependencies: + - nats + # Define environment variables to be passed to the container. #environment_variables: [] diff --git a/vars/containers/weatherprocessor.yml b/vars/containers/weatherprocessor.yml index 54dbf36..3627a49 100644 --- a/vars/containers/weatherprocessor.yml +++ b/vars/containers/weatherprocessor.yml @@ -17,10 +17,13 @@ weatherprocessor: # Define the ports that should be opened to the outside world. #ports: [] + # Define the dependencies for this container. + dependencies: + - nats + - weatherfeeder + # Define environment variables to be passed to the container. environment_variables: - - "WEATHERPROCESSOR_NATS_URL=nats://nats:4222" - - "WEATHERPROCESSOR_SUBJECT=weatherfeeder" - "WEATHERPROCESSOR_OUTPUT_FORMAT=yaml" ...