docker: Symfony webapp seems to work (no database connection yet)

This commit is contained in:
Samuel Ortion 2022-08-22 20:27:33 +02:00
parent c1af47eb26
commit a557723b35
8 changed files with 33 additions and 30 deletions

4
.env
View File

@ -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"
SERVER_NAME="birdnet.local"

View File

@ -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"
RECORDS_DIR="/media/data/birdnet/records"
CHARTS_DIR="/media/data/birdnet/charts"
SERVER_NAME="birdnet.local"

View File

@ -1,5 +1,7 @@
# Changelog
## v0.0.1-alpha
## v0.0.1-rc
- Integrate BirdNET-Analyzer as submodule

View File

@ -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

View File

@ -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>|${SERVER_NAME}|g" /etc/nginx/sites-available/birdnet
&& sed -i "s|<PHP_FPM_HOST>|${PHP_FPM_HOST}|g" /etc/nginx/sites-available/birdnet.conf \
&& sed -i "s|<PHP_FPM_PORT>|${PHP_FPM_PORT}|g" /etc/nginx/sites-available/birdnet.conf \
&& sed -i "s|<SYMFONY_PUBLIC>|${SYMFONY_PUBLIC}|g" /etc/nginx/sites-available/birdnet.conf \
&& sed -i "s|<RECORDS_FOLDER>|${RECORDS_FOLDER}|g" /etc/nginx/sites-available/birdnet.conf \
&& sed -i "s|<CHARTS_FOLDER>|${CHARTS_FOLDER}|g" /etc/nginx/sites-available/birdnet.conf
&& sed -i "s|<RECORDS_DIR>|${RECORDS_DIR}|g" /etc/nginx/sites-available/birdnet.conf \
&& sed -i "s|<CHARTS_DIR>|${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}"

View File

@ -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 <RECORDS_FOLDER>;
alias <RECORDS_DIR>;
}
location ^~ /media/charts {
autoindex on;
alias <CHARTS_FOLDER>;
alias <CHARTS_DIR>;
}
location ~ \.php$ {

View File

@ -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|<SYMFONY_PUBLIC>|$WORKDIR/www/public/|g" /etc/nginx/sites-available/birdnet-stream.conf
sudo sed -i "s|<RECORDS_FOLDER>|$CHUNK_FOLDER/out|g" /etc/nginx/sites-available/birdnet-stream.conf
sudo sed -i "s|<CHARTS_FOLDER>|$WORKDIR/var/charts|g" /etc/nginx/sites-available/birdnet-stream.conf
sudo sed -i "s|<RECORDS_DIR>|$CHUNK_FOLDER/out|g" /etc/nginx/sites-available/birdnet-stream.conf
sudo sed -i "s|<CHARTS_DIR>|$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"

View File

@ -32,12 +32,12 @@ server {
location ^~ /media/records {
autoindex on;
alias <RECORDS_FOLDER>;
alias <RECORDS_DIR>;
}
location ^~ /media/charts {
autoindex on;
alias <CHARTS_FOLDER>;
alias <CHARTS_DIR>;
}
location ~ \.php$ {