Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 1984-travel_summary_total
gitea/salix/1984-travel_summary_total This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-01-09 08:01:07 +01:00
commit 92b72328b9
14 changed files with 110 additions and 77 deletions

View File

@ -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

33
Jenkinsfile vendored
View File

@ -6,20 +6,13 @@ pipeline {
disableConcurrentBuilds()
}
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}"
PROJECT_NAME = 'salix'
STACK_NAME = "${env.PROJECT_NAME}-${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 +22,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'
@ -48,6 +31,14 @@ pipeline {
break
}
}
configFileProvider([
configFile(fileId: "salix.groovy",
variable: 'GROOVY_FILE')
]) {
load env.GROOVY_FILE
}
sh 'printenv'
}
}
@ -57,8 +48,8 @@ pipeline {
}
steps {
nodejs('node-lts') {
sh 'npm install --no-audit'
sh 'gulp install'
sh 'npm install --no-audit --prefer-offline'
sh 'gulp install --ci'
}
}
}

View File

@ -2,4 +2,5 @@ apps:
- script: ./loopback/server/server.js
name: salix-back
instances: 1
max_restarts: 5
max_restarts: 3
restart_delay: 15000

View File

@ -1,28 +1,45 @@
version: '3.5'
version: '3.7'
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:${BRANCH_NAME:?}
build:
context: .
dockerfile: front/Dockerfile
ports:
- ${FRONT_PORT:?}:80
deploy:
replicas: 3
back:
image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?}
build: .
ports:
- ${BACK_PORT:?}:3000
environment:
- NODE_ENV
configs:
- source: datasources
target: /etc/salix/datasources.json
- source: datasources_local
target: /etc/salix/datasources.local.json
- source: print
target: /etc/salix/print.json
- source: print_local
target: /etc/salix/print.local.json
volumes:
- /mnt/storage/pdfs:/var/lib/salix/pdfs
- /mnt/storage/dms:/var/lib/salix/dms
deploy:
replicas: 6
configs:
datasources:
external: true
name: salix_datasources
datasources_local:
external: true
name: salix-${BRANCH_NAME:?}_datasources
print:
external: true
name: salix_print
print_local:
external: true
name: salix-${BRANCH_NAME:?}_print

View File

@ -0,0 +1 @@
No service for the specified zone: No hay servicio para la zona especificada

View File

@ -101,6 +101,7 @@ async function backTestOnce() {
gulp.src(backSpecFiles)
.pipe(jasmine(options))
.on('end', resolve)
.on('error', reject)
.resume();
});
@ -110,27 +111,33 @@ backTestOnce.description = `Runs the backend tests once, can receive --junit arg
async function backTestDockerOnce() {
let containerId = await docker();
let err;
try {
await backTestOnce();
} catch (e) {
throw e;
} finally {
if (argv['random'])
await execP(`docker rm -fv ${containerId}`);
err = e;
}
if (argv['random'])
await execP(`docker rm -fv ${containerId}`);
if (err) throw err;
}
backTestDockerOnce.description = `Runs backend tests using in site container once`;
async function backTestDocker() {
let containerId = await docker();
let err;
try {
await backTest();
} catch (e) {
throw e;
} finally {
if (argv['random'])
await execP(`docker rm -fv ${containerId}`);
err = e;
}
if (argv['random'])
await execP(`docker rm -fv ${containerId}`);
if (err) throw err;
}
backTestDocker.description = `Runs backend tests restoring fixtures first`;
@ -240,14 +247,15 @@ function install() {
const install = require('gulp-install');
const print = require('gulp-print');
let npmArgs = [];
if (argv.ci) npmArgs = ['--no-audit', '--prefer-offline'];
let packageFiles = ['front/package.json', 'print/package.json'];
return gulp.src(packageFiles)
.pipe(print(filepath => {
return `Installing packages in ${filepath}`;
}))
.pipe(install({
npm: ['--no-package-lock']
}));
.pipe(install({npm: npmArgs}));
}
install.description = `Installs node dependencies in all directories`;
@ -429,15 +437,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`;

View File

@ -14,7 +14,7 @@
"multipleStatements": true,
"legacyUtcDateProcessing": false,
"timezone": "local",
"connectTimeout": 20000,
"connectTimeout": 40000,
"acquireTimeout": 20000
},
"storage": {

View File

@ -9,7 +9,7 @@ module.exports = Self => {
description: 'The province id',
required: true
}, {
arg: 'search',
arg: 'postCode',
type: 'String',
description: 'The postcode'
}, {

View File

@ -8,8 +8,14 @@ class Controller extends Section {
}
onSubmit() {
this.$.data = null;
this.$http.get(`Zones/getEvents`, {params: this.$.params})
.then(res => this.$.data = res.data);
.then(res => {
let data = res.data;
this.$.data = data;
if (!data.events.length)
this.vnApp.showMessage(this.$t('No service for the specified zone'));
});
}
}

View File

@ -160,12 +160,12 @@
response="cancel"
translate-attr="{value: 'Cancel'}">
</input>
<button
<input
type="button"
ng-if="!$ctrl.isNew"
response="delete"
translate>
Delete
</button>
translate-attr="{value: 'Delete'}">
</input>
<button response="accept">
<span ng-if="$ctrl.isNew" translate>Add</span>
<span ng-if="!$ctrl.isNew" translate>Save</span>

View File

@ -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');
}

View File

@ -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();

View File

@ -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`
];

View File

@ -12,4 +12,4 @@ claim: Reclamación {0}
sections:
agency:
description: 'Para agilizar tu recogida, por favor, pónte en contacto con la oficina
de integrados. <br/> Tlf: 96 166 77 88 - Ana Gómez (Ext. 2133) <em>(agomezf@integra2.es)</em>'
de integrados. <br/> Tlf: 96 166 77 88 - Ana Gómez (Ext. 2113) <em>(agomezf@integra2.es)</em>'