From f8ef533f6a40a0028196e42bda7df0d8ba0c33d6 Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Tue, 19 Feb 2019 21:44:22 +0100 Subject: [PATCH] :whale: :bug: Provide env variables for media and static download --- README.md | 2 ++ backend/Dockerfile | 2 ++ docker-compose.yml | 3 +++ frontend/docker-nginx/conf.d/default.conf | 11 ++++++++++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8dae624fe..b0ac841ce 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ The following environment variables are also honored for configuring your UXBOX #### Backend - `-e UXBOX_HTTP_SERVER_DEBUG=...` (defaults to false) +- `-e UXBOX_MEDIA_BASEURI=...` (defaults to http://localhost:6060/media/) +- `-e UXBOX_STATIC_BASEURI=...` (defaults to http://localhost:6060/static/) - `-e UXBOX_DATABASE_USERNAME="..."` (defaults to uxbox) - `-e UXBOX_DATABASE_PASSWORD="..."` (defaults to youshouldoverwritethiswithsomethingelse) - `-e UXBOX_DATABASE_NAME="..."` (defaults to uxbox) diff --git a/backend/Dockerfile b/backend/Dockerfile index 82f1bb9bf..b492ed3ed 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -21,6 +21,8 @@ COPY --from=0 /home/uxbox/backend/dist/uxbox-backend.jar /srv/uxbox/app.jar COPY --from=0 /home/uxbox/backend/docker-entrypoint.sh /entrypoint.sh ENV UXBOX_HTTP_SERVER_DEBUG=false \ + UXBOX_MEDIA_BASEURI="http://localhost:6060/media/" \ + UXBOX_STATIC_BASEURI="http://localhost:6060/static/" \ UXBOX_DATABASE_USERNAME="uxbox" \ UXBOX_DATABASE_PASSWORD="youshouldoverwritethiswithsomethingelse" \ UXBOX_DATABASE_NAME="uxbox" \ diff --git a/docker-compose.yml b/docker-compose.yml index dcf132408..c9e93f8e7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,6 +33,8 @@ services: environment: # HTTP setup - UXBOX_HTTP_SERVER_DEBUG=false + - UXBOX_MEDIA_BASEURI=http://localhost:6060/media/ + - UXBOX_STATIC_BASEURI=http://localhost:6060/static/ # Database setup - UXBOX_DATABASE_USERNAME="uxbox" - UXBOX_DATABASE_PASSWORD="uxbox_postgres_password" @@ -72,5 +74,6 @@ services: #- "API_URL=http://uxbox.io/api/" volumes: #- /srv/uxbox/frontend/html:/usr/share/nginx/html + - /srv/uxbox/backend/resources:/srv/uxbox/resources:ro - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro diff --git a/frontend/docker-nginx/conf.d/default.conf b/frontend/docker-nginx/conf.d/default.conf index df1d0ed4b..0f8f1689d 100644 --- a/frontend/docker-nginx/conf.d/default.conf +++ b/frontend/docker-nginx/conf.d/default.conf @@ -41,6 +41,14 @@ server { alias /usr/share/nginx/html/view; } + location /media { + alias /srv/uxbox/resources/media; + } + + location /static { + alias /srv/uxbox/resources/static; + } + # Backend location /api/ { # Reverse Proxy to Backend (Avoids XSS concerns) --Update backend to be whatever your site uses to access your backend @@ -56,4 +64,5 @@ server { # IMPORTANT: Update uxbox.{{ DOMAIN }} to your production site. This will allow cookies to work as expected when using your deployment locally #proxy_cookie_domain localhost uxbox.{{ DOMAIN }}; } -} \ No newline at end of file + +}