Skip to content

Commit

Permalink
Rename and consolidate AMQ and PV generators into webmonchow
Browse files Browse the repository at this point in the history
Replaced the AMQ and PV generator services with the unified webmonchow service. Updated Dockerfiles, Docker Compose, and documentation to reflect this change, simplifying the deployment and maintenance process.

Signed-off-by: Jose Borreguero <[email protected]>
  • Loading branch information
jmborr committed Aug 26, 2024
1 parent b2f255f commit 9b52722
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 93 deletions.
31 changes: 6 additions & 25 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,23 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push amq_test_gen
- name: Build and push webmonchow
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.amq_test_gen
file: Dockerfile.webmonchow
tags: |
${{ env.REGISTRY }}/${{ github.repository }}/amq_test_gen:${{ steps.latest_tag.outputs.latest_tag }}
${{ env.REGISTRY }}/${{ github.repository }}/webmonchow:${{ steps.latest_tag.outputs.latest_tag }}
push: true

- name: Push amq_test_gen with version tag only for main branch
- name: Push webmonchow with version tag only for main branch
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.amq_test_gen
file: Dockerfile.webmonchow
tags: |
${{ env.REGISTRY }}/${{ github.repository }}/amq_test_gen:${{ steps.tag.outputs.tag }}
${{ env.REGISTRY }}/${{ github.repository }}/webmonchow:${{ steps.tag.outputs.tag }}
push: true

- name: Build and push Autoreducer
Expand Down Expand Up @@ -150,25 +150,6 @@ jobs:
${{ env.REGISTRY }}/${{ github.repository }}/dasmon:${{ steps.tag.outputs.tag }}
push: true

- name: Build and push pv_test_gen
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.pv_test_gen
tags: |
${{ env.REGISTRY }}/${{ github.repository }}/pv_test_gen:${{ steps.latest_tag.outputs.latest_tag }}
push: true

- name: Push pv_test_gen with version tag only for main branch
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.pv_test_gen
tags: |
${{ env.REGISTRY }}/${{ github.repository }}/pv_test_gen:${{ steps.tag.outputs.tag }}
push: true

- name: Build and push Webmon
uses: docker/build-push-action@v6
with:
Expand Down
7 changes: 0 additions & 7 deletions Dockerfile.amq_test_gen

This file was deleted.

17 changes: 0 additions & 17 deletions Dockerfile.pv_test_gen

This file was deleted.

14 changes: 14 additions & 0 deletions Dockerfile.webmonchow
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM continuumio/miniconda3:4.12.0

# Install conda-libmamba-solver
RUN conda update -n base -c defaults conda
RUN conda install --yes -n base conda-libmamba-solver

# Install Python 3.10 and PostgreSQL using libmamba solver
RUN conda install --yes --solver=libmamba -c conda-forge python=3.10 postgresql=14

# Install webmonchow
RUN python -m pip install git+https://github.com/neutrons/webmonchow.git@next#egg=webmonchow

# Start the AMQ and PV generators when starting the container
CMD ["sh", "-c", "broadcast_pv & broadcast_amq --broker \"activemq:61613\" & wait"]
12 changes: 0 additions & 12 deletions config/amq_pv_gen/docker-entrypoint.sh

This file was deleted.

15 changes: 4 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,13 @@ services:
activemq:
condition: service_healthy

amq_test_gen:
# Generator of AMQ messages and VP updates
# https://webmonchow.readthedocs.io/en/latest/index.html
webmonchow:
restart: always
build:
context: .
dockerfile: Dockerfile.amq_test_gen
depends_on:
activemq:
condition: service_healthy

amq_pv_gen:
restart: always
build:
context: .
dockerfile: Dockerfile.pv_test_gen
dockerfile: Dockerfile.webmonchow
env_file:
- .env
depends_on:
Expand Down
Binary file modified docs/developer/images/services_dependence_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 17 additions & 13 deletions docs/developer/images/services_dependence_graph.puml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@startuml
'https://plantuml.com/component-diagram

left to right direction

usecase webmonchow
database db
queue activemq
cloud webmon
Expand All @@ -9,22 +12,23 @@ component workflow
agent catalog_process
hexagon nginx
agent autoreducer
usecase amq_test_gen
usecase amq_pv_gen

nginx <- catalog_process
webmonchow -right-> db
webmonchow -right-> activemq

db <- webmon
db <- amq_pv_gen
webmon -down-> db

webmon <- dasmon
webmon <- nginx
webmon <- workflow
catalog_process -right-> nginx
dasmon -down-> webmon
nginx -down-> webmon
workflow -right-> webmon

activemq <- workflow
activemq <- dasmon
activemq <- autoreducer
activemq <- amq_test_gen
activemq <- catalog_process
workflow -down-> activemq
dasmon -down-> activemq
autoreducer -down-> activemq
activemq -down-> autoreducer
webmon -up-> activemq
catalog_process -right-> activemq
activemq -right-> catalog_process

@enduml
2 changes: 1 addition & 1 deletion docs/developer/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Services

The components making up the infrastructure of Web Monitor have dependencies.
In the diagram below `service1` --> `service2` is to be read as `service1` depends on `service2`.
For instance, `amq_pv_gen` depends on `db`.
For instance, `webmonchow` depends on `db`.

.. image:: images/services_dependence_graph.png
:width: 600px
Expand Down
10 changes: 3 additions & 7 deletions docs/developer/instruction/test_fixture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ It is the activemq broker.
``autoreducer`` fixture runs a copy of `post processing agent <https://github.com/neutrons/post_processing_agent>`_.
This is given a fake filesystem with the contents of ``tests/data`` in the location ``/SNS/`` (at the root level of the filesystem).

``amq_test_gen`` fixture creates pretend messages associated with runs being saved.
It contains the code in the `web monitor test AMQ message generator repository <https://code.ornl.gov/sns-hfir-scse/infrastructure/web-monitor-amq-message-generator>`_ .
One must be authenticated to view this repository.

``amq_pv_gen`` fixture creates fake process variables (PVs) that the data aquisition would make.
It contains the code in the `web monitor test pv generator repository <https://code.ornl.gov/sns-hfir-scse/infrastructure/web-monitor-test-pv-generator>`_ .
One must be authenticated to view this repository.
`webmonchow fixture <https://webmonchow.readthedocs.io/en/latest/index.html>`_
creates pretend messages associated with runs being saved,
as well as fake process variables (PVs) that the data aquisition would make.

``catalog_process`` fixture is running the script located in ``src/catalog/catalog_process.py`` which responds with the messages in a similar way to how ONCAT would.
The script creates a :py:obj:`~catalog_process.Listener` and responds accordingly.

0 comments on commit 9b52722

Please sign in to comment.