Fix docker compose and add restart script

This commit is contained in:
30hours 2023-10-27 10:25:12 +10:30
parent 88897b862a
commit 0e1cef7874
4 changed files with 20 additions and 5 deletions

View file

@ -30,14 +30,14 @@ The build environment consists of a docker-compose.yml file running the followin
- Run the docker-compose command.
```bash
git clone http://github.com/30hours/blah2
cd blah2
sudo git clone http://github.com/30hours/blah2 /opt/blah2
cd /opt/blah2
vim config/config.yml
./lib/sdrplay-3.0.7/SDRplay_RSP_API-Linux-3.07.1.run --tar -xvf
./lib/sdrplay-3.0.7/install.sh
sudo mkdir /opt/blah2
sudo chmod a+rw /opt/blah2
sudo docker-compose up -d
sudo docker network create blah2
sudo systemctl enable docker
sudo docker compose up -d
```
The radar processing output is available on [http://localhost:49152](http://localhost:49152).

View file

@ -12,6 +12,8 @@ services:
context: .
dockerfile: Dockerfile
image: blah2
depends_on:
- blah2_api
volumes:
- /dev/shm:/dev/shm
- /run/systemd/system:/run/systemd/system

12
script/blah2.bash Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
# Run script with a crontab to automatically restart on error.
# Checks the API to see if data is still being pushed through.
FIRST_CHAR=$(curl -s 127.0.0.1:3000/map | head -c1)
if [[ "$FIRST_CHAR" != "{" ]]; then
docker compose -f /opt/blah2/docker-compose.yml down
systemctl restart sdrplay.service
docker compose -f /opt/blah2/docker-compose.yml up -d
fi

1
script/crontab.txt Normal file
View file

@ -0,0 +1 @@
* * * * * /opt/blah2/script/blah2.bash