docker: Working database creation
This commit is contained in:
parent
082823892c
commit
1654885838
|
@ -4,7 +4,7 @@ CUDA_VISIBLE_DEVICES=""
|
|||
# BirdNET-stream environment
|
||||
DATABASE_USER="birdnet"
|
||||
DATABASE_PASSWORD="secret" # change this
|
||||
DATABASE_PORT="3306" # change this if you have already a running MySQL server on the host
|
||||
DATABASE_PORT="3306"
|
||||
MYSQL_ROOT_PASSWORD="secret" # change this
|
||||
|
||||
RECORDS_DIR="/media/data/birdnet/records"
|
||||
|
|
1
TODO
1
TODO
|
@ -1,5 +1,4 @@
|
|||
- Fix service manager
|
||||
- Add docker support
|
||||
- Species i18n
|
||||
- File purge policy
|
||||
- Add and test RTSP support
|
|
@ -25,12 +25,11 @@ services:
|
|||
image: mariadb:latest
|
||||
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
ports:
|
||||
- '3306:3306'
|
||||
- ${DATABASE_PORT:-3306}:3306
|
||||
networks:
|
||||
birdnet_network:
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD:-secret}'
|
||||
MYSQL_DATABASE: ${DATABASE:-birdnet}
|
||||
MYSQL_USER: ${DATABASE_USER:-birdnet}
|
||||
MYSQL_PASSWORD: ${DATABASE_PASSWORD:-secret}
|
||||
volumes:
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
#! /usr/bin/bash
|
||||
|
||||
if [[ -z "${MYSQL_USER}" ]]; then
|
||||
MYSQL_USER="birdnet"
|
||||
echo "Defaults MYSQL_USER to $MYSQL_USER"
|
||||
fi
|
||||
if [[ -z "${MYSQL_USER_PASSWORD}" ]]; then
|
||||
echo "MYSQL_ROOT_PASSWORD is not set"
|
||||
exit 1
|
||||
fi
|
||||
sed -i "s/<MYSQL_USER>/$MYSQL_USER/g" ./01-databases.sql.template ./01-databases.sql
|
||||
sed -i "s/<MYSQL_USER_PASSWORD>/$MYSQL_USER_PASSWORD/g" ./01-databases.sql.template ./01-databases.sql
|
|
@ -0,0 +1,7 @@
|
|||
CREATE DATABASE IF NOT EXISTS `birdnet_observations`;
|
||||
CREATE DATABASE IF NOT EXISTS `birdnet_default`;
|
||||
|
||||
GRANT ALL PRIVILEGES ON birdnet_observations.* TO 'birdnet'@'%';
|
||||
GRANT ALL PRIVILEGES ON birdnet_default.* TO 'birdnet'@'%';
|
||||
|
||||
FLUSH PRIVILEGES;
|
|
@ -1,6 +0,0 @@
|
|||
CREATE DATABASE IF NOT EXISTS `birdnet_observations`;
|
||||
CREATE DATABASE IF NOT EXISTS `birdnet_default`;
|
||||
|
||||
CREATE USER '<MYSQL_USER>'@'localhost' IDENTIFIED BY '<MYSQL_PASSWORD>';
|
||||
GRANT ALL PRIVILEGES ON birdnet_observations.* TO '<MYSQL_USER>'@'%';
|
||||
GRANT ALL PRIVILEGES ON birdnet_default.* TO '<MYSQL_USER>'@'%';
|
|
@ -20,7 +20,7 @@ The splitted approach uses docker-compose and a docker container for each servic
|
|||
|
||||
This is the recommended approach to run BirdNET-stream while using docker.
|
||||
|
||||
Thirst of of all, you need to clone the repository.
|
||||
First of of all, you need to clone the repository.
|
||||
|
||||
```bash
|
||||
mkdir ~/Documents/BirdNET-stream
|
||||
|
@ -32,34 +32,14 @@ Then, run docker-compose:
|
|||
|
||||
```bash
|
||||
# Build image (first time only)
|
||||
docker compose up --build
|
||||
docker compose build
|
||||
# Run
|
||||
docker compose up -d
|
||||
docker compose up # add `-d`, to run in background
|
||||
# Stop
|
||||
docker compose down
|
||||
```
|
||||
|
||||
## Building and running each of the containers
|
||||
|
||||
### birdnet_recording container
|
||||
|
||||
Building:
|
||||
For a one liner:
|
||||
```bash
|
||||
docker build -f ./docker/recording/Dockerfile -t birdnet_recording:latest .
|
||||
docker compose up --build
|
||||
```
|
||||
Running
|
||||
```bash
|
||||
docker run --rm --device /dev/snd birdnet_recording:latest
|
||||
```
|
||||
|
||||
### birdnet_www container
|
||||
|
||||
Building:
|
||||
```bash
|
||||
docker build -f ./docker/www/Dockerfile -t birdnet_www:latest .
|
||||
```
|
||||
|
||||
Running
|
||||
```bash
|
||||
docker run --rm birdnet_www:latest
|
||||
```
|
Loading…
Reference in New Issue