From a557723b35d17b9cc19cb76521edd942ad88bc5b Mon Sep 17 00:00:00 2001 From: Samuel ORTION Date: Mon, 22 Aug 2022 20:27:33 +0200 Subject: [PATCH] docker: Symfony webapp seems to work (no database connection yet) --- .env | 4 ++-- .env.example | 6 +++--- CHANGELOG.md | 2 ++ docker-compose.yml | 29 +++++++++++++++-------------- docker/nginx/Dockerfile | 8 ++++---- docker/nginx/nginx.conf.template | 6 +++--- install.sh | 4 ++-- www/nginx.conf.template | 4 ++-- 8 files changed, 33 insertions(+), 30 deletions(-) diff --git a/.env b/.env index b842c9e..5c97b48 100644 --- a/.env +++ b/.env @@ -7,6 +7,6 @@ DATABASE_PASSWORD="AShoo1N" DATABASE_PORT="3306" # Change this if you have already a running MySQL server on the host DATABASE_ROOT_PASSWORD="Ojiex5v" -RECORDS_FOLDER=/media/DATA/birdnet/records/ +RECORDS_DIR=/media/DATA/birdnet/records/ CHARTS_FOLDER=/media/DATA/birdnet/charts/ -SERVER_NAME="birdnet.local" \ No newline at end of file +SERVER_NAME="birdnet.local" diff --git a/.env.example b/.env.example index 2637633..6920f0d 100644 --- a/.env.example +++ b/.env.example @@ -7,6 +7,6 @@ DATABASE_PASSWORD="secret" # change this DATABASE_PORT="3306" # change this if you have already a running MySQL server on the host MYSQL_ROOT_PASSWORD="secret" # change this -RECORDS_FOLDER="/media/data/birdnet/records" -CHARTS_FOLDER="/media/data/birdnet/charts" -SERVER_NAME="birdnet.local" \ No newline at end of file +RECORDS_DIR="/media/data/birdnet/records" +CHARTS_DIR="/media/data/birdnet/charts" +SERVER_NAME="birdnet.local" diff --git a/CHANGELOG.md b/CHANGELOG.md index c87fbde..58dc8c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## v0.0.1-alpha + ## v0.0.1-rc - Integrate BirdNET-Analyzer as submodule diff --git a/docker-compose.yml b/docker-compose.yml index 2ba65ab..e926e6e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: # environment: # - CHUNK_FOLDER=${CHUNK_FOLDER:-/media/birdnet/records} # volumes: - # - ${RECORDS_FOLDER:-/media/birdnet/records}:${RECORS_FOLDER:-/media/birdnet/records} + # - ${RECORDS_DIR:-/media/birdnet/records}:${RECORS_FOLDER:-/media/birdnet/records} # # Allow container to access to the hosts microphone # devices: # - /dev/snd:/dev/snd @@ -41,7 +41,7 @@ services: container_name: birdnet_php-fpm image: php:${PHP_VERSION:-8.1}-fpm ports: - - ${PHP_FPM_PORT:-9000}:9000 + - '9000:9000' networks: birdnet_network: restart: unless-stopped @@ -58,32 +58,33 @@ services: environment: - DATABASE_DEFAULT_URL=${DATABASE_DEFAULT_URL:-mysql://${DATABASE_USER:-birdnet}:${DATABASE_PASSWORD:-secret}@${DATABASE_HOST:-db}:3306/birdnet_default} - DATABASE_OBSERVATION_URL=${DATABASE_OBSERVATION_URL:-mysql://${DATABASE_USER:-birdnet}:${DATABASE_PASSWORD:-secret}@${DATABASE_HOST:-db}:3306/birdnet_observation} - - RECORDS_FOLDER=${RECORDS_FOLDER:-/media/birdnet/records} - restart: unless-stopped + - RECORDS_DIR=/media/birdnet/records + restart: on-failure volumes: - birdnet_app:${PROJECT_ROOT:-/opt/birdnet} - - birdnet_recordings:${RECORDS_FOLDER:-/media/birdnet/records} + - birdnet_records:${RECORDS_DIR:-/media/birdnet/records} depends_on: - db nginx: container_name: birdnet_nginx + hostname: ${SERVER_NAME:-birdnet.local} build: context: . dockerfile: ./docker/nginx/Dockerfile args: - SERVER_NAME=${SERVER_NAME:-birnet.local} - - SYMFONY_PUBLIC=${SYMFONY_PUBLIC:-/opt/birdnet/www/public} - - CHARTS_FOLDER=${CHARTS_FOLDER:-/media/birdnet/charts} - - RECORDS_FOLDER=${RECORDS_FOLDER:-/media/birdnet/records} - - PHP_FPM_HOST=${PHP_FPM_HOST:-php-fpm} - - PHP_FPM_PORT=${PHP_FPM_PORT:-9000} + - SYMFONY_PUBLIC=/opt/birdnet/www/public + - CHARTS_DIR=/media/birdnet/charts + - RECORDS_DIR=/media/birdnet/records + - PHP_FPM_HOST=php-fpm + - PHP_FPM_PORT=9000 ports: - '80:80' - '443:443' volumes: - - birdnet_app:${RECORDS_FOLDER-/opt/birdnet} - - birdnet_recordings:${RECORDS_FOLDER-/media/data/records} + - birdnet_app:/opt/birdnet + - birdnet_records:/media/data/records networks: birdnet_network: ipv4_address: ${IP_ADDRESS:-172.25.0.101} @@ -103,8 +104,8 @@ networks: volumes: birdnet_app: - birdnet_recordings: + birdnet_records: driver_opts: type: none - device: ${RECORDS_FOLDER:-/media/data/records} + device: ${RECORDS_DIR:-/media/data/records} o: bind \ No newline at end of file diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile index ab567b7..783e466 100644 --- a/docker/nginx/Dockerfile +++ b/docker/nginx/Dockerfile @@ -3,8 +3,8 @@ FROM nginx ARG SERVER_NAME ARG PROJECT_ROOT ARG SYMFONY_PUBLIC -ARG CHARTS_FOLDER -ARG RECORDS_FOLDER +ARG CHARTS_DIR +ARG RECORDS_DIR ARG PHP_FPM_HOST ARG PHP_FPM_PORT @@ -18,8 +18,8 @@ RUN sed -i "s||${SERVER_NAME}|g" /etc/nginx/sites-available/birdnet && sed -i "s||${PHP_FPM_HOST}|g" /etc/nginx/sites-available/birdnet.conf \ && sed -i "s||${PHP_FPM_PORT}|g" /etc/nginx/sites-available/birdnet.conf \ && sed -i "s||${SYMFONY_PUBLIC}|g" /etc/nginx/sites-available/birdnet.conf \ - && sed -i "s||${RECORDS_FOLDER}|g" /etc/nginx/sites-available/birdnet.conf \ - && sed -i "s||${CHARTS_FOLDER}|g" /etc/nginx/sites-available/birdnet.conf + && sed -i "s||${RECORDS_DIR}|g" /etc/nginx/sites-available/birdnet.conf \ + && sed -i "s||${CHARTS_DIR}|g" /etc/nginx/sites-available/birdnet.conf RUN mkdir -p /etc/nginx/certs/birdnet WORKDIR /etc/nginx/certs/birdnet RUN openssl req -x509 -newkey rsa:4096 -keyout privkey.pem -out fullchain.pem -sha256 -days 365 -nodes --subj "/CN=${SERVER_NAME}" diff --git a/docker/nginx/nginx.conf.template b/docker/nginx/nginx.conf.template index b69328e..2339a05 100644 --- a/docker/nginx/nginx.conf.template +++ b/docker/nginx/nginx.conf.template @@ -27,17 +27,17 @@ server { index index.php; location / { - try_files $uri $uri/ /index.php$is_args$args; + try_files $uri $uri/ /index.php$is_args$args; } location ^~ /media/records { autoindex on; - alias ; + alias ; } location ^~ /media/charts { autoindex on; - alias ; + alias ; } location ~ \.php$ { diff --git a/install.sh b/install.sh index b60ccc0..d75f204 100755 --- a/install.sh +++ b/install.sh @@ -166,8 +166,8 @@ setup_http_server() { debug "Info: Please edit /etc/nginx/sites-available/birdnet-stream.conf to set the correct server name and paths" debug "Setup nginx variables the best way possible" sudo sed -i "s||$WORKDIR/www/public/|g" /etc/nginx/sites-available/birdnet-stream.conf - sudo sed -i "s||$CHUNK_FOLDER/out|g" /etc/nginx/sites-available/birdnet-stream.conf - sudo sed -i "s||$WORKDIR/var/charts|g" /etc/nginx/sites-available/birdnet-stream.conf + sudo sed -i "s||$CHUNK_FOLDER/out|g" /etc/nginx/sites-available/birdnet-stream.conf + sudo sed -i "s||$WORKDIR/var/charts|g" /etc/nginx/sites-available/birdnet-stream.conf debug "Generate self signed certificate" CERTS_LOCATION="/etc/nginx/certs/birdnet" sudo mkdir -p "$CERTS_LOCATION" diff --git a/www/nginx.conf.template b/www/nginx.conf.template index 5ff5628..c5156ac 100644 --- a/www/nginx.conf.template +++ b/www/nginx.conf.template @@ -32,12 +32,12 @@ server { location ^~ /media/records { autoindex on; - alias ; + alias ; } location ^~ /media/charts { autoindex on; - alias ; + alias ; } location ~ \.php$ {