#814 Deploy fixes

This commit is contained in:
Juan Ferrer 2018-12-27 16:10:55 +01:00
parent 2ead6f145d
commit 3b08beccfe
9 changed files with 58 additions and 60 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
node_modules
front
services
!services/nginx/temp/nginx.conf

5
.gitignore vendored
View File

@ -1,7 +1,6 @@
node_modules
dist/*
build
npm-debug.log
docker-compose.yml
.eslintcache
.env.json
datasources.*.json
db.json

View File

@ -1,16 +1,24 @@
FROM vn-node
RUN mkdir /salix
ENV NODE_ENV test
WORKDIR /salix
COPY package.json .
COPY loopback loopback
RUN npm install --only=prod
COPY dist .
COPY modules .
#COPY node_modules .
COPY loopback .
COPY dist/webpack-assets.json loopback/client
COPY back back
COPY dist dist
COPY modules modules
COPY \
modules.yml \
LICENSE \
README.md \
./
RUN rm /etc/nginx/sites-enabled/default
COPY services/nginx/temp/nginx.conf /etc/nginx/sites-available/salix
RUN ln -s /etc/nginx/sites-available/salix /etc/nginx/sites-enabled/salix
WORKDIR /etc/nginx
COPY services/nginx/temp/nginx.conf sites-available/salix
RUN rm sites-enabled/default && ln -s ../sites-available/salix sites-enabled/salix
CMD ["pm2-docker", "./server/server.js"]
WORKDIR /salix
CMD ["pm2-docker", "./loopback/server/server.js"]

View File

@ -1,9 +0,0 @@
version: '3.5'
services:
nginx:
privileged: true
build:
context: ./services/nginx
ports:
- 80:80
links: []

15
docker-compose.yml Normal file
View File

@ -0,0 +1,15 @@
version: '3.5'
services:
salix:
build:
context: .
dockerfile: Dockerfile
ports:
- 80:80
environment:
NODE_ENV: '${NODE_ENV}'
container_name: salix
image: 'salix:latest'
restart: unless-stopped
volumes:
- '/config:/config'

View File

@ -142,7 +142,7 @@ gulp.task('install', () => {
// Deployment
gulp.task('build', ['clean'], async() => {
await runSequenceP(['routes', 'locales', 'webpack', 'docker-compose', 'nginx-conf']);
await runSequenceP(['routes', 'locales', 'webpack', 'nginx-conf']);
});
gulp.task('docker-compose', async() => {
@ -202,8 +202,7 @@ gulp.task('docker-compose', async() => {
gulp.task('build-clean', () => {
const del = require('del');
const files = [
`${buildDir}/*`,
`docker-compose.yml`
`${buildDir}/*`
];
return del(files, {force: true});
});

View File

@ -7,6 +7,4 @@
route,
agency,
travel
# mailer
# print
]

2
services/.gitignore vendored
View File

@ -1,2 +0,0 @@
datasources.*.json
db.json

View File

@ -1,18 +1,5 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
sendfile on;
gzip on;
default_type application/octet-stream;
resolver 127.0.0.1;
include /etc/nginx/mime.types;
server {
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
@ -21,8 +8,8 @@ http {
root /usr/share/nginx/html;
{{#services}}
location ~ ^/{{name}}(?:/(.*))?$ {
proxy_pass http://localhost:{{defaultPort}}/$1$is_args$args;
location ~ ^/{{.}}(?:/(.*))?$ {
proxy_pass http://127.0.0.1:{{defaultPort}}/$1$is_args$args;
}
{{/services}}
@ -31,7 +18,6 @@ http {
autoindex on;
}
location ~ ^(?:/(.*))?$ {
proxy_pass http://localhost:{{defaultPort}}/$1$is_args$args;
}
proxy_pass http://127.0.0.1:{{defaultPort}}/$1$is_args$args;
}
}