From 44263c250f27139f8e8a0e80005c525a7786a482 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 21 Nov 2020 14:50:27 +0000 Subject: [PATCH] Remove unnecessary configuration and prepare for more containers --- docker-compose.yml | 19 ++++++------------- monica/entrypoint.sh | 3 +++ nginx.conf | 8 +++++--- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f49425b..9ba1f78 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,12 @@ version: "3.4" services: - app: + monica: build: ./monica image: monica env_file: ./monica/.env volumes: - - data:/var/www/html/storage + - monica-data:/var/www/html/storage - monica-public:/var/www/html/public restart: always depends_on: @@ -27,18 +27,15 @@ services: image: nginx:alpine restart: always volumes: - - data:/var/www/html/storage:ro - certs:/etc/nginx/certs:ro - ./nginx.conf:/etc/nginx/nginx.conf - - monica-public:/var/www/html/public:ro + - monica-public:/var/www/html/monica/public:ro + - monica-data:/var/www/html/monica/storage:ro depends_on: - - app + - monica ports: - 80:80 - 443:443 - networks: - - proxy-tier - - default depends_on: - omgwtfssl @@ -53,14 +50,10 @@ services: - SSL_KEY=/certs/personel.scarif.local.key - SSL_CSR=/certs/personel.scarif.local.csr - SSL_CERT=/certs/personel.scarif.local.crt - networks: - - proxy-tier volumes: - data: db: certs: monica-public: + monica-data: -networks: - proxy-tier: diff --git a/monica/entrypoint.sh b/monica/entrypoint.sh index b98d29c..3d390de 100644 --- a/monica/entrypoint.sh +++ b/monica/entrypoint.sh @@ -50,6 +50,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then # Run migrations waitfordb ${ARTISAN} monica:update --force -vv + # Override the linking done by monica:update to use relative paths so the nginx directory can be anywhere + unlink ${MONICADIR}/public/storage + ln -s ../storage/app/public /var/www/html/public/storage if [ -n "${SENTRY_SUPPORT:-}" -a "$SENTRY_SUPPORT" = "true" -a -z "${SENTRY_NORELEASE:-}" -a -n "${SENTRY_ENV:-}" ]; then commit=$(cat .sentry-commit) diff --git a/nginx.conf b/nginx.conf index a846877..69b813f 100644 --- a/nginx.conf +++ b/nginx.conf @@ -29,7 +29,7 @@ http { # Connect to app service upstream php-handler { - server app:9000; + server monica:9000; } server { @@ -59,7 +59,7 @@ http { # Remove X-Powered-By, which is an information leak fastcgi_hide_header X-Powered-By; - root /var/www/html/public; + root /var/www/html/monica/public; index index.html index.htm index.php; @@ -115,7 +115,9 @@ http { include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + # Cannot use $document_root as the path to monica on the docker container + # is different to the path to the public files in this nginx container. + fastcgi_param SCRIPT_FILENAME /var/www/html/public$fastcgi_script_name; # Bypass the fact that try_files resets $fastcgi_path_info # see: http://trac.nginx.org/nginx/ticket/321 set $path_info $fastcgi_path_info;