Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-deploy-utils
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
qa-deploy-utils
Commits
f39bf25d
Commit
f39bf25d
authored
Feb 10, 2018
by
tywldx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
cd9a2268
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
4 deletions
+64
-4
dump.sh
db-utils/dump.sh
+2
-2
get_project_config_server.js
qa_shell_script/config_server/get_project_config_server.js
+62
-2
No files found.
db-utils/dump.sh
View file @
f39bf25d
#!/bin/bash
dbs
=
`
curl http://
localhost
:10088/config_server/get_db_config/all/name
`
\
dbs
=
`
curl http://
192.168.4.3
:10088/config_server/get_db_config/all/name
`
\
db_file
=
/tmp
for
db
in
$dbs
do
sql_command
=
`
curl http://
localhost
:10088/config_server/get_db_dump_command/
${
db
}
`
sql_command
=
`
curl http://
192.168.4.3
:10088/config_server/get_db_dump_command/
${
db
}
`
$sql_command
>
${
db_file
}
/
${
db
}
.sql
mysql
-h
192.168.6.2
-P
3306
-uqa
-pqatest
db <
${
db_file
}
/
${
db
}
.sql
done
\ No newline at end of file
qa_shell_script/config_server/get_project_config_server.js
View file @
f39bf25d
var
express
=
require
(
'
express
'
);
var
cproc
=
require
(
'
child_process
'
);
var
bodyParser
=
require
(
'
body-parser
'
);
var
db_config
=
require
(
'
./config/db
'
);
// return
var
execSync
=
cproc
.
execSync
;
var
options
=
{
inflate
:
true
,
...
...
@@ -38,7 +40,7 @@ var attrComsArr = [];
for
(
let
i
of
attrComs
){
attrComsArr
.
push
(
attrs
[
i
]);
}
// ------------UTILS----------
// ------------UTILS----------
--
function
parseStr2Json
(
str
){
var
a
=
{};
var
strs
=
str
.
split
(
"
"
);
...
...
@@ -70,8 +72,37 @@ function parseJson2Str(json){
return
a
.
join
(
"
"
)
}
// ------------UTILS----------
// DB 维护数据
let
db_conf
=
db_config
.
db_config
();
let
db_conf_keys
=
Object
.
keys
(
db_conf
);
//
admin
.
get
(
'
/get_db_config/:name/:attr
'
,
function
(
req
,
res
)
{
let
str
=
""
if
(
req
.
params
.
name
==
"
all
"
){
if
(
req
.
params
.
attr
==
"
name
"
){
res
.
send
(
db_conf_keys
.
join
(
"
"
));
}
}
else
{
if
(
req
.
params
.
attr
!=
"
all
"
){
res
.
send
(
db_conf
[
req
.
params
.
name
][
req
.
params
.
attr
])
}
else
{
let
item
=
db_conf
[
req
.
params
.
name
]
res
.
send
(
`
${
item
.
source_db_host
}
;
${
item
.
source_db_port
}
;
${
item
.
source_db_user
}
;
${
item
.
source_db_pwd
}
;
${
item
.
sys_table_list
}
;`
)
}
}
});
admin
.
get
(
'
/get_db_dump_command/:name
'
,
function
(
req
,
res
)
{
res
.
send
(
db_config
.
get_mysql_dump_command
(
req
.
params
.
name
));
});
admin
.
get
(
'
/get_db_config/refersh
'
,
function
(){
res
.
setHeader
(
"
Content-Type
"
,
"
application/json
"
);
db_conf
=
db_config
.
db_config
();
db_conf_keys
=
Object
.
keys
(
db_conf
);
res
.
send
({
code
:
"
OK
"
})
})
// 获取节点命令
admin
.
get
(
'
/get_node_command/:name
'
,
function
(
req
,
res
)
{
res
.
setHeader
(
"
Content-Type
"
,
"
application/json
"
);
var
str
=
execSync
(
`node ./get_project_config.js -name
${
req
.
params
.
name
}
-attr config_file/command/gitPathHead`
)
...
...
@@ -219,6 +250,35 @@ admin.get('/get_proxy', function (req, res) {
res
.
send
({
namespace
:
String
(
str
)});
});
app
.
use
(
'
/config_server
'
,
admin
)
console
.
log
(
"
http://192.168.4.3:10088/config_server/get_node_command
"
)
app
.
listen
(
10088
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment