Skip to content

Commit 5badc9e

Browse files
authored
Merge pull request #142 from strykeforce/docker-instructions
Added instructions to run Deadeye in Docker
2 parents 4aa540b + f256fae commit 5badc9e

File tree

3 files changed

+122
-9
lines changed

3 files changed

+122
-9
lines changed

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
11
# Deadeye
22

33
**Deadeye** is a vision system for FIRST<sup>®</sup> Robotics Competition
4-
robots designed to be run on a vision coprocessor, such as the [Jetson Nano
5-
Developer Kit][jndk]. It consists of several parts:
4+
robots designed to be run on a vision coprocessor, such as a Linux single-board
5+
computer. It has been actively used with the [Jetson Nano Developer Kit][jndk]
6+
and [Orange Pi 5 Plus][orangepi]. It consists of several parts:
67

78
[jndk]: https://developer.nvidia.com/EMBEDDED/jetson-nano-developer-kit/
9+
[orangepi]: http://www.orangepi.org/index.html
810

911
- Vision Daemon - C++ vision capture and processing pipeline.
1012
- Client Library - Java library for use with FRC robots and other clients
1113
- Admin Web UI - React web interface to manage Deadeye vision system.
1214
- Admin Server and Tools - Python web service to connect admin web UI to vision
1315
daemon backend.
14-
- Provisioning Tools - Ansible playbooks for provisioning and deploying the
15-
system to vision coprocessors.
16+
- Deployment Tools - Ansible playbooks for provisioning and deploying the
17+
system to vision coprocessors. **This method of deployment is deprecated in favor of using Docker (see below).**
1618

1719
## Documentation
1820

19-
- [Installation and usage instructions](https://strykeforce.github.io/deadeye/)
21+
- [Installation and usage instructions](https://strykeforce.github.io/deadeye/) - these instructions are deprecated in favor of using Docker (see below).
2022
- The Java client library [javadocs](https://strykeforce.github.io/deadeye/javadoc/)
2123

24+
## Docker Installation and Usage
25+
26+
This is the preferred method of deploying and operating the Deadeye system.
27+
Docker is readily available on most, if not all, Linux distributions used on
28+
vision coproccessors. See the [installation and usage instructions](./docker/)
29+
in the docker subdirectory of this repo.
30+
2231
## Contributing
2332

2433
Deadeye is free and open source. You can find the source code on

docker/README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Docker Installation and Usage
2+
3+
This is the preferred method of deploying and operating the Deadeye system.
4+
Docker is readily available on most, if not all, Linux distributions used on
5+
vision coproccessors.
6+
7+
## Installation
8+
9+
We'll use the [Docker Compose](https://docs.docker.com/compose/) tool to deploy
10+
and operate Deadeye. The example commands below work on an Orange Pi running
11+
their Ubuntu based [Orange Pi OS
12+
(OH)](http://www.orangepi.org/html/softWare/orangePiOS/oh.html).
13+
14+
```sh
15+
sudo apt update
16+
sudo apt install docker-compose-plugin
17+
```
18+
19+
### Docker Compose
20+
21+
Edit the `docker-compose.yaml` file as appropriate for your system. Select the
22+
[docker image tags](https://hub.docker.com/search?q=j3ff/deadeye) to use and
23+
edit the lines containing:
24+
25+
```yaml
26+
daemon:
27+
image: j3ff/deadeye-daemon:<TAG>
28+
admin:
29+
image: j3ff/deadeye-admin:<TAG>
30+
web:
31+
image: j3ff/deadeye-web:<TAG>
32+
```
33+
34+
There are a number of environment variables beginning with `DEADEYE_` that you
35+
may need to edit.
36+
37+
### systemd
38+
39+
The Deadeye containers are run using systemd instead of normal container restart
40+
policies to work around Docker issues with camera device names.
41+
42+
Edit and install the `deadeye.service` systemd service definition as appropriate
43+
for your system, for example:
44+
45+
```
46+
Environment="DOCKER_COMPOSE_FILE=/home/orangepi/deadeye/docker-compose.yml"
47+
Environment="CAMERA_PATH=/dev/v4l/by-id/usb-Microsoft_Microsoft®_LifeCam_HD-3000-video-index0"
48+
```
49+
50+
Install in `/etc/systemd/system/deadeye.service` and reload systemd services:
51+
52+
```sh
53+
systemctl daemon-reload
54+
```
55+
56+
## Operation
57+
58+
Start the Deadeye containers with:
59+
60+
```sh
61+
sudo systemctl start deadeye
62+
```
63+
64+
Stop the Deadeye containers with:
65+
66+
```sh
67+
sudo systemctl stop deadeye
68+
```
69+
70+
View container logs:
71+
72+
```sh
73+
# in directory containing docker-compose.yaml
74+
docker compose logs -f
75+
76+
# or alternatively, where SERVICE is one of: admin, daemon, web
77+
docker compose logs $SERVICE
78+
```
79+
80+
Updating the containers to a new version:
81+
82+
```sh
83+
sudo systemctl stop deadeye
84+
85+
# in directory containing docker-compose.yaml
86+
# edit the docker image tag(s) in docker-compose.yaml
87+
docker compose pull
88+
89+
# it's a good idea to recreate the docker network
90+
docker compose down
91+
92+
sudo systemctl start deadeye
93+
```
94+
95+
Clean up old docker images and containers.
96+
97+
```sh
98+
docker system prune
99+
```

docker/deadeye.service

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@ Requires=docker.service
66
[Service]
77
Type=oneshot
88
RemainAfterExit=yes
9+
10+
Environment="DOCKER_COMPOSE_FILE=/home/orangepi/deadeye/docker-compose.yml"
11+
Environment="CAMERA_PATH=/dev/v4l/by-id/usb-Microsoft_Microsoft®_LifeCam_HD-3000-video-index0"
12+
913
ExecStart=/bin/bash -c '\
10-
CAMERA_DEV=$(readlink --canonicalize --no-newline /dev/v4l/by-id/usb-Microsoft_Microsoft®_LifeCam_HD-3000-video-index0) \
11-
docker compose -f /home/orangepi/deadeye/docker-compose.yml up --detach \
14+
CAMERA_DEV=$(readlink --canonicalize --no-newline ${CAMERA_PATH}) \
15+
docker compose -f "${DOCKER_COMPOSE_FILE}" up --detach \
1216
'
17+
1318
ExecStop=/bin/bash -c '\
14-
CAMERA_DEV=$(readlink --canonicalize --no-newline /dev/v4l/by-id/usb-Microsoft_Microsoft®_LifeCam_HD-3000-video-index0) \
15-
docker compose -f /home/orangepi/deadeye/docker-compose.yml stop \
19+
CAMERA_DEV=$(readlink --canonicalize --no-newline ${CAMERA_PATH}) \
20+
docker compose -f "${DOCKER_COMPOSE_FILE}" stop \
1621
'
1722

1823
[Install]

0 commit comments

Comments
 (0)