Merge branch 'test' into 0000-mergeWithTest

This commit is contained in:
Juan Ferrer 2019-12-13 12:50:26 +01:00
commit 6b7fb93e44
6 changed files with 26 additions and 28 deletions

View File

@ -12,7 +12,6 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
nodejs \ nodejs \
&& apt-get purge -y --auto-remove \ && apt-get purge -y --auto-remove \
curl \
gnupg2 \ gnupg2 \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& npm -g install pm2 && npm -g install pm2
@ -33,4 +32,7 @@ COPY \
README.md \ README.md \
./ ./
CMD ["pm2-docker", "./loopback/server/server.js"] CMD ["pm2-runtime", "./back/process.yml"]
HEALTHCHECK --interval=1m --timeout=10s \
CMD curl -f http://localhost:3000/api/Applications/status || exit 1

12
Jenkinsfile vendored
View File

@ -10,8 +10,10 @@ pipeline {
REGISTRY = 'registry.verdnatura.es' REGISTRY = 'registry.verdnatura.es'
DOCKER_HOST_1 = 'vch1.verdnatura.es' DOCKER_HOST_1 = 'vch1.verdnatura.es'
DOCKER_HOST_2 = 'vch2.verdnatura.es' DOCKER_HOST_2 = 'vch2.verdnatura.es'
PORT_MASTER = '5002' PORT_MASTER_FRONT = '5002'
PORT_TEST = '5001' PORT_MASTER_BACK = '3001-3002'
PORT_TEST_FRONT = '5001'
PORT_TEST_BACK = '4001-4002'
TAG = "${env.BRANCH_NAME}" TAG = "${env.BRANCH_NAME}"
} }
stages { stages {
@ -31,10 +33,12 @@ pipeline {
switch (env.BRANCH_NAME) { switch (env.BRANCH_NAME) {
case 'master': case 'master':
env.PORT = PORT_MASTER env.PORT_FRONT = PORT_MASTER_FRONT
env.PORT_BACK = PORT_MASTER_BACK
break break
case 'test': case 'test':
env.PORT = PORT_TEST env.PORT_FRONT = PORT_TEST_FRONT
env.PORT_BACK = PORT_TEST_BACK
break break
} }
switch (env.BRANCH_NAME) { switch (env.BRANCH_NAME) {

5
back/process.yml Normal file
View File

@ -0,0 +1,5 @@
apps:
- script: ./loopback/server/server.js
name: salix-back
instances: 1
max_restarts: 5

View File

@ -7,13 +7,15 @@ services:
context: . context: .
dockerfile: front/Dockerfile dockerfile: front/Dockerfile
ports: ports:
- ${PORT}:80 - ${PORT_FRONT}:80
links: links:
- back - back
back: back:
image: registry.verdnatura.es/salix-back:${TAG} image: registry.verdnatura.es/salix-back:${TAG}
restart: unless-stopped restart: unless-stopped
build: . build: .
ports:
- ${PORT_BACK}:3000
environment: environment:
- NODE_ENV - NODE_ENV
volumes: volumes:

View File

@ -1,16 +1,4 @@
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
log_format upstreamlog
'[$time_local] $remote_addr -> $proxy_host:$upstream_addr '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
access_log /var/log/nginx/access.log upstreamlog;
upstream back {
server back_1:3000;
server back_2:3000;
}
server { server {
listen 80 default_server; listen 80 default_server;
listen [::]:80 default_server; listen [::]:80 default_server;
@ -24,9 +12,6 @@ server {
location @notfound { location @notfound {
return 302 /; return 302 /;
} }
location ~ ^(/[a-zA-Z0-9_-]+)?/(?<path>api(/.*)?)$ {
proxy_pass http://back/$path$is_args$args;
}
location / { location / {
autoindex on; autoindex on;
} }

View File

@ -20,7 +20,7 @@ module.exports = function(Self) {
this.beginTransaction = function(options, cb) { this.beginTransaction = function(options, cb) {
options = options || {}; options = options || {};
if (!options.timeout) if (!options.timeout)
options.timeout = 30000; options.timeout = 120000;
return orgBeginTransaction.call(this, options, cb); return orgBeginTransaction.call(this, options, cb);
}; };
}); });