Script arranque, @salix-services renombrado

This commit is contained in:
Juan Ferrer Toribio 2016-11-18 14:12:57 +01:00
parent e1b71136f5
commit 4b50924243
74 changed files with 177 additions and 228 deletions

View File

@ -1,3 +0,0 @@
{
"salix": "http://localhost:8080/salix/login"
}

View File

@ -1,110 +0,0 @@
html, body {
height: 100%;
margin: 0px;
padding: 0px;
}
html [full-height], .full-height {
height: 100%;
}
html [self-scroll], .self-scroll {
overflow: auto;
}
/* Horizontal & vertical */
html [vn-horizontal], vn-horizontal, .vn-horizontal,
html [vn-vertical], vn-vertical, .vn-vertical {
display: flex;
}
html [vn-horizontal], vn-horizontal, .vn-horizontal {
flex-direction: row;
}
vn-horizontal [reverse] {
flex-direction: row-reverse;
}
html [vn-vertical], vn-vertical, .vn-vertical {
flex-direction: column;
}
vn-vertical [reverse] {
flex-direction: column-reverse;
}
html [wrap] {
flex-wrap: wrap;
}
html [wrap-reverse] {
flex-wrap: wrap-reverse;
}
html [scrollable] {
min-height: 1px;
flex: 1;
flex-basis: 0.000000001px;
}
/* Horizontal & vertical childs */
html [vn-auto],
html [vn-none],
html [vn-one],
html [vn-two],
html [vn-three],
html [vn-four],
html [vn-five],
html [vn-six],
html [vn-seven],
html [vn-eight],
html [vn-nine],
html [vn-ten],
html [vn-eleven],
html [vn-twelve]{
flex-basis: 0.000000001px;
}
html [vn-auto], vn-auto, .vn-auto {
flex: 1;
flex-basis: auto;
}
html [vn-empty], vn-empty, .vn-empty {
display: block;
}
html [vn-none], vn-none, .vn-none {
flex: 1;
flex: none;
}
html [vn-one], vn-one, .vn-one {
flex: 1;
}
html [vn-two], vn-two, .vn-two {
flex: 2;
}
html [vn-three], vn-three, .vn-three {
flex: 3;
}
html [vn-four], vn-four, .vn-four {
flex: 4;
}
html [vn-five], vn-five, .vn-five {
flex: 5;
}
html [vn-six], vn-six, .vn-six {
flex: 6;
}
html [vn-seven], vn-seven, .vn-seven {
flex: 7;
}
html [vn-eight], vn-eight, .vn-eight {
flex: 8;
}
html [vn-nine], vn-nine, .vn-nine {
flex: 9;
}
html [vn-ten], vn-ten, .vn-ten {
flex: 10;
}
html [vn-eleven], vn-eleven, .vn-eleven {
flex: 11;
}
html [vn-twelve], vn-twelve, .vn-twelve {
flex: 12;
}

1
@salix/.gitignore vendored
View File

@ -1,3 +1,2 @@
node_modules
build
spliting.js

View File

