#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 node_modules
dist/* dist/*
build
npm-debug.log npm-debug.log
docker-compose.yml
.eslintcache .eslintcache
.env.json datasources.*.json
db.json

View File

@ -1,16 +1,24 @@
FROM vn-node FROM vn-node
RUN mkdir /salix ENV NODE_ENV test
WORKDIR /salix WORKDIR /salix
COPY package.json .
COPY loopback loopback
RUN npm install --only=prod
COPY dist . COPY back back
COPY modules . COPY dist dist
#COPY node_modules . COPY modules modules
COPY loopback . COPY \
COPY dist/webpack-assets.json loopback/client modules.yml \
LICENSE \
README.md \
./
RUN rm /etc/nginx/sites-enabled/default WORKDIR /etc/nginx
COPY services/nginx/temp/nginx.conf /etc/nginx/sites-available/salix COPY services/nginx/temp/nginx.conf sites-available/salix
RUN ln -s /etc/nginx/sites-available/salix /etc/nginx/sites-enabled/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 // Deployment
gulp.task('build', ['clean'], async() => { 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() => { gulp.task('docker-compose', async() => {
@ -202,8 +202,7 @@ gulp.task('docker-compose', async() => {
gulp.task('build-clean', () => { gulp.task('build-clean', () => {
const del = require('del'); const del = require('del');
const files = [ const files = [
`${buildDir}/*`, `${buildDir}/*`
`docker-compose.yml`
]; ];
return del(files, {force: true}); return del(files, {force: true});
}); });

View File

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

2
services/.gitignore vendored
View File

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

View File

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