From 55393eef33afb009fc25a85fb2791661e1112786 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 11:10:45 +0100 Subject: [PATCH 01/29] Using docker configs --- docker-compose.yml | 60 ++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c9011bdf4..ab421909c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,28 +1,36 @@ version: '3.5' services: - front: - image: registry.verdnatura.es/salix-front:${TAG} - restart: unless-stopped - build: - context: . - dockerfile: front/Dockerfile - ports: - - ${PORT_FRONT}:80 - links: - - back - deploy: - replicas: 3 - back: - image: registry.verdnatura.es/salix-back:${TAG} - restart: unless-stopped - build: . - ports: - - ${PORT_BACK}:3000 - environment: - - NODE_ENV - volumes: - - /mnt/storage/containers/salix:/etc/salix - - /mnt/storage/pdfs:/var/lib/salix/pdfs - - /mnt/storage/dms:/var/lib/salix/dms - deploy: - replicas: 6 + front: + image: registry.verdnatura.es/salix-front:${TAG} + restart: unless-stopped + build: + context: . + dockerfile: front/Dockerfile + ports: + - ${PORT_FRONT}:80 + links: + - back + deploy: + replicas: 3 + back: + image: registry.verdnatura.es/salix-back:${TAG} + restart: unless-stopped + build: . + ports: + - ${PORT_BACK}:3000 + environment: + - NODE_ENV + configs: + - source: salix_datasources + target: /etc/salix/datasources.json + - source: salix-${BRANCH_NAME}_datasources + target: /etc/salix/datasources.${NODE_ENV}.json + - source: salix_print + target: /etc/salix/print.json + - source: salix-${BRANCH_NAME}_print + target: /etc/salix/print.${NODE_ENV}.json + volumes: + - /mnt/storage/pdfs:/var/lib/salix/pdfs + - /mnt/storage/dms:/var/lib/salix/dms + deploy: + replicas: 6 From 1565bc3a9204d0b772d93faafe9eb527a32cd660 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 12:06:05 +0100 Subject: [PATCH 02/29] Docker compose fixes --- docker-compose.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ab421909c..01aaa3997 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,18 +2,19 @@ version: '3.5' services: front: image: registry.verdnatura.es/salix-front:${TAG} - restart: unless-stopped build: context: . dockerfile: front/Dockerfile ports: - ${PORT_FRONT}:80 - links: - - back deploy: replicas: 3 back: image: registry.verdnatura.es/salix-back:${TAG} + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 3 restart: unless-stopped build: . ports: @@ -34,3 +35,12 @@ services: - /mnt/storage/dms:/var/lib/salix/dms deploy: replicas: 6 +configs: + salix_datasources: + external: true + salix-${BRANCH_NAME}_datasources: + external: true + salix_print: + external: true + salix-${BRANCH_NAME}_print: + external: true From 54b8aa7c83fb4d442ed51369feace02adde9fcac Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 12:23:30 +0100 Subject: [PATCH 03/29] Docker compose fixes --- docker-compose.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 01aaa3997..a6dec3c2e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,11 +24,11 @@ services: configs: - source: salix_datasources target: /etc/salix/datasources.json - - source: salix-${BRANCH_NAME}_datasources - target: /etc/salix/datasources.${NODE_ENV}.json - source: salix_print target: /etc/salix/print.json - - source: salix-${BRANCH_NAME}_print + - source: salix-branch_datasources + target: /etc/salix/datasources.${NODE_ENV}.json + - source: salix-branch_print target: /etc/salix/print.${NODE_ENV}.json volumes: - /mnt/storage/pdfs:/var/lib/salix/pdfs @@ -38,9 +38,11 @@ services: configs: salix_datasources: external: true - salix-${BRANCH_NAME}_datasources: - external: true salix_print: external: true - salix-${BRANCH_NAME}_print: - external: true + salix-branch_datasources: + external: + name: salix-${BRANCH_NAME}_datasources + salix-branch_print: + external: + name: salix-${BRANCH_NAME}_print From b98b947b6355a81329fe8ef21f9788f76cae4397 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 12:33:55 +0100 Subject: [PATCH 04/29] Compose fixes --- docker-compose.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a6dec3c2e..13636e348 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3.5' +version: '3.7' services: front: image: registry.verdnatura.es/salix-front:${TAG} @@ -15,7 +15,6 @@ services: condition: on-failure delay: 5s max_attempts: 3 - restart: unless-stopped build: . ports: - ${PORT_BACK}:3000 From eb9e622b7231545c9c55fba426d0a7cb97d994d6 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 12:49:02 +0100 Subject: [PATCH 05/29] Compose fixes --- docker-compose.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 13636e348..ef0e59114 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,10 +11,6 @@ services: replicas: 3 back: image: registry.verdnatura.es/salix-back:${TAG} - restart_policy: - condition: on-failure - delay: 5s - max_attempts: 3 build: . ports: - ${PORT_BACK}:3000 @@ -40,8 +36,6 @@ configs: salix_print: external: true salix-branch_datasources: - external: - name: salix-${BRANCH_NAME}_datasources + name: salix-${BRANCH_NAME}_datasources salix-branch_print: - external: - name: salix-${BRANCH_NAME}_print + name: salix-${BRANCH_NAME}_print From aff56b7589cd459522a96ba47d8e9bd540940e78 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 13:07:51 +0100 Subject: [PATCH 06/29] Compose fixes --- docker-compose.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ef0e59114..693502de3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,10 +19,10 @@ services: configs: - source: salix_datasources target: /etc/salix/datasources.json - - source: salix_print - target: /etc/salix/print.json - source: salix-branch_datasources target: /etc/salix/datasources.${NODE_ENV}.json + - source: salix_print + target: /etc/salix/print.json - source: salix-branch_print target: /etc/salix/print.${NODE_ENV}.json volumes: @@ -33,9 +33,11 @@ services: configs: salix_datasources: external: true + salix-branch_datasources: + external: true + name: salix-${BRANCH_NAME}_datasources salix_print: external: true - salix-branch_datasources: - name: salix-${BRANCH_NAME}_datasources salix-branch_print: + external: true name: salix-${BRANCH_NAME}_print From a252119884d1192228d596f6a2ac8d568af30b0a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 14:32:18 +0100 Subject: [PATCH 07/29] Compose & jenkinsfile fixes --- Jenkinsfile | 34 ++++++++++++++++------------------ docker-compose.yml | 8 ++++---- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0d56f7476..7000338d0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,19 +7,11 @@ pipeline { } environment { PROJECT_NAME = 'salix' - REGISTRY = 'registry.verdnatura.es' - PORT_MASTER_FRONT = '5002' - PORT_MASTER_BACK = '3001' - PORT_TEST_FRONT = '5001' - PORT_TEST_BACK = '4001' - TAG = "${env.BRANCH_NAME}" } stages { stage('Checkout') { steps { script { - env.STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" - if (!env.GIT_COMMITTER_EMAIL) { env.COMMITTER_EMAIL = sh( script: 'git --no-pager show -s --format="%ae"', @@ -29,16 +21,6 @@ pipeline { env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL; } - switch (env.BRANCH_NAME) { - case 'master': - env.PORT_FRONT = PORT_MASTER_FRONT - env.PORT_BACK = PORT_MASTER_BACK - break - case 'test': - env.PORT_FRONT = PORT_TEST_FRONT - env.PORT_BACK = PORT_TEST_BACK - break - } switch (env.BRANCH_NAME) { case 'master': env.NODE_ENV = 'production' @@ -49,6 +31,22 @@ pipeline { } } sh 'printenv' + + configFileProvider([ + configFile(fileId: "salix.env", + variable: 'SALIX_ENV') + ]) { + sh 'cp "$SALIX_ENV" salix.env' + sh "source salix.env" + } + + configFileProvider([ + configFile(fileId: "salix.${env.NODE_ENV}.env", + variable: 'SALIX_LOCAL_ENV') + ]) { + sh 'cp "$SALIX_LOCAL_ENV" salix.local.env' + sh "source salix.local.env" + } } } stage('Install') { diff --git a/docker-compose.yml b/docker-compose.yml index 693502de3..a899098d3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.7' services: front: - image: registry.verdnatura.es/salix-front:${TAG} + image: registry.verdnatura.es/salix-front:${BRANCH_NAME} build: context: . dockerfile: front/Dockerfile @@ -10,7 +10,7 @@ services: deploy: replicas: 3 back: - image: registry.verdnatura.es/salix-back:${TAG} + image: registry.verdnatura.es/salix-back:${BRANCH_NAME} build: . ports: - ${PORT_BACK}:3000 @@ -20,11 +20,11 @@ services: - source: salix_datasources target: /etc/salix/datasources.json - source: salix-branch_datasources - target: /etc/salix/datasources.${NODE_ENV}.json + target: /etc/salix/datasources.local.json - source: salix_print target: /etc/salix/print.json - source: salix-branch_print - target: /etc/salix/print.${NODE_ENV}.json + target: /etc/salix/print.local.json volumes: - /mnt/storage/pdfs:/var/lib/salix/pdfs - /mnt/storage/dms:/var/lib/salix/dms From 337a8ab944f7bfe9a750ab9568283844ea98c6a9 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 14:33:54 +0100 Subject: [PATCH 08/29] Jenkinsfile fixes --- Jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7000338d0..747c00b8b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { disableConcurrentBuilds() } environment { - PROJECT_NAME = 'salix' + PROJECT_NAME = 'salix' } stages { stage('Checkout') { @@ -61,6 +61,9 @@ pipeline { } } stage('Test') { + when { anyOf { + branch 'dev' + }} environment { NODE_ENV = "" } From e2830badb91dab2122fd4c3beb8504a682814838 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 14:41:32 +0100 Subject: [PATCH 09/29] Jenkinsfile fixes --- Jenkinsfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 747c00b8b..a1dec37fa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,6 +7,7 @@ pipeline { } environment { PROJECT_NAME = 'salix' + STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } stages { stage('Checkout') { @@ -36,16 +37,14 @@ pipeline { configFile(fileId: "salix.env", variable: 'SALIX_ENV') ]) { - sh 'cp "$SALIX_ENV" salix.env' - sh "source salix.env" + sh 'source "$SALIX_ENV"' } configFileProvider([ configFile(fileId: "salix.${env.NODE_ENV}.env", variable: 'SALIX_LOCAL_ENV') ]) { - sh 'cp "$SALIX_LOCAL_ENV" salix.local.env' - sh "source salix.local.env" + sh 'source "$SALIX_LOCAL_ENV"' } } } From 77d454e519b81495e0646f47647b053bf03c015b Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 15:02:30 +0100 Subject: [PATCH 10/29] Jenkinsfile changes --- Jenkinsfile | 21 ++++++++++++++++----- docker-compose.yml | 4 ++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a1dec37fa..2d27145a9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,18 @@ pipeline { } else { env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL; } - +/* + switch (env.BRANCH_NAME) { + case 'master': + env.FRONT_PORT = SALIX_MASTER_FRONT_PORT + env.BACK_PORT = SALIX_MASTER_BACK_PORT + break + case 'test': + env.FRONT_PORT = SALIX_TEST_FRONT_PORT + env.BACK_PORT = SALIX_TEST_BACK_PORT + break + } +*/ switch (env.BRANCH_NAME) { case 'master': env.NODE_ENV = 'production' @@ -35,16 +46,16 @@ pipeline { configFileProvider([ configFile(fileId: "salix.env", - variable: 'SALIX_ENV') + variable: 'ENV_FILE') ]) { - sh 'source "$SALIX_ENV"' + sh '. "$ENV_FILE"' } configFileProvider([ configFile(fileId: "salix.${env.NODE_ENV}.env", - variable: 'SALIX_LOCAL_ENV') + variable: 'LOCAL_ENV_FILE') ]) { - sh 'source "$SALIX_LOCAL_ENV"' + sh '. "$LOCAL_ENV_FILE"' } } } diff --git a/docker-compose.yml b/docker-compose.yml index a899098d3..09467902d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,14 +6,14 @@ services: context: . dockerfile: front/Dockerfile ports: - - ${PORT_FRONT}:80 + - ${FRONT_PORT}:80 deploy: replicas: 3 back: image: registry.verdnatura.es/salix-back:${BRANCH_NAME} build: . ports: - - ${PORT_BACK}:3000 + - ${BACK_PORT}:3000 environment: - NODE_ENV configs: From e1bce25b1178ba14c4f6c673b11f505fd628107c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 15:21:47 +0100 Subject: [PATCH 11/29] Jenkins & compose changes --- Jenkinsfile | 11 ++++++----- docker-compose.yml | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2d27145a9..ec8245758 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,21 +42,22 @@ pipeline { break } } - sh 'printenv' configFileProvider([ - configFile(fileId: "salix.env", + configFile(fileId: "salix.groovy", variable: 'ENV_FILE') ]) { - sh '. "$ENV_FILE"' + load ENV_FILE } configFileProvider([ - configFile(fileId: "salix.${env.NODE_ENV}.env", + configFile(fileId: "salix.${env.NODE_ENV}.groovy", variable: 'LOCAL_ENV_FILE') ]) { - sh '. "$LOCAL_ENV_FILE"' + load LOCAL_ENV_FILE } + + sh 'printenv' } } stage('Install') { diff --git a/docker-compose.yml b/docker-compose.yml index 09467902d..4ce6ff18c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,19 +1,19 @@ version: '3.7' services: front: - image: registry.verdnatura.es/salix-front:${BRANCH_NAME} + image: registry.verdnatura.es/salix-front:${BRANCH_NAME:?} build: context: . dockerfile: front/Dockerfile ports: - - ${FRONT_PORT}:80 + - ${FRONT_PORT:?}:80 deploy: replicas: 3 back: - image: registry.verdnatura.es/salix-back:${BRANCH_NAME} + image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?} build: . ports: - - ${BACK_PORT}:3000 + - ${BACK_PORT:?}:3000 environment: - NODE_ENV configs: @@ -35,9 +35,9 @@ configs: external: true salix-branch_datasources: external: true - name: salix-${BRANCH_NAME}_datasources + name: salix-${BRANCH_NAME:?}_datasources salix_print: external: true salix-branch_print: external: true - name: salix-${BRANCH_NAME}_print + name: salix-${BRANCH_NAME:?}_print From 8ae89699fe191b1249805b5f9513d1fcbae422ef Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 15:29:29 +0100 Subject: [PATCH 12/29] Jenkinsfile changes --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ec8245758..7cdf7bd7c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,14 +47,14 @@ pipeline { configFile(fileId: "salix.groovy", variable: 'ENV_FILE') ]) { - load ENV_FILE + load env.ENV_FILE } configFileProvider([ configFile(fileId: "salix.${env.NODE_ENV}.groovy", variable: 'LOCAL_ENV_FILE') ]) { - load LOCAL_ENV_FILE + load env.LOCAL_ENV_FILE } sh 'printenv' From c0996823c0e46f29b21a1e9e6d6dd7e5214c7c6b Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 15:31:47 +0100 Subject: [PATCH 13/29] Jenkinsfile fixes --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7cdf7bd7c..867531f4d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,14 +47,14 @@ pipeline { configFile(fileId: "salix.groovy", variable: 'ENV_FILE') ]) { - load env.ENV_FILE + load "${env.ENV_FILE}" } configFileProvider([ configFile(fileId: "salix.${env.NODE_ENV}.groovy", variable: 'LOCAL_ENV_FILE') ]) { - load env.LOCAL_ENV_FILE + load "${env.LOCAL_ENV_FILE}" } sh 'printenv' From 11843c2a713dcc4b08c79e510add39f15ceca196 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 15:45:15 +0100 Subject: [PATCH 14/29] Jenkinsfile changes --- Jenkinsfile | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 867531f4d..20efa49c4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,18 +21,7 @@ pipeline { } else { env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL; } -/* - switch (env.BRANCH_NAME) { - case 'master': - env.FRONT_PORT = SALIX_MASTER_FRONT_PORT - env.BACK_PORT = SALIX_MASTER_BACK_PORT - break - case 'test': - env.FRONT_PORT = SALIX_TEST_FRONT_PORT - env.BACK_PORT = SALIX_TEST_BACK_PORT - break - } -*/ + switch (env.BRANCH_NAME) { case 'master': env.NODE_ENV = 'production' @@ -47,14 +36,14 @@ pipeline { configFile(fileId: "salix.groovy", variable: 'ENV_FILE') ]) { - load "${env.ENV_FILE}" + load env.ENV_FILE } configFileProvider([ configFile(fileId: "salix.${env.NODE_ENV}.groovy", variable: 'LOCAL_ENV_FILE') ]) { - load "${env.LOCAL_ENV_FILE}" + load env.LOCAL_ENV_FILE } sh 'printenv' From d79f6ec4f4a5108ec3f203d705ff8ccb7b31134d Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 16:17:54 +0100 Subject: [PATCH 15/29] Jenkinsfile changes --- Jenkinsfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 20efa49c4..35d0176ac 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,7 @@ #!/usr/bin/env groovy +def props + pipeline { agent any options { @@ -32,6 +34,20 @@ pipeline { } } + configFileProvider([ + configFile(fileId: "salix.properties", + variable: 'PROPS_FILE') + ]) { + props = readProperties file: "${env.PROPS_FILE}" + } + + configFileProvider([ + configFile(fileId: "salix.${env.NODE_ENV}.properties", + variable: 'LOCAL_PROPS_FILE') + ]) { + props = readProperties defaults: props, file: "${env.LOCAL_PROPS_FILE}" + } + configFileProvider([ configFile(fileId: "salix.groovy", variable: 'ENV_FILE') @@ -47,6 +63,7 @@ pipeline { } sh 'printenv' + echo props } } stage('Install') { From 50aa98ee34e42876f6a122ac1666bd0edf11e0c5 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 16:20:05 +0100 Subject: [PATCH 16/29] Jenkinsfile changes --- Jenkinsfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 35d0176ac..9c3acfaae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,14 +38,18 @@ pipeline { configFile(fileId: "salix.properties", variable: 'PROPS_FILE') ]) { - props = readProperties file: "${env.PROPS_FILE}" + script { + props = readProperties file: "${env.PROPS_FILE}" + } } configFileProvider([ configFile(fileId: "salix.${env.NODE_ENV}.properties", variable: 'LOCAL_PROPS_FILE') ]) { - props = readProperties defaults: props, file: "${env.LOCAL_PROPS_FILE}" + script { + props = readProperties defaults: props, file: "${env.LOCAL_PROPS_FILE}" + } } configFileProvider([ From 3a8ddc2df74937c5a5359e9308f1f88f77ab4b3d Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 16:29:25 +0100 Subject: [PATCH 17/29] Jenkinsfile fixes --- Jenkinsfile | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9c3acfaae..48006ffd3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,5 @@ #!/usr/bin/env groovy -def props - pipeline { agent any options { @@ -34,40 +32,14 @@ pipeline { } } - configFileProvider([ - configFile(fileId: "salix.properties", - variable: 'PROPS_FILE') - ]) { - script { - props = readProperties file: "${env.PROPS_FILE}" - } - } - - configFileProvider([ - configFile(fileId: "salix.${env.NODE_ENV}.properties", - variable: 'LOCAL_PROPS_FILE') - ]) { - script { - props = readProperties defaults: props, file: "${env.LOCAL_PROPS_FILE}" - } - } - configFileProvider([ configFile(fileId: "salix.groovy", - variable: 'ENV_FILE') + variable: 'GROOVY_FILE') ]) { - load env.ENV_FILE - } - - configFileProvider([ - configFile(fileId: "salix.${env.NODE_ENV}.groovy", - variable: 'LOCAL_ENV_FILE') - ]) { - load env.LOCAL_ENV_FILE + load env.GROOVY_FILE } sh 'printenv' - echo props } } stage('Install') { From 305774554edf770ce5cf709dc9fba6f1b603a1fd Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 16:32:07 +0100 Subject: [PATCH 18/29] Jenkinsfile working --- Jenkinsfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 48006ffd3..dd4d2b2ec 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,9 +54,6 @@ pipeline { } } stage('Test') { - when { anyOf { - branch 'dev' - }} environment { NODE_ENV = "" } From 69b53b3cdc03792487e2795862f63258c8a8985d Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 23 Dec 2019 16:39:26 +0100 Subject: [PATCH 19/29] DB container removed on error --- gulpfile.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index dcb0aa6f1..dc95c24be 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -429,15 +429,22 @@ async function docker() { let result = await execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`); containerId = result.stdout; - if (argv['random']) { - let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`); - let netSettings = JSON.parse(inspect.stdout); + try { + if (argv['random']) { + let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`); + let netSettings = JSON.parse(inspect.stdout); - dbConf.host = netSettings.Gateway; - dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; + dbConf.host = netSettings.Gateway; + dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; + } + + if (runChown) await dockerWait(); + } catch (err) { + if (argv['random']) + await execP(`docker rm -fv ${containerId}`); + throw err; } - if (runChown) await dockerWait(); return containerId; } docker.description = `Builds the database image and runs a container`; From 4f0a54329a993481e3d8dbcc05b9346c7ec2b1ca Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 24 Dec 2019 09:03:15 +0100 Subject: [PATCH 20/29] Print read config from local --- print/core/config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/print/core/config.js b/print/core/config.js index 8db388401..864e1658a 100644 --- a/print/core/config.js +++ b/print/core/config.js @@ -4,8 +4,10 @@ let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'; let configPath = `/etc/salix`; let config = require('../config/print.json'); let configFiles = [ + `${appPath}/config/print.local.json`, `${appPath}/config/print.${env}.json`, `${configPath}/print.json`, + `${configPath}/print.local.json`, `${configPath}/print.${env}.json` ]; From 6c57220703d3f390ee808445ce0d0731a3bd049b Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 24 Dec 2019 10:17:41 +0100 Subject: [PATCH 21/29] InvoiceOut PDF download fix --- modules/invoiceOut/front/descriptor/index.js | 2 +- modules/invoiceOut/front/index/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js index 100f27c1f..a69f6ed8b 100644 --- a/modules/invoiceOut/front/descriptor/index.js +++ b/modules/invoiceOut/front/descriptor/index.js @@ -53,7 +53,7 @@ class Controller { } showInvoiceOutPdf() { - let url = `InvoiceOuts/${this.invoiceOut.id}/download?access_token=${this.accessToken}`; + let url = `api/InvoiceOuts/${this.invoiceOut.id}/download?access_token=${this.accessToken}`; window.open(url, '_blank'); } diff --git a/modules/invoiceOut/front/index/index.js b/modules/invoiceOut/front/index/index.js index c75b2bebe..dd8219fae 100644 --- a/modules/invoiceOut/front/index/index.js +++ b/modules/invoiceOut/front/index/index.js @@ -27,7 +27,7 @@ export default class Controller { } openPdf(id, event) { - let url = `InvoiceOuts/${id}/download?access_token=${this.accessToken}`; + let url = `api/InvoiceOuts/${id}/download?access_token=${this.accessToken}`; window.open(url, '_blank'); event.preventDefault(); event.stopImmediatePropagation(); From 98cf5a4a180f276ec0cc6dbc0b9cb69ffb20d507 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 30 Dec 2019 12:36:19 +0100 Subject: [PATCH 22/29] Hotfix: restart interval, vnAgencyEvents --- Dockerfile | 2 +- back/process.yml | 3 ++- modules/agency/front/events/index.html | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index f2cbeeff9..5a65b9b18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,5 +34,5 @@ COPY \ CMD ["pm2-runtime", "./back/process.yml"] -HEALTHCHECK --interval=1m --timeout=10s \ +HEALTHCHECK --interval=15s --timeout=10s \ CMD curl -f http://localhost:3000/api/Applications/status || exit 1 diff --git a/back/process.yml b/back/process.yml index 3062091b4..41a2fafff 100644 --- a/back/process.yml +++ b/back/process.yml @@ -2,4 +2,5 @@ apps: - script: ./loopback/server/server.js name: salix-back instances: 1 - max_restarts: 5 + max_restarts: 3 + restart_delay: 15000 diff --git a/modules/agency/front/events/index.html b/modules/agency/front/events/index.html index 274d79997..693b24a85 100644 --- a/modules/agency/front/events/index.html +++ b/modules/agency/front/events/index.html @@ -160,12 +160,12 @@ response="cancel" translate-attr="{value: 'Cancel'}"> - + translate-attr="{value: 'Delete'}"> +