Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lisa Casino
slapos.package
Commits
d7a0af70
Commit
d7a0af70
authored
Jul 19, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine the process of create slapos-webrunner instance
parent
af65d002
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
106 deletions
+108
-106
windows/docs/using-slapos-in-windows.xml
windows/docs/using-slapos-in-windows.xml
+1
-1
windows/scripts/slapos-include.sh
windows/scripts/slapos-include.sh
+41
-80
windows/scripts/slapos-node.sh
windows/scripts/slapos-node.sh
+66
-25
No files found.
windows/docs/using-slapos-in-windows.xml
View file @
d7a0af70
...
@@ -102,7 +102,7 @@ Then waiting for configure script finished. Be sure the configure scrip report s
...
@@ -102,7 +102,7 @@ Then waiting for configure script finished. Be sure the configure scrip report s
</section>
</section>
<section><title>
SlapOS Node
</title>
<section><title>
SlapOS Node
</title>
<para>
It's used to format slapos node, release software and create instance, you an run it at any time.
</para>
<para>
It's used to
create instance of slapos webrunner,
format slapos node, release software and create instance, you an run it at any time.
</para>
<para>
Click Start -> SlapOS -> SlapOS Node, if the current user isn't Administrator, Right click SlapOS Node, then Run As Administrator.
</para>
<para>
Click Start -> SlapOS -> SlapOS Node, if the current user isn't Administrator, Right click SlapOS Node, then Run As Administrator.
</para>
<para>
Be sure the scrip reports successfully, otherwise fix the problem and run it again.
</para>
<para>
Be sure the scrip reports successfully, otherwise fix the problem and run it again.
</para>
</section>
</section>
...
...
windows/scripts/slapos-include.sh
View file @
d7a0af70
...
@@ -381,66 +381,20 @@ function create_template_configure_file()
...
@@ -381,66 +381,20 @@ function create_template_configure_file()
}
# === create_template_configure_file() === #
}
# === create_template_configure_file() === #
# ======================================================================
# ======================================================================
# Routine:
create
_slapos_webrunner_instance
# Routine:
get
_slapos_webrunner_instance
#
Create one instance of slapos webrunner in local computer
#
Get instance connection information and create slaprunner startup file
# ======================================================================
# ======================================================================
function
create
_slapos_webrunner_instance
()
function
get
_slapos_webrunner_instance
()
{
{
local
_
title
local
_
guid
=
$1
local
_
guid
local
_
title
=
$2
local
_feature_code
=
"#-*- SlapOS Web Runner JavaScript Boot Code -*-#"
local
_feature_code
=
"#-*- SlapOS Web Runner JavaScript Boot Code -*-#"
local
_re6stnet_ipv6
local
_patch_file
=
/etc/slapos/patches/slapos-cookbook-inotifyx.patch
local
_url
local
_url
local
_ret
=
0
echo
Checking SlapOS Webruner ...
csih_inform
"Trying to get connection information of SlapOS WebRunner instance ..."
if
grep
-q
-F
"
${
_feature_code
}
"
${
slaprunner_startup_file
}
;
then
/opt/slapos/bin/slapos request
${
client_configure_file
}
\
${
_title
}
slaposwebrunner
--node
computer_guid
=
${
_guid
}
||
return
1
echo
"Find feature code
${
_feature_code
}
in the
${
slaprunner_startup_file
}
"
echo
"Check SlapOS Webrunner OK."
else
echo
Installing SlapOS Webrunner ...
_guid
=
$(
grep
"CN=COMP"
$node_certificate_file
|
\
sed
-e
"s/^.*, CN=//g"
|
sed
-e
"s%/emailAddress.*
\$
%%g"
)
[[
"
${
_guid
}
"
==
COMP-+
([
0-9]
)
]]
||
csih_error
"Invalid computer id '
${
_guid
}
' specified."
echo
Got computer guid:
${
_guid
}
_title
=
"SlapOS-Node-Runner-In-
${
_guid
}
"
if
[[
-r
$re6stnet_configure_file
]]
;
then
_re6stnet_ipv6
=
$(
grep
"Your subnet"
$re6stnet_configure_file
|
\
sed
-e
"s/^.*subnet: //g"
-e
"s/
\/
80 (CN.*
\$
/1/g"
)
if
[[
-n
"
${
_re6stnet_ipv6
}
"
]]
;
then
echo
"Re6stnet address in this computer:
${
_re6stnet_ipv6
}
"
netsh interface ipv6 show addr
$slapos_ifname
level
=
normal |
\
grep
-q
"
${
_re6stnet_ipv6
}
\$
"
||
\
netsh interface ipv6 add addr
$slapos_ifname
${
_re6stnet_ipv6
}
fi
fi
/opt/slapos/bin/slapos node format
-cv
--now
||
\
csih_error
"Failed to run slapos format."
echo
"Supply slapwebrunner in the computer
${
_guid
}
"
/opt/slapos/bin/slapos supply slaposwebrunner
${
_guid
}
echo
"Request an instance
${
_title
}
..."
while
true
;
do
/opt/slapos/bin/slapos node software
--verbose
# Apply patches to slapos.cookbook for inotifix
if
[[
-r
${
_patch_file
}
]]
;
then
for
x
in
$(
find /opt/slapgrid/
-name
slapos.cookbook-
*
.egg
)
;
do
echo
Apply patch
${
_patch_file
}
at
$x
cd
$x
patch
-f
--dry-run
-p1
<
${
_patch_file
}
>
/dev/null
&&
\
patch
-p1
<
${
_patch_file
}
done
fi
/opt/slapos/bin/slapos node instance
--verbose
/opt/slapos/bin/slapos node report
--verbose
# Connection parameters of instance are:
# Connection parameters of instance are:
# {'backend_url': 'http://[2001:67c:1254:45::c5d5]:50000',
# {'backend_url': 'http://[2001:67c:1254:45::c5d5]:50000',
...
@@ -451,10 +405,15 @@ function create_slapos_webrunner_instance()
...
@@ -451,10 +405,15 @@ function create_slapos_webrunner_instance()
_url
=
$(
/opt/slapos/bin/slapos request
${
client_configure_file
}
\
_url
=
$(
/opt/slapos/bin/slapos request
${
client_configure_file
}
\
${
_title
}
slaposwebrunner
--node
computer_guid
=
${
_guid
}
|
\
${
_title
}
slaposwebrunner
--node
computer_guid
=
${
_guid
}
|
\
grep
backend_url |
sed
-e
"s/^.*': '//g"
-e
"s/',.*
$/
/g"
)
grep
backend_url |
sed
-e
"s/^.*': '//g"
-e
"s/',.*
$/
/g"
)
[[
-n
"
${
_url
}
"
]]
&&
echo
"SlapOS Web Runner URL:
${
_url
}
"
&&
break
done
cat
<<
EOF
>
$slaprunner_startup_file
if
[[
-n
"
${
_url
}
"
]]
;
then
csih_inform
"SlapOS WebRunner URL:
${
_url
}
"
if
grep
-q
-F
"
${
_feature_code
}
"
${
slaprunner_startup_file
}
;
then
csih_inform
"Find feature code
${
_feature_code
}
in the
${
slaprunner_startup_file
}
"
echo
"Check SlapOS Webrunner OK."
else
csih_inform
"Generate SlapOS WebRunner startup file
${
slaprunner_startup_file
}
"
cat
<<
EOF
>
${
slaprunner_startup_file
}
<html>
<html>
<head><title>SlapOS Web Runner</title>
<head><title>SlapOS Web Runner</title>
<script LANGUAGE="JavaScript">
<script LANGUAGE="JavaScript">
...
@@ -469,8 +428,10 @@ function openwin() {
...
@@ -469,8 +428,10 @@ function openwin() {
<!--
$feature_code
-->
<!--
$feature_code
-->
</html>
</html>
EOF
EOF
echo
SlapOS Webrunner boot file
$slaprunner_startup_file
generated.
echo
Install Web Runner OK.
echo
fi
fi
}
# === create_slapos_webrunner_instance() === #
else
csih_error_multi
"Request return true, but I can't find connection information,"
\
"something is wrong with slapos webrunner software."
fi
return
${
_ret
}
}
# === get_slapos_webrunner_instance() === #
windows/scripts/slapos-node.sh
View file @
d7a0af70
#! /bin/bash
#! /bin/bash
source
$(
/usr/bin/dirname
$0
)
/slapos-include.sh
source
$(
/usr/bin/dirname
$0
)
/slapos-include.sh
echo
echo
""
echo
"Start slapos-node script ..."
csih_inform
"Start slapos-node script ..."
echo
echo
""
declare
computer_guid
# -----------------------------------------------------------
# -----------------------------------------------------------
# Check all the configure files
# Check all the configure files
# -----------------------------------------------------------
# -----------------------------------------------------------
check_network_configure
||
exit
1
check_network_configure
check_node_configure
||
exit
1
check_node_configure
check_client_configure
||
exit
1
check_client_configure
check_cron_configure
check_cron_configure
check_re6stnet_configure
check_re6stnet_configure
# -----------------------------------------------------------
# -----------------------------------------------------------
# Check cygwin services used by slapos
# Check cygwin services used by slapos
# -----------------------------------------------------------
# -----------------------------------------------------------
check_cygwin_service cygserver
||
exit
1
check_cygwin_service cygserver
check_cygwin_service syslog-ng
||
exit
1
check_cygwin_service syslog-ng
check_cygwin_service sshd
check_cygwin_service sshd
check_cygwin_service cron
check_cygwin_service cron
check_re6stnet_needed
&&
check_cygwin_service re6stnet
check_re6stnet_needed
&&
check_cygwin_service re6stnet
# -----------------------------------------------------------
# -----------------------------------------------------------
#
Create instance of slap web runner
#
Get computer reference and re6stnet network
# -----------------------------------------------------------
# -----------------------------------------------------------
create_slapos_webrunner_instance
||
exit
1
computer_guid
=
$(
grep
"CN=COMP"
${
node_certificate_file
}
|
\
sed
-e
"s/^.*, CN=//g"
|
sed
-e
"s%/emailAddress.*
\$
%%g"
)
[[
"
${
computer_guid
}
"
==
COMP-+
([
0-9]
)
]]
||
csih_error_multi
"
${
computer_guid
}
is invalid computer guid."
\
"It should like 'COMP-XXXX', edit
${
node_certificate_file
}
"
\
"to fix it."
csih_inform
"Got computer reference id:
${
computer_guid
}
"
# -----------------------------------------------------------
# -----------------------------------------------------------
#
Format slapos node
#
Get re6stnet network
# -----------------------------------------------------------
# -----------------------------------------------------------
echo
"Formating SlapOS Node ..."
if
[[
-r
${
re6stnet_configure_file
}
]]
;
then
/opt/slapos/bin/slapos node format
-cv
--now
||
exit
1
_addr6
=
$(
grep
"Your subnet"
${
re6stnet_configure_file
}
|
\
sed
-e
"s/^.*subnet: //g"
-e
"s/
\/
80 (CN.*
\$
/1/g"
)
if
[[
-n
"
${
_addr6
}
"
]]
;
then
csih_inform
"Re6stnet address in this computer:
${
_addr6
}
"
netsh interface ipv6 show addr
${
slapos_ifname
}
level
=
normal |
\
grep
-q
"
${
_addr6
}
\$
"
||
\
netsh interface ipv6 add addr
${
slapos_ifname
}
${
_addr6
}
fi
fi
# -----------------------------------------------------------
# -----------------------------------------------------------
#
Release softwar
e
#
Format slapos nod
e
# -----------------------------------------------------------
# -----------------------------------------------------------
echo
"Releasing software ..."
csih_inform
"Formating SlapOS Node ..."
/opt/slapos/bin/slapos node software
--verbose
/opt/slapos/bin/slapos node format
-cv
--now
||
csih_error
"Run slapos node format failed. "
# -----------------------------------------------------------
# -----------------------------------------------------------
#
Instance software
#
Request an instance of slapos webrunner
# -----------------------------------------------------------
# -----------------------------------------------------------
echo
"Creating instance ..."
csih_inform
"Supply slaposwebrunner in the computer
${
computer_guid
}
"
/opt/slapos/bin/slapos node instance
--verbose
/opt/slapos/bin/slapos supply slaposwebrunner
${
computer_guid
}
_title
=
"SlapOS-WebRunner-In-
${
computer_guid
}
"
csih_inform
"Request slaposwebrunner instance as
${
_title
}
"
/opt/slapos/bin/slapos request
${
client_configure_file
}
\
${
_title
}
slaposwebrunner
--node
computer_guid
=
${
computer_guid
}
# -----------------------------------------------------------
# -----------------------------------------------------------
#
Send
report
#
Enter loop to release software, create instance,
report
# -----------------------------------------------------------
# -----------------------------------------------------------
echo
"Sending report ..."
_patch_file
=
/etc/slapos/patches/slapos-cookbook-inotifyx.patch
/opt/slapos/bin/slapos node report
--verbose
while
true
;
do
csih_inform
"Releasing software ..."
/opt/slapos/bin/slapos node software
--verbose
||
continue
if
[[
-r
${
_patch_file
}
]]
;
then
for
_x
in
$(
find /opt/slapgrid/
-name
slapos.cookbook-
*
.egg
)
;
do
patch
-d
${
_x
}
-f
--dry-run
-p1
<
${
_patch_file
}
>
/dev/null
&&
csih_inform
"Apply patch
${
_patch_file
}
on
${
_x
}
"
&&
patch
-d
${
_x
}
-p1
<
${
_patch_file
}
)
done
fi
csih_inform
"Creating instance ..."
/opt/slapos/bin/slapos node instance
--verbose
||
continue
csih_inform
"Sending report ..."
/opt/slapos/bin/slapos node report
--verbose
||
continue
get_slapos_webrunner_instance
${
computer_guid
}
${
_title
}
&&
break
done
echo
""
csih_inform
"Run slapos-node script successfully."
echo
""
echo
echo
"Run slapos-node script successfully."
echo
read
-n
1
-t
60
-p
"Press any key to exit..."
read
-n
1
-t
60
-p
"Press any key to exit..."
exit
0
exit
0
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