diff --git a/Dockerfile b/Dockerfile index fb38c0a..e988c43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -80,3 +80,4 @@ VOLUME ["/import"] WORKDIR /import/ # Start RStudio CMD /startup.sh +EXPOSE 80 diff --git a/proxy.conf b/proxy.conf index a04e359..b156cb7 100644 --- a/proxy.conf +++ b/proxy.conf @@ -1,19 +1,18 @@ server { - # listen IE_PORT; listen 80; server_name localhost; access_log /var/log/nginx/localhost.access.log; # Some help from https://superuser.com/questions/689885/make-nginx-reverse-proxy-302-redirect-to-a-uri-sub-folder-instead-of-root - location ^~ /rstudio/IE_PORT/ { + location ^~ PROXY_PREFIX/rstudio/ { add_header 'Access-Control-Allow-Origin' '*'; # IE_CORS_ORIGIN add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; proxy_buffering off; - rewrite /rstudio/IE_PORT/(.*) /$1 break; + rewrite PROXY_PREFIX/rstudio/(.*) /$1 break; proxy_pass http://127.0.0.1:8787; - proxy_redirect http://127.0.0.1:8787/ /rstudio/IE_PORT/; + proxy_redirect http://127.0.0.1:8787/ PROXY_PREFIX/rstudio/; } } diff --git a/startup.sh b/startup.sh index 594af9e..a8b8ede 100755 --- a/startup.sh +++ b/startup.sh @@ -1,7 +1,7 @@ #!/bin/bash sed -i "s| '\*'; # IE_CORS_ORIGIN| '${CORS_ORIGIN}';|" /proxy.conf; -sed -i "s/IE_PORT/${DOCKER_PORT}/" /proxy.conf; +sed -i "s|PROXY_PREFIX|${PROXY_PREFIX}|" /proxy.conf; cp /proxy.conf /etc/nginx/sites-enabled/default # The RStudio image starts as privileged user. The parent Galaxy server is @@ -40,6 +40,6 @@ GALAXY_URL=$GALAXY_URL " > /etc/profile.d/galaxy.sh # Launch traffic monitor -monitor_traffic.sh & +/monitor_traffic.sh & # And nginx in foreground mode. nginx -g 'daemon off;'