Skip to content

Commit

Permalink
Merge pull request #108 from hmakelin/homepage-part-2
Browse files Browse the repository at this point in the history
Add admin dashboard
  • Loading branch information
hmakelin authored Feb 28, 2024
2 parents b7bd851 + 2ab198e commit 5dc75ce
Show file tree
Hide file tree
Showing 17 changed files with 331 additions and 88 deletions.
100 changes: 99 additions & 1 deletion docker/DOCKER.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Docker build contexts
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In the ``docker/`` folder you can find a collection of directories roughly
corresponding to :term:`Docker` build contexts, and a number of
Expand All @@ -8,3 +8,101 @@ case of multi-stage builds multiple service images can be created from the same
build context. The ``docker/Makefile`` may define additional phony targets for
commonly needed tasks such as exposing the X server to containers that have a
:term:`GUI` component.

External interfaces
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The |Docker Compose file|_ defines all services used to support GISNav deployments.
The diagram below describes the system architecture through the external
interfaces and Docker bridge networks shared between the Docker Compose services.

The Docker bridge networks have in-built DNS which means the container names
resolve to their respective IP addresses. The container name will equal the
service name prefixed with ``gisnav-`` and suffixed with ``-1``. So for example
deploying the ``mapserver`` service using the Compose file will start a
Docker container with the hostname ``gisnav-mapserver-1``.

.. todo::
* Split mavlink network into mavlink and ROS networks. For ROS the intention
is to use the shared memory device instead of serializing and going through
the network stack since we will be passing a lot of images around.
* Build and expose static docs to home page - possibly no need for a server

.. note::
The application services have access to both ``gis`` and ``mavlink`` networks.

.. mermaid::

graph TD
subgraph mavlink ["mavlink"]
mavlink_qgc[qgc]
subgraph simulation ["Simulation Services"]
simulation_px4[px4]
simulation_ardupilot[ardupilot]
end
subgraph middleware ["Middleware Services"]
middleware_mavros[mavros]
middleware_micro_ros_agent[micro-ros-agent]
middleware_gscam[gscam]
end
end

subgraph gis_mavlink ["gis & mavlink"]
subgraph application ["Application Services"]
application_gisnav[gisnav]
application_autoheal[autoheal]
end
end
subgraph gis ["gis"]
subgraph gis_services ["GIS Services"]
gis_mapserver[mapserver]
gis_qgis[qgis]
end
subgraph data_services ["Data Services"]
gis_postgres[postgres]
end
end

subgraph admin ["admin"]
homepage[homepage]
fileserver[fileserver]
end

subgraph volumes ["User managed\nshared volumes"]
gscam_volume[gscam-volume]
gis_maps_volume[maps-volume]
application_gisnav_volume[gisnav-volume]
end
application_docs_volume[docs-volume]

mavlink_qgc -->|14550/udp\nMAVLink| simulation_px4
simulation_px4 -->|14540/udp\nMAVLink| middleware_mavros
simulation_px4 -->|8888/udp\nDDS-XRCE | middleware_micro_ros_agent
simulation_px4 -->|5600/udp\nRTP H.264 Video| middleware_gscam
middleware_mavros -->|/dev/shm\nROS 2 Fast DDS| application_gisnav
middleware_micro_ros_agent -->|/dev/shm\nROS 2 Fast DDS| application_gisnav
middleware_gscam -->|/dev/shm\nROS 2 Fast DDS| application_gisnav
application_gisnav -->|5432/tcp| gis_postgres

application_gisnav -->|80/tcp\nHTTP WMS| gis_mapserver
gis_mapserver -->|80/tcp\nHTTP WMS| gis_qgis
gis_qgis -->|5432/tcp| gis_postgres
gis_mapserver ---|/etc/mapserver| gis_maps_volume
application_gisnav_volume ---|/etc/gisnav| application_gisnav
application_docs_volume ---|/path/to/built/docs| application_gisnav
homepage ---|3000/tcp| fileserver
fileserver ---|"/var/www/filegator/"| volumes
gscam_volume ---|/etc/gscam| middleware_gscam

application_docs_volume ---|/path/to/docs:ro| homepage

subgraph host ["host"]
monitoring["monitoring"]
docker_host["docker host"]
end

monitoring ---|61208/tcp| homepage
docker_host ---|/var/run/docker.sock| monitoring

classDef network fill:transparent,stroke-dasharray:5 5;
class mavlink,gis,gis_mavlink,admin,admin_gis,host network
3 changes: 3 additions & 0 deletions docker/apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM ubuntu:jammy AS apache

LABEL maintainer="Harri Makelin <hmakelin@protonmail.com>"

# Update apt repository and install necessary packages
RUN apt-get update && apt-get install -y \
cgi-mapserver \
Expand Down Expand Up @@ -125,6 +127,7 @@ RUN mkdir -p /var/www/ && \
cp configuration_sample.php configuration.php && \
sed -i "s/'app_name' => 'FileGator'/'app_name' => 'GISNav'/g" configuration.php && \
sed -i "s|'logo' => 'https://filegator.io/filegator_logo.svg'|'logo' => 'img/logo-no-background.svg'|g" configuration.php && \
sed -i "/'editable' => \[/ s/]/, '.yml', '.yaml'&/" configuration.php && \
sed -i 's/100 \* 1024 \* 1024/2 \* 1024 \* 1024 \* 1024/g' configuration.php && \
mkdir -p dist/img && \
cp /logo-no-background.svg dist/img && \
Expand Down
4 changes: 4 additions & 0 deletions docker/apache/fileserver/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ rm -f /var/run/apache2/cgisock.*

apache2ctl -D FOREGROUND &

# Make sure we can edit files on mapped volumes
chown -R www-data:www-data /var/www/filegator/repository
chmod -R 775 /var/www/filegator/repository

exec "$@"
6 changes: 4 additions & 2 deletions docker/apache/mapserver/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ process_directory_change() {
fi
fi

sleep 0.5

if [[ "$BASENAME" =~ \.(tif|tiff|jp2|ecw|img)$ ]]; then
echo "Raster file detected, regenerating VRT."
cd /etc/mapserver && gdalbuildvrt "$VRT_FILE" "$DIR_PATH"/*.tif "$DIR_PATH"/*.tiff "$DIR_PATH"/*.jp2 "$DIR_PATH"/*.ecw "$DIR_PATH"/*.img
Expand All @@ -69,7 +71,7 @@ done &

# Move demo imagery and DEM over to shared volume if still on image
# This should trigger the inotify script
mv /etc/mapserver/$NAIP_ZIP_FILENAME $IMAGERY_DIR | echo "NAIP imagery not found on container - likely already moved to shared volume"
mv /etc/mapserver/$DEM_FILENAME $DEM_DIR | echo "USGS DEM not found on container - likely already moved to shared volume"
mv /etc/mapserver/$NAIP_ZIP_FILENAME $IMAGERY_DIR || echo "NAIP imagery not found on container - likely already moved to shared volume"
mv /etc/mapserver/$DEM_FILENAME $DEM_DIR || echo "USGS DEM not found on container - likely already moved to shared volume"

exec "$@"
Loading

0 comments on commit 5dc75ce

Please sign in to comment.