Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
凌波微步_大先生
dashboard
提交
5805600d
D
dashboard
项目概览
凌波微步_大先生
/
dashboard
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dashboard
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5805600d
编写于
11月 19, 2015
作者:
P
Piotr Bryk
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #77 from cheld/fix-spawn-backend2
spawn backend in development and production mode
上级
c7ca5799
0b459165
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
42 addition
and
15 deletion
+42
-15
build/check.js
build/check.js
+5
-3
build/conf.js
build/conf.js
+10
-2
build/protractor.conf.js
build/protractor.conf.js
+1
-1
build/serve.js
build/serve.js
+24
-7
src/app/backend/dashboard.go
src/app/backend/dashboard.go
+2
-2
未找到文件。
build/check.js
浏览文件 @
5805600d
...
...
@@ -27,9 +27,11 @@ import conf from './conf';
* follows the style guide, it is buildable and all tests pass.
*
* This task should be used prior to publishing a change.
*/
gulp
.
task
(
'
check
'
,
[
'
lint
'
,
'
build
'
,
'
test
'
,
'
integration-test:prod
'
]);
*
* TODO(cheld) enable integration tests once kuberentes cluster can be launched in travis
* gulp.task('check', ['lint', 'build', 'test', 'integration-test:prod']);
**/
gulp
.
task
(
'
check
'
,
[
'
lint
'
,
'
build
'
,
'
test
'
]);
/**
* Lints all projects code files. This includes frontend source code, as well as, build scripts.
...
...
build/conf.js
浏览文件 @
5805600d
...
...
@@ -45,9 +45,13 @@ export default {
*/
testPackageName
:
'
test/backend
'
,
/**
* Port number of the
development server started by Gulp
.
* Port number of the
backend server. Only used during development
.
*/
devServerPort
:
8080
,
devServerPort
:
9091
,
/**
* Address for the Kubernetes API server.
*/
apiServerHost
:
'
http://localhost:8080
'
,
},
/**
...
...
@@ -64,6 +68,10 @@ export default {
* Frontend application constants.
*/
frontend
:
{
/**
* Port number to access the dashboard UI
*/
serverPort
:
9090
,
/**
* The name of the root Angular module, i.e., the module that bootstraps the application.
*/
...
...
build/protractor.conf.js
浏览文件 @
5805600d
...
...
@@ -29,7 +29,7 @@ var path = require('path');
* Schema can be found here: https://github.com/angular/protractor/blob/master/docs/referenceConf.js
*/
exports
.
config
=
{
baseUrl
:
'
http://localhost:
3000
'
,
baseUrl
:
'
http://localhost:
'
+
conf
.
frontend
.
serverPort
,
capabilities
:
{
// Firefox is used instead of Chrome, because that's what Travis supports best.
...
...
build/serve.js
浏览文件 @
5805600d
...
...
@@ -67,6 +67,7 @@ function browserSyncInit(baseDir, includeBowerComponents) {
baseDir
:
baseDir
,
middleware
:
proxyMiddleware
(
proxyMiddlewareOptions
),
},
port
:
conf
.
frontend
.
serverPort
,
startPath
:
'
/
'
,
};
...
...
@@ -96,31 +97,29 @@ function serveDevelopmentMode() {
* Serves the application in development mode. Watches for changes in the source files to rebuild
* development artifacts.
*/
gulp
.
task
(
'
serve:watch
'
,
[
'
watch
'
],
serveDevelopmentMode
);
gulp
.
task
(
'
serve:watch
'
,
[
'
spawn-backend
'
,
'
watch
'
],
serveDevelopmentMode
);
/**
* Serves the application in development mode.
*/
gulp
.
task
(
'
serve
'
,
[
'
index
'
],
serveDevelopmentMode
);
gulp
.
task
(
'
serve
'
,
[
'
spawn-backend
'
,
'
index
'
],
serveDevelopmentMode
);
/**
* Serves the application in production mode.
*/
gulp
.
task
(
'
serve:prod
'
,
[
'
build-frontend
'
],
function
()
{
browserSyncInit
(
conf
.
paths
.
distPublic
,
false
);
});
gulp
.
task
(
'
serve:prod
'
,
[
'
spawn-backend:prod
'
]);
/**
* Spawns new backend application process and finishes the task immediately. Previously spawned
* backend process is killed beforehand, if any.
* backend process is killed beforehand, if any.
The frontend pages are served by BrowserSync.
*/
gulp
.
task
(
'
spawn-backend
'
,
[
'
backend
'
,
'
kill-backend
'
],
function
()
{
runningBackendProcess
=
child
.
spawn
(
path
.
join
(
conf
.
paths
.
serve
,
conf
.
backend
.
binaryName
),
[
`--port=
${
conf
.
backend
.
devServerPort
}
`
],
[
`--
apiserver-host=
${
conf
.
backend
.
apiServerHost
}
`
,
`--
port=
${
conf
.
backend
.
devServerPort
}
`
],
{
stdio
:
'
inherit
'
});
runningBackendProcess
.
on
(
'
exit
'
,
function
()
{
...
...
@@ -130,6 +129,24 @@ gulp.task('spawn-backend', ['backend', 'kill-backend'], function () {
});
/**
* Spawns new backend application process and finishes the task immediately. Previously spawned
* backend process is killed beforehand, if any. In production the backend does serve the frontend
* pages as well.
*/
gulp
.
task
(
'
spawn-backend:prod
'
,
[
'
build-frontend
'
,
'
backend:prod
'
,
'
kill-backend
'
],
function
()
{
runningBackendProcess
=
child
.
spawn
(
path
.
join
(
conf
.
paths
.
dist
,
conf
.
backend
.
binaryName
),
[
`--apiserver-host=
${
conf
.
backend
.
apiServerHost
}
`
,
`--port=
${
conf
.
frontend
.
serverPort
}
`
],
{
stdio
:
'
inherit
'
,
cwd
:
conf
.
paths
.
dist
});
runningBackendProcess
.
on
(
'
exit
'
,
function
()
{
// Mark that there is no backend process running anymore.
runningBackendProcess
=
null
;
});
});
/**
* Kills running backend process (if any).
*/
...
...
src/app/backend/dashboard.go
浏览文件 @
5805600d
...
...
@@ -24,10 +24,10 @@ import (
)
var
(
argPort
=
pflag
.
Int
(
"port"
,
808
0
,
"The port to listen to for incoming HTTP requests"
)
argPort
=
pflag
.
Int
(
"port"
,
909
0
,
"The port to listen to for incoming HTTP requests"
)
argApiserverHost
=
pflag
.
String
(
"apiserver-host"
,
""
,
"The address of the Kubernetes Apiserver "
+
"to connect to in the format of protocol://address:port, e.g., "
+
"http://localhost:80
01. If not specified, the assumption is that the binary runs in
a"
+
"http://localhost:80
80. If not specified, the assumption is that the binary runs inside
a"
+
"Kubernetes cluster and local discovery is attempted."
)
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录