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
Ophélie Gagnard
slapos.package
Commits
c036a50f
Commit
c036a50f
authored
Jun 16, 2015
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial release of wendelin-standalone setup
Contributed by Kristopher Ruzic (kristopher.ruzic@nexedi.com)
parent
35824342
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
156 additions
and
26 deletions
+156
-26
playbook/install-script.yml
playbook/install-script.yml
+1
-0
playbook/roles/erp5-standalone/tasks/main.yml
playbook/roles/erp5-standalone/tasks/main.yml
+0
-3
playbook/roles/slapos-proxy/tasks/main.yml
playbook/roles/slapos-proxy/tasks/main.yml
+5
-2
playbook/roles/standalone-shared/files/erp5-show
playbook/roles/standalone-shared/files/erp5-show
+47
-21
playbook/roles/standalone-shared/tasks/main.yml
playbook/roles/standalone-shared/tasks/main.yml
+4
-0
playbook/roles/wendelin-standalone/files/request-wendelin
playbook/roles/wendelin-standalone/files/request-wendelin
+46
-0
playbook/roles/wendelin-standalone/files/wendelin-startup
playbook/roles/wendelin-standalone/files/wendelin-startup
+9
-0
playbook/roles/wendelin-standalone/meta/main.yml
playbook/roles/wendelin-standalone/meta/main.yml
+3
-0
playbook/roles/wendelin-standalone/tasks/main.yml
playbook/roles/wendelin-standalone/tasks/main.yml
+34
-0
playbook/wendelin-standalone.yml
playbook/wendelin-standalone.yml
+7
-0
No files found.
playbook/install-script.yml
View file @
c036a50f
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
-
{
role
:
"
install-script"
,
playbook_yml
:
"
re6stnet.yml"
,
script_path
:
"
install/re6st"
}
-
{
role
:
"
install-script"
,
playbook_yml
:
"
re6stnet.yml"
,
script_path
:
"
install/re6st"
}
-
{
role
:
"
install-script"
,
playbook_yml
:
"
vifib.yml"
,
script_path
:
"
install/vifib"
}
-
{
role
:
"
install-script"
,
playbook_yml
:
"
vifib.yml"
,
script_path
:
"
install/vifib"
}
-
{
role
:
"
install-script"
,
playbook_yml
:
"
erp5-standalone.yml"
,
script_path
:
"
install/erp5-standalone"
}
-
{
role
:
"
install-script"
,
playbook_yml
:
"
erp5-standalone.yml"
,
script_path
:
"
install/erp5-standalone"
}
-
{
role
:
"
install-script"
,
playbook_yml
:
"
wendelin-standalone.yml"
,
script_path
:
"
install/wendelin-standalone"
}
-
{
role
:
"
install-script"
,
playbook_yml
:
"
slapos-test-node.yml"
,
script_path
:
"
install/slapos-test-node"
}
-
{
role
:
"
install-script"
,
playbook_yml
:
"
slapos-test-node.yml"
,
script_path
:
"
install/slapos-test-node"
}
-
{
role
:
"
install-script"
,
playbook_yml
:
"
gnet-re6stnet.yml"
,
script_path
:
"
install/gnet/re6st"
}
-
{
role
:
"
install-script"
,
playbook_yml
:
"
gnet-re6stnet.yml"
,
script_path
:
"
install/gnet/re6st"
}
-
{
role
:
"
install-script"
,
playbook_yml
:
"
gnet-server.yml"
,
script_path
:
"
install/gnet/slapos"
}
-
{
role
:
"
install-script"
,
playbook_yml
:
"
gnet-server.yml"
,
script_path
:
"
install/gnet/slapos"
}
...
...
playbook/roles/erp5-standalone/tasks/main.yml
View file @
c036a50f
...
@@ -9,9 +9,6 @@
...
@@ -9,9 +9,6 @@
-
name
:
create partition script
-
name
:
create partition script
copy
:
src=request-erp5-cluster dest=/tmp/playbook-request-erp5-cluster mode=700
copy
:
src=request-erp5-cluster dest=/tmp/playbook-request-erp5-cluster mode=700
-
name
:
create erp5-show
copy
:
src=erp5-show dest=/usr/local/bin/erp5-show mode=755
-
name
:
Request ERP5 Cluster
-
name
:
Request ERP5 Cluster
shell
:
cat /tmp/playbook-request-erp5-cluster | slapos console
shell
:
cat /tmp/playbook-request-erp5-cluster | slapos console
...
...
playbook/roles/slapos-proxy/tasks/main.yml
View file @
c036a50f
...
@@ -19,5 +19,8 @@
...
@@ -19,5 +19,8 @@
wait_for
:
host=127.0.0.1 port=8080 delay=10
wait_for
:
host=127.0.0.1 port=8080 delay=10
-
name
:
Run slapos format for initial bootstrap
-
name
:
Run slapos format for initial bootstrap
s
ervice
:
"
slapos
node
format
--now
--alter_user=True"
s
hell
:
"
slapos
node
format
--now
--alter_user=True"
when
:
slapos_cfg.stat.exists == False
when
:
slapos_cfg.stat.exists == False
-
name
:
Set ownership for /opt/slapgrid
shell
:
"
chown
slapsoft:slapsoft
/opt/slapgrid"
playbook/roles/
erp5-standalone
/files/erp5-show
→
playbook/roles/
standalone-shared
/files/erp5-show
View file @
c036a50f
...
@@ -7,18 +7,25 @@ import glob
...
@@ -7,18 +7,25 @@ import glob
import
time
import
time
import
getopt
import
getopt
import
sqlite3
import
sqlite3
from
urllib2
import
urlopen
from
xml.dom
import
minidom
from
xml.dom
import
minidom
#from slapos.proxy.db_version import DB_VERSION
import
json
import
json
def
fmt_date
():
def
fmt_date
():
return
time
.
strftime
(
"%Y%m%d"
)
return
time
.
strftime
(
"%Y%m%d"
)
def
get_connection_information
():
# get all of the installed software types by checking the SR urls
# return a list, and run routine on all of them
def
discover_software
():
conn
=
sqlite3
.
connect
(
"/opt/slapos/slapproxy.db"
)
cur
=
conn
.
cursor
()
qry
=
cur
.
execute
(
"SELECT DISTINCT software_release FROM partition11"
)
return
[
row
[
0
]
for
row
in
qry
]
def
get_connection_information
(
software_release
):
conn
=
sqlite3
.
connect
(
"/opt/slapos/slapproxy.db"
)
conn
=
sqlite3
.
connect
(
"/opt/slapos/slapproxy.db"
)
cur
=
conn
.
cursor
()
cur
=
conn
.
cursor
()
qry
=
cur
.
execute
(
"SELECT connection_xml FROM partition11 WHERE connection_xml IS NOT NULL AND software_
type='create-erp5-site'"
)
qry
=
cur
.
execute
(
"SELECT connection_xml FROM partition11 WHERE connection_xml IS NOT NULL AND software_
release=?"
,
(
software_release
,)
)
for
row
in
qry
:
for
row
in
qry
:
xml
=
str
(
row
[
0
])
xml
=
str
(
row
[
0
])
break
break
...
@@ -27,21 +34,25 @@ def get_connection_information():
...
@@ -27,21 +34,25 @@ def get_connection_information():
try
:
try
:
el
=
instance
.
getElementsByTagName
(
'parameter'
)[
0
]
el
=
instance
.
getElementsByTagName
(
'parameter'
)[
0
]
value
=
el
.
childNodes
[
0
].
nodeValue
value
=
el
.
childNodes
[
0
].
nodeValue
except
:
return
"error"
if
not
value
.
startswith
(
"{"
):
value
=
"
\
"
"
+
value
+
"
\
"
"
json_text
=
json
.
loads
(
value
)
json_text
=
json
.
loads
(
value
)
if
'family-admin'
in
json_text
:
return
(
json_text
[
'family-admin'
],
json_text
[
'inituser-password'
])
return
(
json_text
[
'family-admin'
],
json_text
[
'inituser-password'
])
e
xcept
Exception
,
e
:
e
lif
'insecure'
in
json_text
:
print
e
return
(
json_text
,
None
)
print
"empty"
else
:
return
(
None
,
None
)
return
(
None
,
None
)
def
check_tables
():
def
check_tables
():
conn
=
sqlite3
.
connect
(
"/opt/slapos/slapproxy.db"
)
conn
=
sqlite3
.
connect
(
"/opt/slapos/slapproxy.db"
)
cur
=
conn
.
cursor
()
cur
=
conn
.
cursor
()
qry
=
cur
.
execut
(
"SELECT CASE WHEN tbl_name = 'partition11' THEN 1 ELSE 0 END FROM sqlite_master WHERE tbl_name = 'partition11' AND type = 'table'"
)
qry
=
cur
.
execut
e
(
"SELECT CASE WHEN tbl_name = 'partition11' THEN 1 ELSE 0 END FROM sqlite_master WHERE tbl_name = 'partition11' AND type = 'table'"
)
if
qry
:
if
qry
is
None
:
pass
else
:
print
"tables aren't ready yet, your build may have failed, check logs in /opt/slapos/log/"
print
"tables aren't ready yet, your build may have failed, check logs in /opt/slapos/log/"
sys
.
exit
(
0
)
sys
.
exit
(
0
)
...
@@ -54,7 +65,7 @@ def get_build_status():
...
@@ -54,7 +65,7 @@ def get_build_status():
if
"Finished software releases"
not
in
lines
[
-
1
]:
if
"Finished software releases"
not
in
lines
[
-
1
]:
return
False
return
False
if
"ERROR"
in
lines
[
-
3
]:
if
"ERROR"
in
lines
[
-
3
]:
return
"err"
return
"err
or
"
return
True
return
True
# Check if the last two lines show the software finished building.
# Check if the last two lines show the software finished building.
...
@@ -62,19 +73,29 @@ def get_build_status():
...
@@ -62,19 +73,29 @@ def get_build_status():
# Otherwise it passed and we can move on.
# Otherwise it passed and we can move on.
# We want to open today's log, as it is most up to date
# We want to open today's log, as it is most up to date
def
status
():
def
status
(
software_release
):
build
=
get_build_status
()
build
=
get_build_status
()
if
build
:
if
build
:
zope_ip
,
pw
=
get_connection_information
()
zope_ip
,
pw
=
get_connection_information
(
software_release
)
print
(
"Build successful, connect to:
\
n
"
print
(
"Build successful, connect to:
\
n
"
" "
+
zope_ip
+
" with
\
n
"
" "
+
zope_ip
)
if
pw
is
not
None
:
print
(
" with
\
n
"
" username: zope password: "
+
pw
)
" username: zope password: "
+
pw
)
elif
not
build
:
elif
not
build
:
print
"Your software is still building, be patient it can take awhile"
print
"Your software is still building, be patient it can take awhile"
elif
build
==
"err"
:
elif
build
==
"err
or
"
:
print
"An error occurred while building, check /opt/slapos/log/slapos-node-software-"
+
\
print
"An error occurred while building, check /opt/slapos/log/slapos-node-software-"
+
\
fmt_date
()
+
".log for details"
fmt_date
()
+
".log for details"
# check if the services are actually running (run slapos node and parse output)
if
pw
is
None
:
zope_ip
=
"https://"
+
zope_ip
[
zope_ip
.
index
(
"@"
)
+
1
:]
r1
=
urlopen
(
zope_ip
)
if
r1
.
getcode
()
!=
200
:
print
"At least one of your services isn't running! Check with slapos node"
print
"restart a service with slapos node restart slappart:service"
def
info
():
def
info
():
if
get_build_status
():
if
get_build_status
():
print
get_connection_information
()
print
get_connection_information
()
...
@@ -99,6 +120,9 @@ def main(argv):
...
@@ -99,6 +120,9 @@ def main(argv):
except
getopt
.
error
,
msg
:
except
getopt
.
error
,
msg
:
usage
()
usage
()
sys
.
exit
(
2
)
sys
.
exit
(
2
)
if
len
(
opts
)
==
0
:
usage
()
sys
.
exit
(
2
)
# process arguments
# process arguments
for
opt
,
arg
in
opts
:
for
opt
,
arg
in
opts
:
if
opt
in
(
"-h"
,
"--help"
):
if
opt
in
(
"-h"
,
"--help"
):
...
@@ -106,10 +130,12 @@ def main(argv):
...
@@ -106,10 +130,12 @@ def main(argv):
sys
.
exit
()
sys
.
exit
()
elif
opt
in
(
"-s"
,
"--status"
):
elif
opt
in
(
"-s"
,
"--status"
):
check_tables
()
check_tables
()
status
()
for
sr
in
discover_software
():
status
(
sr
)
elif
opt
in
(
"-i"
,
"--info"
):
elif
opt
in
(
"-i"
,
"--info"
):
check_tables
()
check_tables
()
info
()
for
sr
in
discover_software
():
info
(
sr
)
elif
opt
in
(
"-d"
,
"--dump"
):
elif
opt
in
(
"-d"
,
"--dump"
):
dump
()
dump
()
...
...
playbook/roles/standalone-shared/tasks/main.yml
0 → 100644
View file @
c036a50f
---
-
name
:
create erp5-show
copy
:
src=erp5-show dest=/usr/local/bin/erp5-show mode=755
playbook/roles/wendelin-standalone/files/request-wendelin
0 → 100644
View file @
c036a50f
import json
# copied from the request-erp5-cluster script, only changed the url to point to wendelin
software_url = 'https://lab.nexedi.cn/nexedi/slapos/raw/master/software/wendelin/software.cfg'
# Choose a SlapOS Node
# If you are deploying SlapOS Master with Webrunner, then computer_id is 'slaprunner'
computer_id = 'local_computer'
parameter_dict = {
"timezone": "UTC",
"site-id": "erp5",
"bt5": "erp5_full_text_myisam_catalog erp5_configurator_standard",
"zope-partition-dict": {
"admin": {
"family": "admin",
"thread-amount": 4,
"port-base": 2220,
"instance-count": 1
},
"activities-node": {
"family": "activities",
"thread-amount": 4,
"instance-count": 1,
"timerserver-interval": 1,
"port-base": 2230
},
"distribution-node": {
"family": "distribution",
"thread-amount": 1,
"instance-count": 1,
"port-base": 2210,
"timerserver-interval": 1
}
}
}
# Choose a title
title = "instance-of-wendelin"
request(software_url,
title,
filter_kw={'computer_guid': computer_id},
software_type='default',
partition_parameter_kw={
'_': json.dumps(parameter_dict, sort_keys=True, indent=2),
}
)
playbook/roles/wendelin-standalone/files/wendelin-startup
0 → 100644
View file @
c036a50f
#!/bin/bash
# Reruns the ansible playbook, does nothing else
PLAYBOOK_ROOT
=
/opt/slapos.playbook/
PLAYBOOK_FILE
=
wendelin-standalone.yml
cd
$PLAYBOOK_ROOT
# cd into the playbook directory
ansible-playbook
$PLAYBOOK_FILE
-i
hosts
--connection
=
local
playbook/roles/wendelin-standalone/meta/main.yml
0 → 100644
View file @
c036a50f
---
dependencies
:
-
slapos-proxy
playbook/roles/wendelin-standalone/tasks/main.yml
0 → 100644
View file @
c036a50f
---
-
name
:
Add ipv6 to lo interface
shell
:
ip -6 addr add 2001::1/64 dev lo
ignore_errors
:
True
-
name
:
Supply wendelin software release
shell
:
slapos supply https://lab.nexedi.cn/nexedi/slapos/raw/master/software/wendelin/software.cfg local_computer
-
name
:
create partition script
copy
:
src=request-wendelin dest=/tmp/playbook-request-wendelin mode=700
-
name
:
Request Wendelin instance
shell
:
cat /tmp/playbook-request-wendelin | slapos console
-
name
:
Add startup script
copy
:
src=wendelin-startup dest=/usr/local/bin/wendelin-startup mode=755
-
name
:
Add to rc.local
lineinfile
:
dest=/etc/rc.local insertbefore=BOF
line='bash /usr/local/bin/wendelin-startup &'
state=present
-
name
:
Get slapos.playbook directory name
shell
:
cd /tmp/tmpplaybookwendelin-standalone.*/slapos.playbook.git/playbook/; echo $(pwd)/
register
:
tmp_dir
-
name
:
Check if /opt/slapos.playbook already exists
stat
:
path=/opt/slapos.playbook/
register
:
playbook_state
-
name
:
Copy slapos.playbook
copy
:
src={{ tmp_dir.stdout }} dest=/opt/slapos.playbook/
when
:
playbook_state.stat.exists == False
playbook/wendelin-standalone.yml
0 → 100644
View file @
c036a50f
-
name
:
a play that runs entirely on the ansible host
hosts
:
127.0.0.1
connection
:
local
roles
:
-
wendelin-standalone
-
standalone-shared
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