From 4abf23689d67e7b30958d8ac5302e5e1f43699b7 Mon Sep 17 00:00:00 2001 From: Nathan Richman Date: Tue, 26 Jun 2018 20:49:17 +0000 Subject: [PATCH 1/2] Added ability to attach volume(s) to mup-nginx-proxy docker container --- src/plugins/proxy/assets/templates/start.sh | 2 +- src/plugins/proxy/command-handlers.js | 5 +++-- src/plugins/proxy/validate.js | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/proxy/assets/templates/start.sh b/src/plugins/proxy/assets/templates/start.sh index d0d2c833..091bec3b 100644 --- a/src/plugins/proxy/assets/templates/start.sh +++ b/src/plugins/proxy/assets/templates/start.sh @@ -41,7 +41,6 @@ NGINX_CONFIG_PATH="/opt/$APPNAME/config/nginx-default.conf" if ! grep -q "client_max_body_size" "$NGINX_CONFIG_PATH"; then echo $NGINX_CONFIG >> /opt/$APPNAME/config/nginx-default.conf fi - sudo docker run \ -d \ -p $HTTP_PORT:80 \ @@ -54,6 +53,7 @@ sudo docker run \ -v /opt/$APPNAME/config/html:/usr/share/nginx/html \ -v /opt/$APPNAME/config/nginx-default.conf:/etc/nginx/conf.d/my_proxy.conf:ro \ -v /var/run/docker.sock:/tmp/docker.sock:ro \ + <% for(var volume in volumes) { %>-v <%= volume %>:<%= volumes[volume] %> <% } %> \ jwilder/nginx-proxy echo "Ran nginx-proxy as $APPNAME" diff --git a/src/plugins/proxy/command-handlers.js b/src/plugins/proxy/command-handlers.js index f54feb02..28dd5e2e 100644 --- a/src/plugins/proxy/command-handlers.js +++ b/src/plugins/proxy/command-handlers.js @@ -67,7 +67,8 @@ export function setup(api) { dest: `/opt/${PROXY_CONTAINER_NAME}/config/start.sh`, vars: { appName: PROXY_CONTAINER_NAME, - letsEncryptEmail: config.ssl ? config.ssl.letsEncryptEmail : null + letsEncryptEmail: config.ssl ? config.ssl.letsEncryptEmail : null, + volumes: config.volumes } }); @@ -212,7 +213,7 @@ export function start(api) { list.executeScript('Start proxy', { script: api.resolvePath(__dirname, 'assets/proxy-start.sh'), vars: { - appName: PROXY_CONTAINER_NAME + appName: PROXY_CONTAINER_NAME, } }); diff --git a/src/plugins/proxy/validate.js b/src/plugins/proxy/validate.js index 9356bf2e..da9969a4 100644 --- a/src/plugins/proxy/validate.js +++ b/src/plugins/proxy/validate.js @@ -14,6 +14,7 @@ const schema = joi.object().keys({ .or('letsEncryptEmail', 'crt', 'forceSSL'), domains: joi.string().required(), nginxServerConfig: joi.string(), + volumes: joi.object(), nginxLocationConfig: joi.string(), clientUploadLimit: joi.string(), shared: joi.object().keys({ From 6f9d3631af7668d51262d705d6fe5d443ef45954 Mon Sep 17 00:00:00 2001 From: Nathan Richman Date: Wed, 27 Jun 2018 14:18:45 +0000 Subject: [PATCH 2/2] Syntax --- src/plugins/proxy/command-handlers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/proxy/command-handlers.js b/src/plugins/proxy/command-handlers.js index 28dd5e2e..c1163763 100644 --- a/src/plugins/proxy/command-handlers.js +++ b/src/plugins/proxy/command-handlers.js @@ -213,7 +213,7 @@ export function start(api) { list.executeScript('Start proxy', { script: api.resolvePath(__dirname, 'assets/proxy-start.sh'), vars: { - appName: PROXY_CONTAINER_NAME, + appName: PROXY_CONTAINER_NAME } });