From 8889f8d5cf84451787d79b4d9a5b3947a0e328e4 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 1 Feb 2019 11:46:54 +0100 Subject: [PATCH 1/3] Jenkinsfile fixes, back scaled to 3 servers, nginx conf improved --- Jenkinsfile | 8 +++++--- docker-compose.yml | 10 +++++----- front/nginx.conf | 15 +++++++++------ front/package.json | 7 ++++--- karma.conf.js | 2 +- package.json | 12 ++++++------ 6 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8e8a11e0d..3a4195256 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -101,7 +101,7 @@ pipeline { steps { withCredentials([dockerCert(credentialsId: 'docker', variable: 'DOCKER_CERT_PATH')]) { sh 'docker-compose pull' - sh 'docker-compose up -d' + sh 'docker-compose up -d --scale back=3' } } } @@ -112,7 +112,7 @@ pipeline { steps { withCredentials([dockerCert(credentialsId: 'docker', variable: 'DOCKER_CERT_PATH')]) { sh 'docker-compose pull' - sh 'docker-compose up -d' + sh 'docker-compose up -d --scale back=3' } } } @@ -129,8 +129,10 @@ pipeline { } post { always { - // junit '*/junit.xml' script { + if (env.BRANCH_NAME == 'dev') + junit '*/junitresults.xml' + if (!env.GIT_COMMITTER_EMAIL) return try { mail( diff --git a/docker-compose.yml b/docker-compose.yml index fa6259adb..05135c454 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.5' services: - app: - image: registry.verdnatura.es/salix-app:${TAG} + front: + image: registry.verdnatura.es/salix-front:${TAG} restart: unless-stopped build: context: . @@ -9,9 +9,9 @@ services: ports: - ${PORT}:80 links: - - api - api: - image: registry.verdnatura.es/salix-api:${TAG} + - back + back: + image: registry.verdnatura.es/salix-back:${TAG} restart: unless-stopped build: . environment: diff --git a/front/nginx.conf b/front/nginx.conf index 214f2c1cc..63b2b6942 100644 --- a/front/nginx.conf +++ b/front/nginx.conf @@ -5,18 +5,21 @@ server { server_name _; autoindex off; - root /usr/share/nginx/html; + root /salix/dist; error_page 404 = @notfound; location @notfound { return 302 /; } - location ~ ^(/[a-zA-Z0-9_-]+)?/(?api(/.*)?)$ { - resolver 127.0.0.11; - proxy_pass http://api:3000/$path$is_args$args; + upstream back { + server back_1; + server back_2; + server back_3; } - location ~ ^(?:/(.*))?$ { - alias /salix/dist/$1; + location ~ ^(/[a-zA-Z0-9_-]+)?/(?api(/.*)?)$ { + proxy_pass http://back:3000/$path$is_args$args; + } + location / { autoindex on; } } diff --git a/front/package.json b/front/package.json index 88a693bfd..6b1ded2aa 100644 --- a/front/package.json +++ b/front/package.json @@ -1,11 +1,12 @@ { - "name": "salix-client", + "name": "salix-front", "version": "1.0.0", - "description": "Salix client", + "author": "Verdnatura Levante SL", + "description": "Salix frontend", "license": "GPL-3.0", "repository": { "type": "git", - "url": "https://git.verdnatura.es/salix" + "url": "https://gitea.verdnatura.es/verdnatura/salix" }, "dependencies": { "@babel/polyfill": "^7.2.5", diff --git a/karma.conf.js b/karma.conf.js index 684ee705f..4586cb501 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -119,7 +119,7 @@ module.exports = function(config) { singleRun: true, reporters: ['dots', 'junit'], junitReporter: { - outputFile: 'junit.xml' + outputFile: 'junitresults.xml' } }); } diff --git a/package.json b/package.json index be205472c..405c2fc5b 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,13 @@ { - "name": "salix-app", + "name": "salix-back", "version": "1.0.0", "author": "Verdnatura Levante SL", - "description": "Salix application", + "description": "Salix backend", "license": "GPL-3.0", + "repository": { + "type": "git", + "url": "https://gitea.verdnatura.es/verdnatura/salix" + }, "dependencies": { "compression": "^1.7.3", "fs-extra": "^5.0.0", @@ -78,10 +82,6 @@ "webpack-merge": "^4.2.1", "yaml-loader": "^0.5.0" }, - "repository": { - "type": "git", - "url": "https://git.verdnatura.es/salix" - }, "scripts": { "test": "nodemon -q back/tests.js -w modules", "dbtest": "nodemon -q services/db/tests.js -w services/db/tests", From a781346f17f334791b43ce5531a19c9edc5f4fd8 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 1 Feb 2019 11:54:36 +0100 Subject: [PATCH 2/3] nginx conf fixes --- front/nginx.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/front/nginx.conf b/front/nginx.conf index 63b2b6942..4b7047580 100644 --- a/front/nginx.conf +++ b/front/nginx.conf @@ -1,4 +1,9 @@ +upstream back { + server back_1; + server back_2; + server back_3; +} server { listen 80 default_server; listen [::]:80 default_server; @@ -11,11 +16,6 @@ server { location @notfound { return 302 /; } - upstream back { - server back_1; - server back_2; - server back_3; - } location ~ ^(/[a-zA-Z0-9_-]+)?/(?api(/.*)?)$ { proxy_pass http://back:3000/$path$is_args$args; } From 50f580e8835df5878fc7e44f63579f5faab580bc Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 1 Feb 2019 12:17:23 +0100 Subject: [PATCH 3/3] nginx config fixes --- front/nginx.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/front/nginx.conf b/front/nginx.conf index 4b7047580..b9e0d5c7c 100644 --- a/front/nginx.conf +++ b/front/nginx.conf @@ -1,8 +1,8 @@ upstream back { - server back_1; - server back_2; - server back_3; + server back_1:3000; + server back_2:3000; + server back_3:3000; } server { listen 80 default_server; @@ -17,7 +17,7 @@ server { return 302 /; } location ~ ^(/[a-zA-Z0-9_-]+)?/(?api(/.*)?)$ { - proxy_pass http://back:3000/$path$is_args$args; + proxy_pass http://back/$path$is_args$args; } location / { autoindex on;