Skip to content

Commit

Permalink
Merge pull request #104 from hmakelin/docker-compose-profiles
Browse files Browse the repository at this point in the history
Enforce Docker Compose service dependencies
  • Loading branch information
hmakelin authored Feb 11, 2024
2 parents 21e029d + 4fcbcc9 commit fffe467
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 210 deletions.
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,5 @@ include docker/Makefile

.PHONY: docs
docs:
mkdir -p docs/_build && \
d2 --font-regular="docs/_static/fonts/Poppins Regular.ttf" \
--theme=0 --dark-theme=200 \
--font-bold="docs/_static/fonts/Poppins Medium.ttf" \
--font-italic="docs/_static/fonts/Poppins Regular.ttf" \
docs/pages/developer_guide/offboard/_external_interfaces.d2 \
docs/_build/external_interfaces.html
@$(MAKE) -C docs html
@cd docs/_build/html && touch .nojekyll # for GitHub Pages
31 changes: 16 additions & 15 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ x-all-net: &all-net
x-base: &base
build:
dockerfile: Dockerfile
#platforms:
# - "linux/amd64"
#network_mode: host

# devices is a sequence not a mapping so careful when merging
# with something that defines its own devices
Expand Down Expand Up @@ -66,18 +63,12 @@ services:
context: mapserver
args:
DOCKER_TAG: latest
#platforms:
# - "linux/amd64"
# - "linux/arm64"
command: /usr/local/bin/start-server

micro-ros-agent:
<<: [*base, *ros, *mavlink-net]
build:
context: micro-ros-agent
#platforms:
# - "linux/amd64"
# - "linux/arm64"
command: udp4 -p 8888

mavros:
Expand All @@ -86,9 +77,6 @@ services:
context: mavros
args:
ROS_VERSION: humble
#platforms:
# - "linux/amd64"
# - "linux/arm64"
command: ros2 run mavros mavros_node --ros-args --param fcu_url:=udp://:14540@localhost:14557

qgc:
Expand Down Expand Up @@ -116,7 +104,15 @@ services:
args:
ROS_VERSION: humble
command: ros2 launch gisnav px4.dev.launch.py

depends_on:
- px4
- mavros
- micro-ros-agent
- gscam
- mapserver

# The px4 service depends on mavros, mapserver and micro-ros-agent because
# their IP addresses are used in the px4 service entrypoint.sh script
px4:
<<: [*base, *x11, *tty, *nvidia-gpu, *mavlink-net]
build:
Expand All @@ -126,6 +122,10 @@ services:
- /dev/shm:/dev/shm
- /dev/dri:/dev/dri
command: make px4_sitl gazebo-classic_typhoon_h480__ksql_airport
depends_on:
- mavros
- mapserver
- micro-ros-agent

ardupilot:
<<: [*base, *x11, *nvidia-gpu, *mavlink-net]
Expand Down Expand Up @@ -178,13 +178,14 @@ services:
build:
context: qgis
command: qgis
depends_on:
- postgres
- mapserver

postgres:
<<: [*base, *gis-net]
build:
context: postgres
#ports:
# - "5432:5432" # Map PostgreSQL's default port to the host
environment:
POSTGRES_DB: gisnav
POSTGRES_USER: gisnav
Expand Down
3 changes: 0 additions & 3 deletions docker/gisnav/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ RUN source /opt/ros/${ROS_VERSION}/setup.bash && \
cd .. && \
colcon build --packages-ignore mavros mavros_extras libmavconn

# Install D2 for building diagrams in docs
RUN curl -fsSL https://d2lang.com/install.sh | sh -s --

# TODO: proper health check - check that public facing topics are publishing
HEALTHCHECK --interval=10s --timeout=3s \
CMD /bin/bash -c "source /opt/ros/${ROS_VERSION}/setup.bash && \
Expand Down
6 changes: 4 additions & 2 deletions docker/px4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ RUN cd $HOME && \

WORKDIR PX4-Autopilot

COPY . .
# Do not copy Dockerfile so that it can be edited without invalidating this
# layer
COPY 6011_typhoon_h480 merge_yaml.py merge_xml.py dds_topics.yaml iris_hitl_ksql_airport.world entrypoint.sh etc .

# Setup ksql_airport.world for HIL
# empy must be version 3.3.4, see below commit
Expand All @@ -52,7 +54,7 @@ RUN python3 merge_yaml.py dds_topics.yaml src/modules/uxrce_dds_client/dds_topic
ENV PX4_VIDEO_HOST_IP=gisnav-gscam-1

RUN mkdir -p /etc/mavlink-router && \
mv etc/mavlink-router/main.conf /etc/mavlink-router/main.conf && \
mv mavlink-router/main.conf /etc/mavlink-router/main.conf && \
chmod +x ./entrypoint.sh

# Make initial builds (for faster startup in the future)
Expand Down
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ def parse_package_data(cls, package_file: str) -> PackageData:
.. |ros_version_capitalized| replace:: Humble
.. |ROS 2 install instructions| replace:: ROS 2 install instructions
.. _ROS 2 install instructions: https://docs.ros.org/en/{ros_version}/Installation.html
"""
.. |Docker Compose file| replace:: Docker Compose file
.. _Docker Compose file: https://github.com/hmakelin/gisnav/blob/v{version}/docker/docker-compose.yaml
""" # noqa: E501

rst_epilog = f"""
Updated on {datetime.datetime.today().strftime("%b %d, %Y")}
Expand Down
3 changes: 1 addition & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ Welcome to GISNav's developer documentation!
Generate documentation
_________________________________________
To build this Sphinx documentation yourself, first :ref:`Install locally` including
the development dependencies, then `install D2 <https://d2lang.com/tour/install/>`_
and then run:
the development dependencies and then run:

.. code-block:: bash
:caption: Build Sphinx documentation
Expand Down
114 changes: 0 additions & 114 deletions docs/pages/developer_guide/offboard/_external_interfaces.d2

This file was deleted.

Loading

0 comments on commit fffe467

Please sign in to comment.