Skip to content

Commit

Permalink
add: compose, readme, and dockerfile for qt gui
Browse files Browse the repository at this point in the history
  • Loading branch information
maffettone committed Dec 11, 2023
1 parent 7a130b5 commit f686ffe
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 2 deletions.
12 changes: 12 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@
The following docker files are split up for the queue-server and http-server for testing. The docker compose here will spin them up together along with a networked redis server. They are bare bones and will lack the full functionality of a collection profile, but should be useful for simple testing.

## To run the containers:
On a Mac, to use the display you will need to install XQuartz and allow connections from network clients.
The queue-monitor gui image is built on [jozo/pyqt5](https://hub.docker.com/r/jozo/pyqt5).

```bash
cd docker/queue-server
docker build -t qserver:latest .
# The http-server image is based on the queue-server image so goes second.
cd ../http-server
docker build -t http-server:latest .
cd ../queue-monitor
docker build -t queue-monitor:latest .
cd ../
export LOCAL_DISPLAY_IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
xhost +
docker-compose up
```

#### If using a Linux Machine, replace the `LOCAL_DISPLAY_IP` used for display:
```bash
export LOCAL_DISPLAY_IP=$DISPLAY
```
17 changes: 15 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ services:
- QSERVER_ZMQ_INFO_ADDRESS=tcp://qserver:60625
networks:
- qserver_network
queue-monitor:
image: queue-monitor:latest
ports:
- 5901:5901
environment:
- QSERVER_ZMQ_CONTROL_ADDRESS=tcp://qserver:60615
- QSERVER_ZMQ_INFO_ADDRESS=tcp://qserver:60625
- DISPLAY=${LOCAL_DISPLAY_IP}:0
networks:
- qserver_network
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
user: qtuser

zookeeper:
image: docker.io/confluentinc/cp-zookeeper:7.3.0
Expand All @@ -38,8 +51,8 @@ services:
image: docker.io/confluentinc/cp-kafka:7.3.0
container_name: broker
ports:
# To learn about configuring Kafka for access across networks see
# https://www.confluent.io/blog/kafka-client-cannot-connect-to-broker-on-aws-on-docker-etc/
# To learn about configuring Kafka for access across networks see
# https://www.confluent.io/blog/kafka-client-cannot-connect-to-broker-on-aws-on-docker-etc/
- "9092:9092"
depends_on:
- zookeeper
Expand Down
26 changes: 26 additions & 0 deletions docker/queue-monitor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM jozo/pyqt5

# Upgrade pip and setuptools
RUN apt-get update \
&& apt-get install -y \
python3-pip \
python3-setuptools \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install --upgrade pip setuptools

# Install bluesky-widgets and its dependencies
RUN pip3 install bluesky-queueserver bluesky-queueserver-api
RUN pip3 install 'bluesky-widgets[complete]'

ENV QSERVER_ZMQ_CONTROL_ADDRESS=tcp://127.0.0.1:60615
ENV QSERVER_ZMQ_INFO_ADDRESS=tcp://127.0.0.1:60625

# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# VNC viewer
EXPOSE 5901

ENTRYPOINT [ "/entrypoint.sh" ]
11 changes: 11 additions & 0 deletions docker/queue-monitor/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# echo "Starting VNC server..."
# # Setup VNC server
# Xvfb :1 -screen 0 2560x1440x16 &
# x11vnc -rfbport 5901 -bg -quiet -forever -shared -display :1

echo "Starting queue-monitor GUI..."
echo "Control address: $QSERVER_ZMQ_CONTROL_ADDRESS"
echo "Publish address: $QSERVER_ZMQ_INFO_ADDRESS"
queue-monitor

0 comments on commit f686ffe

Please sign in to comment.