Skip to content

Commit 95208a5

Browse files
committed
Increases timeouts in front- and backend
1 parent 514b13f commit 95208a5

File tree

8 files changed

+20
-10
lines changed

8 files changed

+20
-10
lines changed

Jenkinsfile

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pipeline {
6565
// See: https://github.com/yarnpkg/yarn/issues/3254
6666
sh '''docker run --rm \\
6767
-v "$(pwd)/backend:/app" \\
68+
-v "$(pwd)/global:/app/global" \\
6869
-w /app \\
6970
node:latest \\
7071
sh -c "yarn install && yarn eslint . && rm -rf node_modules"

backend/internal/certificate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const internalNginx = require('./nginx');
1313
const internalHost = require('./host');
1414
const certbot_command = '/usr/bin/certbot';
1515
const le_config = '/etc/letsencrypt.ini';
16-
const dns_plugins = require('../../global/certbot-dns-plugins')
16+
const dns_plugins = require('../global/certbot-dns-plugins');
1717

1818
function omissions() {
1919
return ['is_deleted'];

backend/routes/api/nginx/certificates.js

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ router
5858
.post((req, res, next) => {
5959
apiValidator({$ref: 'endpoints/certificates#/links/1/schema'}, req.body)
6060
.then((payload) => {
61+
req.setTimeout(900000); // 15 minutes timeout
6162
return internalCertificate.create(res.locals.access, payload);
6263
})
6364
.then((result) => {
@@ -197,6 +198,7 @@ router
197198
* Renew certificate
198199
*/
199200
.post((req, res, next) => {
201+
req.setTimeout(900000); // 15 minutes timeout
200202
internalCertificate.renew(res.locals.access, {
201203
id: parseInt(req.params.certificate_id, 10)
202204
})

docker/rootfs/etc/nginx/conf.d/dev.conf

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ server {
1717
proxy_set_header X-Forwarded-Proto $scheme;
1818
proxy_set_header X-Forwarded-For $remote_addr;
1919
proxy_pass http://127.0.0.1:3000/;
20+
21+
proxy_read_timeout 15m;
22+
proxy_send_timeout 15m;
2023
}
2124

2225
location / {

docker/rootfs/etc/nginx/conf.d/production.conf

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ server {
1818
proxy_set_header X-Forwarded-Proto $scheme;
1919
proxy_set_header X-Forwarded-For $remote_addr;
2020
proxy_pass http://127.0.0.1:3000/;
21+
22+
proxy_read_timeout 15m;
23+
proxy_send_timeout 15m;
2124
}
2225

2326
location / {

frontend/js/app/api.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,8 @@ module.exports = {
586586
/**
587587
* @param {Object} data
588588
*/
589-
create: function (data, timeout = 180000) {
589+
create: function (data) {
590+
const timeout = 180000 + (data.meta.propagation_seconds ? Number(data.meta.propagation_seconds) * 1000 : 0);
590591
return fetch('post', 'nginx/certificates', data, {timeout});
591592
},
592593

frontend/js/app/nginx/certificates/form.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ module.exports = Mn.View.extend({
167167
}
168168
})
169169
.then(() => {
170-
const timeout = 180000 + (data.meta.propagation_seconds ? Number(data.meta.propagation_seconds) : 0);
171-
return App.Api.Nginx.Certificates.create(data, timeout);
170+
return App.Api.Nginx.Certificates.create(data);
172171
})
173172
.then(result => {
174173
view.model.set(result);
@@ -187,12 +186,13 @@ module.exports = Mn.View.extend({
187186
});
188187
})
189188
.catch(err => {
190-
try{
191-
const error_message = JSON.parse(err.debug).debug.stack.join("\n");
192-
this.ui.le_error_info[0].innerHTML = `<p>${err.message}</p><pre>${error_message}</pre>`;
193-
} catch(e) {
194-
this.ui.le_error_info[0].innerHTML = `<p>${err.message}</p>`;
189+
let more_info = '';
190+
if(err.code === 500){
191+
try{
192+
more_info = JSON.parse(err.debug).debug.stack.join("\n");
193+
} catch(e) {}
195194
}
195+
this.ui.le_error_info[0].innerHTML = `${err.message}${more_info !== '' ? `<pre class="mt-3">${more_info}</pre>`:''}`;
196196
this.ui.le_error_info.show();
197197
this.ui.le_error_info[0].scrollIntoView();
198198
this.ui.loader_content.hide();

scripts/frontend-build

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if hash docker 2>/dev/null; then
1010
docker pull "${DOCKER_IMAGE}"
1111
cd "${DIR}/.."
1212
echo -e "${BLUE}${CYAN}Building Frontend ...${RESET}"
13-
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"
13+
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"
1414
echo -e "${BLUE}${GREEN}Building Frontend Complete${RESET}"
1515
else
1616
echo -e "${RED}❯ docker command is not available${RESET}"

0 commit comments

Comments
 (0)