diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7411f189..2203be8f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 @@ -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: diff --git a/Dockerfile.amq_test_gen b/Dockerfile.amq_test_gen deleted file mode 100644 index b07798a6..00000000 --- a/Dockerfile.amq_test_gen +++ /dev/null @@ -1,7 +0,0 @@ -FROM continuumio/miniconda3:4.12.0 - -# Inspection tools -RUN apt-get update && apt-get install -y vim emacs - -RUN python -m pip install web-monitor-amq-message-generator==0.3.0 -i https://code.ornl.gov/api/v4/projects/10770/packages/pypi/simple -CMD ["webmonitor_amq_tester", "--broker", "activemq:61613"] diff --git a/Dockerfile.pv_test_gen b/Dockerfile.pv_test_gen deleted file mode 100644 index 4f353728..00000000 --- a/Dockerfile.pv_test_gen +++ /dev/null @@ -1,17 +0,0 @@ -FROM continuumio/miniconda3:4.12.0 - -# Inspection tools -RUN apt-get update && apt-get install -y vim emacs - -# install psql executable, later invoked in the docker-entrypoint.sh -RUN conda install postgresql=14 -c conda-forge - -RUN python -m pip install web-monitor-pv-generator==0.2.0 -i https://code.ornl.gov/api/v4/projects/10878/packages/pypi/simple - -#CMD "webmonitor_pv_tester" - -COPY ./config/amq_pv_gen/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh - -RUN chmod +x /usr/bin/docker-entrypoint.sh - -ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"] diff --git a/Dockerfile.webmonchow b/Dockerfile.webmonchow new file mode 100644 index 00000000..77fc92da --- /dev/null +++ b/Dockerfile.webmonchow @@ -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"] diff --git a/config/amq_pv_gen/docker-entrypoint.sh b/config/amq_pv_gen/docker-entrypoint.sh deleted file mode 100755 index 7c73669a..00000000 --- a/config/amq_pv_gen/docker-entrypoint.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -set -e - -# wait for postgress to be available -until PGPASSWORD=${DATABASE_PASS} psql -h "${DATABASE_HOST}" -U "${DATABASE_USER}" -d "${DATABASE_NAME}" -c '\q'; do - >&2 echo "Postgres is unavailable - sleeping" - sleep 1 -done ->&2 echo "##################################\nPOSTGRES IS UP - executing command\n##################################" - -# start test -webmonitor_pv_tester diff --git a/docker-compose.yml b/docker-compose.yml index 4641609d..de0c2819 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/docs/developer/images/services_dependence_graph.png b/docs/developer/images/services_dependence_graph.png index 4ae937b7..02377625 100644 Binary files a/docs/developer/images/services_dependence_graph.png and b/docs/developer/images/services_dependence_graph.png differ diff --git a/docs/developer/images/services_dependence_graph.puml b/docs/developer/images/services_dependence_graph.puml index da81c49e..63569144 100644 --- a/docs/developer/images/services_dependence_graph.puml +++ b/docs/developer/images/services_dependence_graph.puml @@ -1,6 +1,9 @@ @startuml 'https://plantuml.com/component-diagram +left to right direction + +usecase webmonchow database db queue activemq cloud webmon @@ -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 diff --git a/docs/developer/index.rst b/docs/developer/index.rst index add8e0bd..d2fa8af6 100644 --- a/docs/developer/index.rst +++ b/docs/developer/index.rst @@ -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 diff --git a/docs/developer/instruction/test_fixture.rst b/docs/developer/instruction/test_fixture.rst index 49de4326..646eb6c3 100644 --- a/docs/developer/instruction/test_fixture.rst +++ b/docs/developer/instruction/test_fixture.rst @@ -15,13 +15,9 @@ It is the activemq broker. ``autoreducer`` fixture runs a copy of `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 `_ . -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 `_ . -One must be authenticated to view this repository. +`webmonchow fixture `_ +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.