diff --git a/Jenkinsfile b/Jenkinsfile index f5ec6523..74dc0a1e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -65,6 +65,7 @@ pipeline { // See: https://github.com/yarnpkg/yarn/issues/3254 sh '''docker run --rm \\ -v "$(pwd)/backend:/app" \\ + -v "$(pwd)/global:/app/global" \\ -w /app \\ node:latest \\ sh -c "yarn install && yarn eslint . && rm -rf node_modules" diff --git a/backend/internal/certificate.js b/backend/internal/certificate.js index fc11a31e..641b494e 100644 --- a/backend/internal/certificate.js +++ b/backend/internal/certificate.js @@ -13,7 +13,7 @@ const internalNginx = require('./nginx'); const internalHost = require('./host'); const certbot_command = '/usr/bin/certbot'; const le_config = '/etc/letsencrypt.ini'; -const dns_plugins = require('../../global/certbot-dns-plugins') +const dns_plugins = require('../global/certbot-dns-plugins'); function omissions() { return ['is_deleted']; diff --git a/backend/routes/api/nginx/certificates.js b/backend/routes/api/nginx/certificates.js index 50d39137..553a0bba 100644 --- a/backend/routes/api/nginx/certificates.js +++ b/backend/routes/api/nginx/certificates.js @@ -58,6 +58,7 @@ router .post((req, res, next) => { apiValidator({$ref: 'endpoints/certificates#/links/1/schema'}, req.body) .then((payload) => { + req.setTimeout(900000); // 15 minutes timeout return internalCertificate.create(res.locals.access, payload); }) .then((result) => { @@ -197,6 +198,7 @@ router * Renew certificate */ .post((req, res, next) => { + req.setTimeout(900000); // 15 minutes timeout internalCertificate.renew(res.locals.access, { id: parseInt(req.params.certificate_id, 10) }) diff --git a/docker/rootfs/etc/nginx/conf.d/dev.conf b/docker/rootfs/etc/nginx/conf.d/dev.conf index b70db17c..edbdec8a 100644 --- a/docker/rootfs/etc/nginx/conf.d/dev.conf +++ b/docker/rootfs/etc/nginx/conf.d/dev.conf @@ -17,6 +17,9 @@ server { proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://127.0.0.1:3000/; + + proxy_read_timeout 15m; + proxy_send_timeout 15m; } location / { diff --git a/docker/rootfs/etc/nginx/conf.d/production.conf b/docker/rootfs/etc/nginx/conf.d/production.conf index b632bcec..877e51dd 100644 --- a/docker/rootfs/etc/nginx/conf.d/production.conf +++ b/docker/rootfs/etc/nginx/conf.d/production.conf @@ -18,6 +18,9 @@ server { proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://127.0.0.1:3000/; + + proxy_read_timeout 15m; + proxy_send_timeout 15m; } location / { diff --git a/frontend/js/app/api.js b/frontend/js/app/api.js index 1d7b3583..baa5cb1d 100644 --- a/frontend/js/app/api.js +++ b/frontend/js/app/api.js @@ -586,7 +586,8 @@ module.exports = { /** * @param {Object} data */ - create: function (data, timeout = 180000) { + create: function (data) { + const timeout = 180000 + (data.meta.propagation_seconds ? Number(data.meta.propagation_seconds) * 1000 : 0); return fetch('post', 'nginx/certificates', data, {timeout}); }, diff --git a/frontend/js/app/nginx/certificates/form.js b/frontend/js/app/nginx/certificates/form.js index df38159b..94b18a81 100644 --- a/frontend/js/app/nginx/certificates/form.js +++ b/frontend/js/app/nginx/certificates/form.js @@ -167,8 +167,7 @@ module.exports = Mn.View.extend({ } }) .then(() => { - const timeout = 180000 + (data.meta.propagation_seconds ? Number(data.meta.propagation_seconds) : 0); - return App.Api.Nginx.Certificates.create(data, timeout); + return App.Api.Nginx.Certificates.create(data); }) .then(result => { view.model.set(result); @@ -187,12 +186,13 @@ module.exports = Mn.View.extend({ }); }) .catch(err => { - try{ - const error_message = JSON.parse(err.debug).debug.stack.join("\n"); - this.ui.le_error_info[0].innerHTML = `
${err.message}
${error_message}`; - } catch(e) { - this.ui.le_error_info[0].innerHTML = `
${err.message}
`; + let more_info = ''; + if(err.code === 500){ + try{ + more_info = JSON.parse(err.debug).debug.stack.join("\n"); + } catch(e) {} } + this.ui.le_error_info[0].innerHTML = `${err.message}${more_info !== '' ? `${more_info}`:''}`; this.ui.le_error_info.show(); this.ui.le_error_info[0].scrollIntoView(); this.ui.loader_content.hide(); diff --git a/scripts/frontend-build b/scripts/frontend-build index 506a3347..45c6d599 100755 --- a/scripts/frontend-build +++ b/scripts/frontend-build @@ -10,7 +10,7 @@ if hash docker 2>/dev/null; then docker pull "${DOCKER_IMAGE}" cd "${DIR}/.." echo -e "${BLUE}❯ ${CYAN}Building Frontend ...${RESET}" - docker run --rm -e CI=true -v "$(pwd)/frontend:/app/frontend" -w /app/frontend "$DOCKER_IMAGE" sh -c "yarn install && yarn build && yarn build && chown -R $(id -u):$(id -g) /app/frontend" + docker run --rm -e CI=true -v "$(pwd)/frontend:/app/frontend" -v "$(pwd)/global:/app/global" -w /app/frontend "$DOCKER_IMAGE" sh -c "yarn install && yarn build && yarn build && chown -R $(id -u):$(id -g) /app/frontend" echo -e "${BLUE}❯ ${GREEN}Building Frontend Complete${RESET}" else echo -e "${RED}❯ docker command is not available${RESET}"