Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
BlackPearl
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
BlackPearl
Commits
dcef5747
Commit
dcef5747
authored
Oct 31, 2017
by
tywldx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug
parent
03e967f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
server.js
app/blackPearl/controller/debug/server.js
+28
-7
No files found.
app/blackPearl/controller/debug/server.js
View file @
dcef5747
...
@@ -66,8 +66,19 @@ exports.initial = async function () {
...
@@ -66,8 +66,19 @@ exports.initial = async function () {
await
this
.
bindDefault
();
await
this
.
bindDefault
();
let
_this
=
this
;
let
_this
=
this
;
//初始化一个docker镜像
//初始化一个docker镜像
let
xterm_port
=
await
getPort
();
let
xterm_port
,
mock_port
;
let
mock_port
=
await
getPort
(
xterm_port
);
let
res_str
=
await
client
.
getAsync
(
`
${
this
.
request
.
ip
}
docker`
).
then
(
function
(
records
)
{
return
records
});
if
(
res_str
==
null
){
xterm_port
=
await
getPort
();
mock_port
=
await
getPort
(
xterm_port
);
}
else
{
let
res
=
JSON
.
parse
(
res_str
);
xterm_port
=
res
.
xterm_port
;
mock_port
=
res
.
mock_port
;
}
let
run_command
=
`docker run --privileged -d -v
${
pwd
}
/uploads:/root/BlackPearl/uploads -p
${
xterm_port
}
:3000 -p
${
mock_port
}
:10086 192.168.4.36/playground/debug_image /sbin/init`
;
let
run_command
=
`docker run --privileged -d -v
${
pwd
}
/uploads:/root/BlackPearl/uploads -p
${
xterm_port
}
:3000 -p
${
mock_port
}
:10086 192.168.4.36/playground/debug_image /sbin/init`
;
var
re_str
=
execSync
(
run_command
);
var
re_str
=
execSync
(
run_command
);
console
.
log
(
run_command
);
console
.
log
(
run_command
);
...
@@ -77,8 +88,8 @@ exports.initial = async function () {
...
@@ -77,8 +88,8 @@ exports.initial = async function () {
client
.
set
(
`
${
_this
.
request
.
ip
}
docker`
,
JSON
.
stringify
({
client
.
set
(
`
${
_this
.
request
.
ip
}
docker`
,
JSON
.
stringify
({
id
:
id
,
id
:
id
,
is_debug
:
true
,
is_debug
:
true
,
term_url
:
term_url
,
mock_port
:
mock_port
,
mock_url
:
mock_url
xterm_port
:
xterm_port
}));
}));
spawn
(
"
sh
"
,
[
"
./shell_script/start_docker_image.sh
"
,
id
]);
spawn
(
"
sh
"
,
[
"
./shell_script/start_docker_image.sh
"
,
id
]);
this
.
response
.
body
=
{
term_url
:
term_url
,
mock_url
:
mock_url
}
this
.
response
.
body
=
{
term_url
:
term_url
,
mock_url
:
mock_url
}
...
@@ -119,10 +130,20 @@ exports.stop = async function () {
...
@@ -119,10 +130,20 @@ exports.stop = async function () {
let
res_str
=
await
client
.
getAsync
(
`
${
this
.
request
.
ip
}
docker`
).
then
(
function
(
records
)
{
let
res_str
=
await
client
.
getAsync
(
`
${
this
.
request
.
ip
}
docker`
).
then
(
function
(
records
)
{
return
records
return
records
});
});
console
.
log
(
res_str
)
//
console.log(res_str)
if
(
res_str
!=
null
)
{
if
(
res_str
!=
null
)
{
spawn
(
"
sh
"
,
[
"
./shell_script/stop_docker_image.sh
"
,
JSON
.
parse
(
res_str
).
id
]);
let
res
=
JSON
.
parse
(
res_str
);
client
.
del
(
`
${
this
.
request
.
ip
}
docker`
);
spawn
(
"
sh
"
,
[
"
./shell_script/stop_docker_image.sh
"
,
res
.
id
]);
client
.
set
(
`
${
_this
.
request
.
ip
}
docker`
,
JSON
.
stringify
({
id
:
""
,
is_debug
:
false
,
mock_port
:
res
.
mock_port
,
xterm_port
:
res
.
xterm_port
}));
// client.del(`${this.request.ip}docker`);
this
.
response
.
body
=
{
code
:
"
0000
"
}
this
.
response
.
body
=
{
code
:
"
0000
"
}
}
else
{
}
else
{
this
.
response
.
body
=
{
code
:
"
0001
"
}
this
.
response
.
body
=
{
code
:
"
0001
"
}
...
...
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