Skip to content

Commit bd5482e

Browse files
authored
Merge pull request #127 from hmakelin/sift-keypoints
Service architecture and networking redesign
2 parents d6b2674 + 01dde48 commit bd5482e

File tree

170 files changed

+6659
-4243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+6659
-4243
lines changed

.dockerignore

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,60 @@
1-
# The gisnav service uses the repo root as build context so we
2-
# use a .dockerignore file here to prevent some files from being
3-
# included in the image
1+
# IDEs and editors
2+
.idea/ # IntelliJ-based IDEs (e.g. PyCharm)
3+
.vscode/ # Visual Studio Code
4+
45
# Python virtual environment
56
venv/
67

7-
# PyCharm generated files
8-
.idea/
9-
10-
# Python bytecode
8+
# Python bytecode and cache directories
119
*.pyc
12-
13-
# colcon created folders
14-
build/
15-
install/
16-
log/
17-
18-
# VitePress
19-
docs/vitepress/docs/.vitepress/dist
20-
docs/vitepress/docs/.vitepress/build
21-
docs/vitepress/docs/.vitepress/cache
22-
docs/vitepress/docs/reference/
23-
24-
# Sphinx
25-
docs/sphinx/build
10+
**/__pycache__/
11+
12+
# General build directories (e.g., colcon, make, sphinx, VitePress)
13+
**/build/
14+
**/_build/
15+
**/.build/
16+
**/dist/
17+
**/_dist/
18+
**/.dist/
19+
**/install/
20+
**/_install/
21+
**/.install/
22+
**/log/
23+
**/_log/
24+
**/.log/
25+
**/cache/
26+
**/_cache/
27+
**/.cache/
28+
29+
# GISNav docs build specific build folder
30+
docs/vitepress/docs/reference
2631

2732
# coverage.py files
2833
.coverage*
2934

3035
# SITL test log output (but leave one sample flight log)
3136
gisnav/test/sitl/output/
37+
*.ulg
38+
*.ulog
3239

33-
# Jupyter Notebook checkpoints
40+
# Jupyter Notebook checkpoints, notebooks
3441
gisnav/test/sitl/ulog_analysis/.ipynb_checkpoints/
42+
gisnav/test/sitl/ulog_analysis/output
3543

3644
.benchmarks/
3745

46+
*.egg-info
47+
48+
# Debian package builds
49+
debian
50+
.pybuild
51+
*.deb
52+
3853
# mypy
3954
.mypy_cache
4055

4156
# node
4257
node_modules
58+
59+
# pytest
60+
*.pytest_cache/*
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build and upload gisnav service
2+
3+
on:
4+
#push:
5+
# # Run when new version tag is pushed
6+
# tags:
7+
# - v*
8+
9+
# Allows running manually from the Actions tab
10+
workflow_dispatch:
11+
12+
13+
jobs:
14+
build-gisnav-service:
15+
runs-on: ubuntu-latest
16+
defaults:
17+
run:
18+
shell: bash
19+
steps:
20+
- name: Build .deb inside container
21+
run: |
22+
docker pull ghcr.io/${{ github.repository }}:latest
23+
docker run --name gisnav-build ghcr.io/${{ github.repository }}:latest cd /systemd/gisnav && make dist
24+
docker cp $(docker ps -q -l):opt/colcon_ws/src/gisnav/systemd/gisnav/dist/ /tmp/build-output
25+
26+
- name: Find .deb file and set env
27+
run: |
28+
DEB_FILE=$(ls /tmp/build-output/*.deb)
29+
echo "DEB_FILE=$DEB_FILE" >> $GITHUB_ENV
30+
31+
- name: Upload artifact
32+
uses: actions/upload-artifact@v2
33+
with:
34+
name: gisnav-deb
35+
path: ${{ env.DEB_FILE }}
36+
37+
upload-gisnav-service:
38+
needs: build-gisnav-service
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Download artifact
42+
uses: actions/download-artifact@v2
43+
with:
44+
name: gisnav-deb
45+
46+
# Use GitHub releases as apt repository
47+
- name: Upload .deb package as release artifact
48+
run: |
49+
echo TODO

.github/workflows/push_gisnav_images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ jobs:
5353
sudo rm -rf /usr/local/share/boost
5454
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
5555
cd colcon_ws/src/gisnav
56-
docker buildx build --build-arg ROS_VERSION=humble --push --platform linux/amd64,linux/arm64 -f docker/mavros/Dockerfile --target gisnav -t ghcr.io/hmakelin/gisnav:${TAG:-latest} .
56+
docker buildx build --build-arg ROS_DISTRO=humble --push --platform linux/amd64,linux/arm64 -f docker/mavros/Dockerfile --target gisnav -t ghcr.io/hmakelin/gisnav:${TAG:-latest} .

.gitignore

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
1+
# IDEs and editors
2+
.idea/
3+
.vscode/
4+
15
# Python virtual environment
26
venv/
37

4-
# PyCharm generated files
5-
.idea/
6-
7-
# Python bytecode
8+
# Python bytecode and cache directories
89
*.pyc
9-
10-
# colcon created folders
11-
build/
12-
install/
13-
log/
14-
15-
# VitePress
16-
docs/vitepress/docs/.vitepress/dist
17-
docs/vitepress/docs/.vitepress/build
18-
docs/vitepress/docs/.vitepress/cache
19-
docs/vitepress/docs/reference/
20-
21-
# Sphinx
22-
docs/sphinx/build
10+
**/__pycache__/
11+
12+
# General build directories (e.g., colcon, make, sphinx, VitePress)
13+
**/build/
14+
**/_build/
15+
**/.build/
16+
**/dist/
17+
**/_dist/
18+
**/.dist/
19+
**/install/
20+
**/_install/
21+
**/.install/
22+
**/log/
23+
**/_log/
24+
**/.log/
25+
**/cache/
26+
**/_cache/
27+
**/.cache/
28+
29+
# GISNav docs build specific build folder
30+
docs/vitepress/docs/reference
2331

2432
# coverage.py files
2533
.coverage*
2634

2735
# SITL test log output (but leave one sample flight log)
2836
gisnav/test/sitl/output/
37+
*.ulg
38+
*.ulog
2939

3040
# Jupyter Notebook checkpoints, notebooks
3141
gisnav/test/sitl/ulog_analysis/.ipynb_checkpoints/
@@ -36,7 +46,6 @@ gisnav/test/sitl/ulog_analysis/output
3646
*.egg-info
3747

3848
# Debian package builds
39-
debian
4049
.pybuild
4150
*.deb
4251

@@ -45,3 +54,6 @@ debian
4554

4655
# node
4756
node_modules
57+
58+
# pytest
59+
*.pytest_cache/*

Makefile

Lines changed: 68 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,80 @@
11
SHELL := /bin/bash
22

3-
include gisnav/Makefile
4-
include docker/Makefile
5-
6-
# The docs/Makefile has a catch-all target so it is not included here
7-
#include docs/Makefile
8-
93
.PHONY: docs
104
docs:
115
@cd docs/sphinx && sphinx-build -M markdown ./source ./build
126
@mkdir -p docs/vitepress/docs/reference && cp -r docs/sphinx/build/markdown/* docs/vitepress/docs/reference
137
@cd docs/vitepress && npm run docs:build
148
@cd docs/vitepress/docs/.vitepress/dist && touch .nojekyll # for GitHub Pages
159

16-
.PHONY: docs-preview
17-
docs-preview:
10+
.PHONY: docs\ preview
11+
docs\ preview:
1812
@cd docs/vitepress && npm run docs:preview
1913

20-
.PHONY: docs-dev
21-
docs-preview:
14+
.PHONY: docs\ dev
15+
docs\ dev:
2216
@cd docs/vitepress && npm run docs:dev
17+
18+
.PHONY:
19+
build:
20+
@echo "Building the project..."
21+
@$(MAKE) -C debian/gisnav $@
22+
23+
.PHONY:
24+
dist: build
25+
@echo "Creating distribution package..."
26+
@$(MAKE) -C debian/gisnav $@
27+
28+
.PHONY: clean
29+
clean: clean\ docs
30+
@echo "Cleaning up..."
31+
@$(MAKE) -C debian/gisnav $@
32+
# TODO - build and dist
33+
34+
.PHONY: clean\ docs
35+
clean\ docs:
36+
@echo "Cleaning up documentation build files..."
37+
@rm -rf docs/sphinx/build
38+
@rm -rf docs/vitepress/docs/reference
39+
@rm -rf docs/vitepress/docs/.vitepress/dist
40+
41+
.PHONY: install
42+
install: dist
43+
@echo "Installing the project and dependencies..."
44+
@$(MAKE) -C debian/gisnav $@
45+
46+
.PHONY: test
47+
test:
48+
@echo "Running tests..."
49+
# TODO - run unit and launch tests (do not run simulation tests)
50+
51+
.PHONY: lint
52+
lint:
53+
@echo "Running linter..."
54+
@pre-commit run --all-files
55+
56+
# alias for lint - we do not have a "dry-run" option for lint, both
57+
# lint and format may modify the files
58+
.PHONY: format
59+
format: lint
60+
61+
.PHONY: check
62+
check: lint test
63+
@echo "Running code quality checks..."
64+
65+
.PHONY: help
66+
help:
67+
@echo "Available targets:"
68+
@echo " docs - Build the documentation"
69+
@echo " docs preview - Preview the documentation"
70+
@echo " docs dev - Run the documentation development server"
71+
@echo " build - Build the project"
72+
@echo " dist - Create a distribution package"
73+
@echo " clean - Clean up all generated files"
74+
@echo " clean docs - Clean up documentation build files only"
75+
@echo " install - Install the project and dependencies"
76+
@echo " test - Run the project's tests"
77+
@echo " lint - Run the linter to check code style"
78+
@echo " format - Automatically format the code"
79+
@echo " check - Run linter and tests"
80+
@echo " help - Show this help message"

debian/gisnav/DEBIAN/control.template

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Source: gisnav
2+
Section: utils
3+
Priority: optional
4+
Maintainer: Harri Makelin <hmakelin@protonmail.com>
5+
Build-Depends: debhelper (>= 9)
6+
Standards-Version: 4.6.0
7+
Homepage: https://gisnav.org
8+
Package: gisnav
9+
Version: ${VERSION}
10+
Architecture: all
11+
Depends: bash, docker-compose-plugin, openssh-client, coreutils, sed, x11-utils, util-linux
12+
Description: GISNav CLI Tool
13+
This package contains GISNav CLI ("gnc") - a Docker Compose wrapper that streamlines the deployment of GISNav system configurations. Additionally, it includes the "gisnav.service" systemd service (disabled by default) that can be used to ensure the Compose services are running on system startup.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: gisnav
3+
Source: https://github.com/hmakelin/gisnav
4+
5+
Files: *
6+
Copyright: 2022 Harri Makelin
7+
License: MIT
8+
The full text of the license can be found in the LICENSE.md file
9+
available at:
10+
.
11+
https://github.com/hmakelin/gisnav/blob/${VERSION}/LICENSE.md

debian/gisnav/DEBIAN/postinst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Change to the directory where the docker-compose.yml is located
5+
cd /etc/gisnav/docker
6+
7+
# The gnc CLI tool should be provided with this package
8+
# We prepare containers here as part of the installation process so that the
9+
# user experience is better when running `gnc start` for the first time (i.e.
10+
# will not have to pull or build Docker images then).
11+
# Not enabled here because this could significantly slow down install, and
12+
# cause issues with the package manager state when users inevitably interrupt
13+
# the lengthy build process.
14+
#gnc build gisnav --with-dependencies
15+
#gnc create gisnav
16+
17+
# Enable the gisnav.service at startup
18+
# Not enabled automatically here because this could significantly slow down
19+
# resource constrained edge devices.
20+
#systemctl enable gisnav.service
21+
22+
echo "Installation complete. Type 'gnc help' to see available commands."
23+
24+
exit 0

debian/gisnav/DEBIAN/postrm

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Stop and disable the systemd service
5+
if [ -x "$(command -v systemctl)" ]; then
6+
if systemctl stop gisnav.service; then
7+
echo "Successfully stopped gisnav.service."
8+
else
9+
echo "Could not stop gisnav.service - this is OK if the service was not running."
10+
fi
11+
12+
if systemctl disable gisnav.service; then
13+
echo "Successfully disabled gisnav.service."
14+
else
15+
echo "Could not disable gisnav.service - this is OK if the service was not enabled."
16+
fi
17+
else
18+
echo "systemctl command not found. Skipping service stop and disable."
19+
fi
20+
21+
# Execute docker compose down
22+
if [ -x "$(command -v docker compose)" ]; then
23+
# "down" removes containers, volumes, networks
24+
if docker compose -p gisnav down; then
25+
echo "Successfully executed docker compose down."
26+
else
27+
echo "Failed to execute docker compose down. Please stop and remove any GISNav Docker containers manually."
28+
fi
29+
else
30+
echo "docker command not found. Skipping docker compose down."
31+
fi
32+
33+
exit 0

0 commit comments

Comments
 (0)