@ -1,13 +1,24 @@
var path = require ('path');
var gulp = require ('gulp');
var gutil = require('gulp-util');
var wrap = require('gulp-wrap');
var concat = require ('gulp-concat');
var babel = require ('gulp-babel');
var fs = require ('fs');
var del = require ('del');
var webpack = require ('webpack-stream');
var webpackConfig = require ('./webpack.config.js');
// Clean
var buildDir = '../services/nginx/static'
gulp.task ('clean', function ()
{
return del (buildDir +'/*', {force: true});
});
// Spliting
var splitingDir = './app/src/spliting';
@ -42,11 +53,19 @@ gulp.task ('spliting', function ()
// Webpack
gulp.task ('webpack', ['spliting'], function (callback)
gulp.task ('webpack-watch', ['spliting'], function ()
{
webpackConfig.watch = true;
return gulp.src (['app/index.js', 'login/index.js'])
.pipe (webpack (webpackConfig))
.pipe (gulp.dest (buildDir));
});
gulp.task ('webpack', ['spliting'], function ()
{
return gulp.src (['app/index.js', 'login/index.js'])
.pipe (webpack (webpackConfig))
.pipe (gulp.dest ('build/public/'));
.pipe (gulp.dest (buildDir));
});
// Routes
@ -63,7 +82,7 @@ gulp.task ('routes', function ()
.pipe (concat ('salix.routes.js', {newLine: ','}))
.pipe (wrap (globalTpl))
.pipe (babel ({presets: ['es2015']}))
.pipe (gulp.dest ('./build/public'));
.pipe (gulp.dest (buildDir));
});
// Watch
@ -76,6 +95,12 @@ gulp.task ('watch', function ()
// Default
gulp.task ('build', ['routes', 'webpack']);
gulp.task ('default', ['watch', 'build']);
gulp.task ('build', ['clean'], function ()
{
return gulp.start ('routes', 'webpack');
});
gulp.task ('default', ['clean'], function ()
{
return gulp.start ('watch', 'routes', 'webpack-watch');
});

View File

@ -1,55 +0,0 @@
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
sendfile on;
gzip on;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
server {
listen 8080;
server_name localhost;
autoindex off;
root /usr/share/nginx/html;
location /static {
alias public;
autoindex on;
}
location ~ ^/account(?:/(.*))?$ {
proxy_pass http://192.168.99.100:3000/$1$is_args$args;
}
location ~ ^/salix(?:/(.*))?$ {
proxy_pass http://192.168.99.100:3001/$1$is_args$args;
}
location ~ ^/customer(?:/(.*))?$ {
proxy_pass http://192.168.99.100:3002/$1$is_args$args;
}
}
types {
text/html html;
application/json json;
application/javascript js;
text/css css scss;
text/xml xml;
image/x-icon ico;
image/png png;
image/svg+xml svg;
image/gif gif;
image/jpeg jpeg jpg;
}
}

View File

@ -21,6 +21,7 @@
"babel-preset-es2015": "*",
"cors": "^2.8.1",
"css-loader": "^0.25.0",
"del": "^2.2.2",
"eslint": "^3.7.1",
"eslint-config-angular": "^0.5.0",
"eslint-config-google": "^0.6.0",

View File

@ -2,14 +2,15 @@
var webpack = require ('webpack');
var path = require ('path');
module.exports =
{
var devMode = process.env.NODE_ENV !== 'production';
var config = {
entry: {
'salix.app': ['app'],
'salix.login': ['login']
},
output: {
path: path.join (__dirname, 'build', 'public'),
path: path.join (__dirname, '../services/nginx/static'),
filename: '[name].js',
publicPath: '/static/',
chunkFilename: "chunk.[name].[chunkhash].js"
@ -38,13 +39,7 @@ module.exports =
}
]
},
/* plugins: [
new webpack.optimize.UglifyJsPlugin ({
minimize: true,
compress: { warnings: false }
})
],
*/ resolve: {
resolve: {
modulesDirectories: [
__dirname,
'node_modules'
@ -54,7 +49,16 @@ module.exports =
inline: true,
host: '0.0.0.0'
},
devtool: 'source-map',
watch: true
devtool: 'source-map'
};
if (!devMode) {
config.plugins.push (
new webpack.optimize.UglifyJsPlugin ({
minimize: true,
compress: { warnings: false }
})
);
}
module.exports = config;

14
db.json Normal file
View File

@ -0,0 +1,14 @@
{
"ids": {
"User": 2,
"AccessToken": 2
},
"models": {
"User": {
"1": "{\"password\":\"$2a$10$Jm6EvaU2GoCGdQXw/JU62OZvDav6I6/s1E8EJdFF5.s2o8NDf.ZL6\",\"email\":\"admin@admin.com\",\"id\":1}"
},
"AccessToken": {
"acx1tuahwKkaE522cG1HJds5XKsdMlwRsUvm0IZSHhJYvWfoU8LGexOZrKoVDQgp": "{\"id\":\"acx1tuahwKkaE522cG1HJds5XKsdMlwRsUvm0IZSHhJYvWfoU8LGexOZrKoVDQgp\",\"ttl\":1209600,\"created\":\"2016-11-18T13:03:41.152Z\",\"userId\":1}"
}
}
}

33
env.cmd Normal file
View File

@ -0,0 +1,33 @@
@echo off
if "%1"=="" goto caseStart
if "%1"=="start" goto caseStart
if "%1"=="stop" goto caseStop
goto caseUsage
caseStart:
echo ######################
echo "Arrancando Servicios"
echo ######################
echo.
call "%0" stop
call forever start forever.json
call forever list
call nginx -c conf-dev.conf -p @salix
call cd @salix
call gulp
exit 0
caseStop:
echo ######################
echo "Parando Servicios"
echo ######################
echo.
call forever stopall
call forever list
call nginx -c conf-dev.conf -p @salix -s stop
exit 0
caseUsage:
echo "Usage: %0 [start|stop]"
exit 1

22
env.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
nginxDir="${PWD}/services/nginx"
case "$1" in
start|"")
$0 stop > /dev/null
forever start forever.json
forever list
/usr/sbin/nginx -c "$nginxDir/conf-dev.conf" -p "$nginxDir"
cd @salix && gulp
;;
stop)
forever stopall
forever list
/usr/sbin/nginx -c "$nginxDir/conf-dev.conf" -p "$nginxDir" -s stop
cd @salix && gulp clean
;;
*)
echo "Usage: `basename "$0"` [start|stop]"
exit 1
esac

View File

@ -4,7 +4,7 @@
"append": true,
"watch": true,
"script": "server.js",
"sourceDir": "./@salix-services/salix/server",
"sourceDir": "./services/salix/server",
"workingDir": "."
},
{
@ -12,7 +12,7 @@
"append": true,
"watch": true,
"script": "server.js",
"sourceDir": "./@salix-services/account/server",
"sourceDir": "./services/account/server",
"workingDir": "."
},
{
@ -20,7 +20,7 @@
"append": true,
"watch": true,
"script": "server.js",
"sourceDir": "./@salix-services/client/server",
"sourceDir": "./services/client/server",
"workingDir": "."
}
]

View File

@ -0,0 +1,3 @@
{
"salix": "/salix/login"
}

2
services/nginx/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
static/*
temp/*

View File

@ -4,6 +4,6 @@ RUN rm /etc/nginx/nginx.conf
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx_docker.conf /etc/nginx/nginx.conf
COPY conf-prod.conf /etc/nginx/nginx.conf
COPY build /etc/nginx

View File

@ -1,24 +1,24 @@
worker_processes 1;
error_log build/nginx/error.log;
pid build/nginx/nginx.pid;
error_log temp/error.log;
pid temp/nginx.pid;
events {
worker_connections 1024;
}
http {
sendfile on;
gzip on;
default_type application/octet-stream;
sendfile on;
gzip on;
default_type application/octet-stream;
access_log build/nginx/access.log;
client_body_temp_path build/nginx/client-body;
proxy_temp_path build/nginx/proxy;
fastcgi_temp_path build/nginx/fastcgi;
uwsgi_temp_path build/nginx/uwsgi;
scgi_temp_path build/nginx/scgi;
access_log temp/access.log;
client_body_temp_path temp/client-body;
proxy_temp_path temp/proxy;
fastcgi_temp_path temp/fastcgi;
uwsgi_temp_path temp/uwsgi;
scgi_temp_path temp/scgi;
server {
listen 8080;
@ -26,7 +26,7 @@ http {
autoindex off;
location /static {
alias build/public/;
alias static/;
autoindex on;
}

View File

@ -0,0 +1,39 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
sendfile on;
gzip on;
default_type application/octet-stream;
include /etc/nginx/mime.types;
server {
listen 8080;
server_name localhost;
autoindex off;
root /usr/share/nginx/html;
location /static {
alias public;
autoindex on;
}
location ~ ^/account(?:/(.*))?$ {
proxy_pass http://192.168.99.100:3000/$1$is_args$args;
}
location ~ ^/salix(?:/(.*))?$ {
proxy_pass http://192.168.99.100:3001/$1$is_args$args;
}
location ~ ^/customer(?:/(.*))?$ {
proxy_pass http://192.168.99.100:3002/$1$is_args$args;
}
}
}

View File

@ -2,12 +2,10 @@
<html>
<head>
<meta charset="UTF-8">
<title>Salix</title>
<link rel="stylesheet" href="layout.css"/>
<title>Salix</title>
</head>
<body>
<div style="position:fixed; top:0; right:0; height:6em; width:10em; background-color:red;"></div>
<vn-vertical id="app" class="full-height" ui-view scrollable>
</vn-vertical>
<script

View File

@ -1,15 +0,0 @@
@echo off
echo ######################
echo "Arrancando Servicios"
echo ######################
echo.
call forever start forever.json
call forever list
IF NOT EXIST @salix\build\nginx (
echo.
echo.
echo "Creando carpeta @salix\build\nginx...."
mkdir @salix\build\nginx
)
call nginx -c nginx.conf -p @salix

View File

@ -1,8 +0,0 @@
@echo off
echo ######################
echo "Parando Servicios"
echo ######################
echo.
call forever stopall
call forever list
call nginx -c nginx.conf -p @salix -s stop