Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos-caddy
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Guillaume Hervier
slapos-caddy
Commits
43653c40
Commit
43653c40
authored
May 26, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import some important instantiation recipes.
parent
ff17fae0
Changes
51
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
51 changed files
with
2862 additions
and
0 deletions
+2862
-0
slapos/erp5.recipe.testnode/CHANGES.txt
slapos/erp5.recipe.testnode/CHANGES.txt
+6
-0
slapos/erp5.recipe.testnode/MANIFEST.in
slapos/erp5.recipe.testnode/MANIFEST.in
+2
-0
slapos/erp5.recipe.testnode/README.txt
slapos/erp5.recipe.testnode/README.txt
+1
-0
slapos/erp5.recipe.testnode/setup.py
slapos/erp5.recipe.testnode/setup.py
+40
-0
slapos/erp5.recipe.testnode/src/erp5/__init__.py
slapos/erp5.recipe.testnode/src/erp5/__init__.py
+6
-0
slapos/erp5.recipe.testnode/src/erp5/recipe/__init__.py
slapos/erp5.recipe.testnode/src/erp5/recipe/__init__.py
+6
-0
slapos/erp5.recipe.testnode/src/erp5/recipe/testnode/SlapOSControler.py
...cipe.testnode/src/erp5/recipe/testnode/SlapOSControler.py
+90
-0
slapos/erp5.recipe.testnode/src/erp5/recipe/testnode/Updater.py
.../erp5.recipe.testnode/src/erp5/recipe/testnode/Updater.py
+189
-0
slapos/erp5.recipe.testnode/src/erp5/recipe/testnode/__init__.py
...erp5.recipe.testnode/src/erp5/recipe/testnode/__init__.py
+170
-0
slapos/erp5.recipe.testnode/src/erp5/recipe/testnode/template/slapos.cfg.in
....testnode/src/erp5/recipe/testnode/template/slapos.cfg.in
+10
-0
slapos/erp5.recipe.testnode/src/erp5/recipe/testnode/testnode.py
...erp5.recipe.testnode/src/erp5/recipe/testnode/testnode.py
+229
-0
slapos/slapos.recipe.erp5/CHANGES.txt
slapos/slapos.recipe.erp5/CHANGES.txt
+7
-0
slapos/slapos.recipe.erp5/MANIFEST.in
slapos/slapos.recipe.erp5/MANIFEST.in
+2
-0
slapos/slapos.recipe.erp5/README.txt
slapos/slapos.recipe.erp5/README.txt
+2
-0
slapos/slapos.recipe.erp5/setup.py
slapos/slapos.recipe.erp5/setup.py
+41
-0
slapos/slapos.recipe.erp5/src/slapos/__init__.py
slapos/slapos.recipe.erp5/src/slapos/__init__.py
+6
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/__init__.py
slapos/slapos.recipe.erp5/src/slapos/recipe/__init__.py
+6
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py
+912
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/apache.py
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/apache.py
+22
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/catdatefile.py
.../slapos.recipe.erp5/src/slapos/recipe/erp5/catdatefile.py
+14
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/certificate_authority.py
...cipe.erp5/src/slapos/recipe/erp5/certificate_authority.py
+112
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/erp5.py
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/erp5.py
+107
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/execute.py
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/execute.py
+48
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/innobackupex.py
...slapos.recipe.erp5/src/slapos/recipe/erp5/innobackupex.py
+25
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/killpidfromfile.py
...pos.recipe.erp5/src/slapos/recipe/erp5/killpidfromfile.py
+12
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py
+71
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/apache.location-snippet.conf.in
...apos/recipe/erp5/template/apache.location-snippet.conf.in
+5
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/apache.ssl-snippet.conf.in
...rc/slapos/recipe/erp5/template/apache.ssl-snippet.conf.in
+6
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/apache.zope.conf.in
....erp5/src/slapos/recipe/erp5/template/apache.zope.conf.in
+55
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/apache.zope.conf.path-protected.in
...s/recipe/erp5/template/apache.zope.conf.path-protected.in
+7
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/apache.zope.conf.path.in
.../src/slapos/recipe/erp5/template/apache.zope.conf.path.in
+5
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/cloudooo.cfg.in
...cipe.erp5/src/slapos/recipe/erp5/template/cloudooo.cfg.in
+54
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/haproxy.cfg.in
...ecipe.erp5/src/slapos/recipe/erp5/template/haproxy.cfg.in
+26
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/initmysql.sql.in
...ipe.erp5/src/slapos/recipe/erp5/template/initmysql.sql.in
+2
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/kumo_gateway.in
...cipe.erp5/src/slapos/recipe/erp5/template/kumo_gateway.in
+2
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/kumo_manager.in
...cipe.erp5/src/slapos/recipe/erp5/template/kumo_manager.in
+2
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/kumo_server.in
...ecipe.erp5/src/slapos/recipe/erp5/template/kumo_server.in
+2
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/logrotate_entry.in
...e.erp5/src/slapos/recipe/erp5/template/logrotate_entry.in
+13
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/memcached.in
....recipe.erp5/src/slapos/recipe/erp5/template/memcached.in
+2
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/my.cnf.in
...pos.recipe.erp5/src/slapos/recipe/erp5/template/my.cnf.in
+52
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/openssl.cnf.ca.in
...pe.erp5/src/slapos/recipe/erp5/template/openssl.cnf.ca.in
+350
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/tidstorage.py.in
...ipe.erp5/src/slapos/recipe/erp5/template/tidstorage.py.in
+15
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zeo.conf.in
...s.recipe.erp5/src/slapos/recipe/erp5/template/zeo.conf.in
+15
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zope-deadlockdebugger-snippet.conf.in
...ecipe/erp5/template/zope-deadlockdebugger-snippet.conf.in
+7
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zope-tidstorage-snippet.conf.in
...apos/recipe/erp5/template/zope-tidstorage-snippet.conf.in
+6
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zope-zeo-snippet.conf.in
.../src/slapos/recipe/erp5/template/zope-zeo-snippet.conf.in
+8
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zope-zodb-snippet.conf.in
...src/slapos/recipe/erp5/template/zope-zodb-snippet.conf.in
+6
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zope.conf.in
....recipe.erp5/src/slapos/recipe/erp5/template/zope.conf.in
+58
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zope.conf.timerservice.in
...src/slapos/recipe/erp5/template/zope.conf.timerservice.in
+6
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/test_suite_runner.py
...s.recipe.erp5/src/slapos/recipe/erp5/test_suite_runner.py
+11
-0
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/testrunner.py
...s/slapos.recipe.erp5/src/slapos/recipe/erp5/testrunner.py
+11
-0
No files found.
slapos/erp5.recipe.testnode/CHANGES.txt
0 → 100644
View file @
43653c40
Changelog
=========
1.0 (unreleased)
----------------
slapos/erp5.recipe.testnode/MANIFEST.in
0 → 100644
View file @
43653c40
include CHANGES.txt
recursive-include src/erp5/recipe/testnode *.in
slapos/erp5.recipe.testnode/README.txt
0 → 100644
View file @
43653c40
The erp5.recipe.tesnode aims to install generic erp5 testnode.
slapos/erp5.recipe.testnode/setup.py
0 → 100644
View file @
43653c40
from
setuptools
import
setup
,
find_packages
name
=
"erp5.recipe.testnode"
version
=
'1.0.23'
def
read
(
name
):
return
open
(
name
).
read
()
long_description
=
(
read
(
'README.txt'
)
+
'
\
n
'
+
read
(
'CHANGES.txt'
)
)
setup
(
name
=
name
,
version
=
version
,
description
=
"ZC Buildout recipe for create an testnode instance"
,
long_description
=
long_description
,
license
=
"GPLv3"
,
keywords
=
"buildout erp5 test"
,
classifiers
=
[
"Framework :: Buildout :: Recipe"
,
"Programming Language :: Python"
,
],
packages
=
find_packages
(
'src'
),
package_dir
=
{
''
:
'src'
},
include_package_data
=
True
,
install_requires
=
[
'setuptools'
,
'slapos.lib.recipe'
,
'xml_marshaller'
,
'zc.buildout'
,
'zc.recipe.egg'
,
# below are requirements to provide full blown python interpreter
'lxml'
,
'PyXML'
,
],
namespace_packages
=
[
'erp5'
,
'erp5.recipe'
],
entry_points
=
{
'zc.buildout'
:
[
'default = %s:Recipe'
%
name
]},
)
slapos/erp5.recipe.testnode/src/erp5/__init__.py
0 → 100644
View file @
43653c40
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
).
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
slapos/erp5.recipe.testnode/src/erp5/recipe/__init__.py
0 → 100644
View file @
43653c40
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
).
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
slapos/erp5.recipe.testnode/src/erp5/recipe/testnode/SlapOSControler.py
0 → 100644
View file @
43653c40
import
slapos.slap
,
subprocess
,
os
,
time
from
xml_marshaller
import
xml_marshaller
class
SlapOSControler
(
object
):
def
__init__
(
self
,
config
,
process_group_pid_set
=
None
):
self
.
config
=
config
# By erasing everything, we make sure that we are able to "update"
# existing profiles. This is quite dirty way to do updates...
if
os
.
path
.
exists
(
config
[
'proxy_database'
]):
os
.
unlink
(
config
[
'proxy_database'
])
proxy
=
subprocess
.
Popen
([
config
[
'slapproxy_binary'
],
config
[
'slapos_config'
]],
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
process_group_pid_set
.
add
(
proxy
.
pid
)
# XXX: dirty, giving some time for proxy to being able to accept
# connections
time
.
sleep
(
10
)
slap
=
slapos
.
slap
.
slap
()
slap
.
initializeConnection
(
config
[
'master_url'
])
# register software profile
self
.
software_profile
=
config
[
'custom_profile_path'
]
slap
.
registerSupply
().
supply
(
self
.
software_profile
,
computer_guid
=
config
[
'computer_id'
])
computer
=
slap
.
registerComputer
(
config
[
'computer_id'
])
# create partition and configure computer
partition_reference
=
config
[
'partition_reference'
]
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
partition_reference
)
if
not
os
.
path
.
exists
(
partition_path
):
os
.
mkdir
(
partition_path
)
os
.
chmod
(
partition_path
,
0750
)
computer
.
updateConfiguration
(
xml_marshaller
.
dumps
({
'address'
:
config
[
'ipv4_address'
],
'instance_root'
:
config
[
'instance_root'
],
'netmask'
:
'255.255.255.255'
,
'partition_list'
:
[{
'address_list'
:
[{
'addr'
:
config
[
'ipv4_address'
],
'netmask'
:
'255.255.255.255'
},
{
'addr'
:
config
[
'ipv6_address'
],
'netmask'
:
'ffff:ffff:ffff::'
},
],
'path'
:
partition_path
,
'reference'
:
partition_reference
,
'tap'
:
{
'name'
:
partition_reference
},
}
],
'reference'
:
config
[
'computer_id'
],
'software_root'
:
config
[
'software_root'
]}))
def
runSoftwareRelease
(
self
,
config
,
environment
,
process_group_pid_set
=
None
):
print
"SlapOSControler.runSoftwareRelease"
while
True
:
cpu_count
=
os
.
sysconf
(
"SC_NPROCESSORS_ONLN"
)
os
.
putenv
(
'MAKEFLAGS'
,
'-j%s'
%
cpu_count
)
os
.
environ
[
'PATH'
]
=
environment
[
'PATH'
]
stdout
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.runSoftwareRelease_out'
),
'w+'
)
stderr
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.runSoftwareRelease_err'
),
'w+'
)
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_software_binary'
],
'-v'
,
'-c'
,
#'--buildout-parameter',"'-U -N' -o",
config
[
'slapos_config'
]],
stdout
=
stdout
,
stderr
=
stderr
,
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
slapgrid
.
wait
()
stdout
.
seek
(
0
)
stderr
.
seek
(
0
)
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
status_dict
=
{
'status_code'
:
slapgrid
.
returncode
,
'stdout'
:
stdout
.
read
(),
'stderr'
:
stderr
.
read
()}
stdout
.
close
()
stderr
.
close
()
return
status_dict
def
runComputerPartition
(
self
,
config
,
process_group_pid_set
=
None
):
print
"SlapOSControler.runSoftwareRelease"
slap
=
slapos
.
slap
.
slap
()
slap
.
registerOpenOrder
().
request
(
self
.
software_profile
,
partition_reference
=
'testing partition'
,
partition_parameter_kw
=
config
[
'instance_dict'
])
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_partition_binary'
],
config
[
'slapos_config'
],
'-c'
,
'-v'
],
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
slapgrid
.
wait
()
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
if
slapgrid
.
returncode
!=
0
:
raise
ValueError
(
'Slapgrid instance failed'
)
slapos/erp5.recipe.testnode/src/erp5/recipe/testnode/Updater.py
0 → 100644
View file @
43653c40
import
os
,
sys
,
subprocess
,
re
,
threading
from
testnode
import
SubprocessError
_format_command_search
=
re
.
compile
(
"[[
\
\
s $({?*
\
\
`#~';<>&|]"
).
search
_format_command_escape
=
lambda
s
:
"'%s'"
%
r"'\''"
.
join
(
s
.
split
(
"'"
))
def
format_command
(
*
args
,
**
kw
):
cmdline
=
[]
for
k
,
v
in
sorted
(
kw
.
items
()):
if
_format_command_search
(
v
):
v
=
_format_command_escape
(
v
)
cmdline
.
append
(
'%s=%s'
%
(
k
,
v
))
for
v
in
args
:
if
_format_command_search
(
v
):
v
=
_format_command_escape
(
v
)
cmdline
.
append
(
v
)
return
' '
.
join
(
cmdline
)
def
subprocess_capture
(
p
,
quiet
=
False
):
def
readerthread
(
input
,
output
,
buffer
):
while
True
:
data
=
input
.
readline
()
if
not
data
:
break
output
(
data
)
buffer
.
append
(
data
)
if
p
.
stdout
:
stdout
=
[]
output
=
quiet
and
(
lambda
data
:
None
)
or
sys
.
stdout
.
write
stdout_thread
=
threading
.
Thread
(
target
=
readerthread
,
args
=
(
p
.
stdout
,
output
,
stdout
))
stdout_thread
.
setDaemon
(
True
)
stdout_thread
.
start
()
if
p
.
stderr
:
stderr
=
[]
stderr_thread
=
threading
.
Thread
(
target
=
readerthread
,
args
=
(
p
.
stderr
,
sys
.
stderr
.
write
,
stderr
))
stderr_thread
.
setDaemon
(
True
)
stderr_thread
.
start
()
if
p
.
stdout
:
stdout_thread
.
join
()
if
p
.
stderr
:
stderr_thread
.
join
()
p
.
wait
()
return
(
p
.
stdout
and
''
.
join
(
stdout
),
p
.
stderr
and
''
.
join
(
stderr
))
GIT_TYPE
=
'git'
SVN_TYPE
=
'svn'
class
Updater
(
object
):
_git_cache
=
{}
realtime_output
=
True
stdin
=
file
(
os
.
devnull
)
def
__init__
(
self
,
repository_path
,
revision
=
None
,
git_binary
=
None
):
self
.
revision
=
revision
self
.
_path_list
=
[]
self
.
repository_path
=
repository_path
self
.
git_binary
=
git_binary
def
getRepositoryPath
(
self
):
return
self
.
repository_path
def
getRepositoryType
(
self
):
try
:
return
self
.
repository_type
except
AttributeError
:
# guess the type of repository we have
if
os
.
path
.
isdir
(
os
.
path
.
join
(
self
.
getRepositoryPath
(),
'.git'
)):
repository_type
=
GIT_TYPE
elif
os
.
path
.
isdir
(
os
.
path
.
join
(
self
.
getRepositoryPath
(),
'.svn'
)):
repository_type
=
SVN_TYPE
else
:
raise
NotImplementedError
self
.
repository_type
=
repository_type
return
repository_type
def
deletePycFiles
(
self
,
path
):
"""Delete *.pyc files so that deleted/moved files can not be imported"""
for
path
,
dir_list
,
file_list
in
os
.
walk
(
path
):
for
file
in
file_list
:
if
file
[
-
4
:]
in
(
'.pyc'
,
'.pyo'
):
# allow several processes clean the same folder at the same time
try
:
os
.
remove
(
os
.
path
.
join
(
path
,
file
))
except
OSError
,
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
def
spawn
(
self
,
*
args
,
**
kw
):
quiet
=
kw
.
pop
(
'quiet'
,
False
)
env
=
kw
and
dict
(
os
.
environ
,
**
kw
)
or
None
command
=
format_command
(
*
args
,
**
kw
)
print
'
\
n
$ '
+
command
sys
.
stdout
.
flush
()
p
=
subprocess
.
Popen
(
args
,
stdin
=
self
.
stdin
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
env
=
env
,
cwd
=
self
.
getRepositoryPath
())
if
self
.
realtime_output
:
stdout
,
stderr
=
subprocess_capture
(
p
,
quiet
)
else
:
stdout
,
stderr
=
p
.
communicate
()
if
not
quiet
:
sys
.
stdout
.
write
(
stdout
)
sys
.
stderr
.
write
(
stderr
)
result
=
dict
(
status_code
=
p
.
returncode
,
command
=
command
,
stdout
=
stdout
,
stderr
=
stderr
)
if
p
.
returncode
:
raise
SubprocessError
(
result
)
return
result
def
_git
(
self
,
*
args
,
**
kw
):
return
self
.
spawn
(
self
.
git_binary
,
*
args
,
**
kw
)[
'stdout'
].
strip
()
def
_git_find_rev
(
self
,
ref
):
try
:
return
self
.
_git_cache
[
ref
]
except
KeyError
:
if
os
.
path
.
exists
(
'.git/svn'
):
r
=
self
.
_git
(
'svn'
,
'find-rev'
,
ref
)
assert
r
self
.
_git_cache
[
ref
[
0
]
!=
'r'
and
'r%u'
%
int
(
r
)
or
r
]
=
ref
else
:
r
=
self
.
_git
(
'rev-list'
,
'--topo-order'
,
'--count'
,
ref
),
ref
self
.
_git_cache
[
ref
]
=
r
return
r
def
getRevision
(
self
,
*
path_list
):
if
not
path_list
:
path_list
=
self
.
_path_list
if
self
.
getRepositoryType
()
==
GIT_TYPE
:
h
=
self
.
_git
(
'log'
,
'-1'
,
'--format=%H'
,
'--'
,
*
path_list
)
return
self
.
_git_find_rev
(
h
)
elif
self
.
getRepositoryType
()
==
SVN_TYPE
:
stdout
=
self
.
spawn
(
'svn'
,
'info'
,
*
path_list
)[
'stdout'
]
return
str
(
max
(
map
(
int
,
SVN_CHANGED_REV
.
findall
(
stdout
))))
raise
NotImplementedError
def
checkout
(
self
,
*
path_list
):
if
not
path_list
:
path_list
=
'.'
,
revision
=
self
.
revision
if
self
.
getRepositoryType
()
==
GIT_TYPE
:
# edit .git/info/sparse-checkout if you want sparse checkout
if
revision
:
if
type
(
revision
)
is
str
:
h
=
self
.
_git_find_rev
(
'r'
+
revision
)
else
:
h
=
revision
[
1
]
if
h
!=
self
.
_git
(
'rev-parse'
,
'HEAD'
):
self
.
deletePycFiles
(
'.'
)
self
.
_git
(
'reset'
,
'--merge'
,
h
)
else
:
self
.
deletePycFiles
(
'.'
)
if
os
.
path
.
exists
(
'.git/svn'
):
self
.
_git
(
'svn'
,
'rebase'
)
else
:
self
.
_git
(
'pull'
,
'--ff-only'
)
self
.
revision
=
self
.
_git_find_rev
(
self
.
_git
(
'rev-parse'
,
'HEAD'
))
elif
self
.
getRepositoryType
()
==
SVN_TYPE
:
# following code allows sparse checkout
def
svn_mkdirs
(
path
):
path
=
os
.
path
.
dirname
(
path
)
if
path
and
not
os
.
path
.
isdir
(
path
):
svn_mkdirs
(
path
)
self
.
spawn
(
*
(
args
+
[
'--depth=empty'
,
path
]))
for
path
in
path_list
:
args
=
[
'svn'
,
'up'
,
'--force'
,
'--non-interactive'
]
if
revision
:
args
.
append
(
'-r%s'
%
revision
)
svn_mkdirs
(
path
)
args
+=
'--set-depth=infinity'
,
path
self
.
deletePycFiles
(
path
)
try
:
status_dict
=
self
.
spawn
(
*
args
)
except
SubprocessError
,
e
:
if
'cleanup'
not
in
e
.
stderr
:
raise
self
.
spawn
(
'svn'
,
'cleanup'
,
path
)
status_dict
=
self
.
spawn
(
*
args
)
if
not
revision
:
self
.
revision
=
revision
=
SVN_UP_REV
.
findall
(
status_dict
[
'stdout'
].
splitlines
()[
-
1
])[
0
]
else
:
raise
NotImplementedError
self
.
_path_list
+=
path_list
slapos/erp5.recipe.testnode/src/erp5/recipe/testnode/__init__.py
0 → 100644
View file @
43653c40
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
slapos.lib.recipe.BaseSlapRecipe
import
BaseSlapRecipe
import
os
import
pkg_resources
import
zc.buildout
import
zc.recipe.egg
import
sys
CONFIG
=
dict
(
proxy_port
=
'5000'
,
computer_id
=
'COMPUTER'
,
partition_reference
=
'test0'
,
)
class
Recipe
(
BaseSlapRecipe
):
def
__init__
(
self
,
buildout
,
name
,
options
):
self
.
egg
=
zc
.
recipe
.
egg
.
Egg
(
buildout
,
options
[
'recipe'
],
options
)
BaseSlapRecipe
.
__init__
(
self
,
buildout
,
name
,
options
)
def
installSlapOs
(
self
):
CONFIG
[
'slapos_directory'
]
=
self
.
createDataDirectory
(
'slapos'
)
CONFIG
[
'working_directory'
]
=
self
.
createDataDirectory
(
'testnode'
)
CONFIG
[
'software_root'
]
=
os
.
path
.
join
(
CONFIG
[
'slapos_directory'
],
'software'
)
CONFIG
[
'instance_root'
]
=
os
.
path
.
join
(
CONFIG
[
'slapos_directory'
],
'instance'
)
CONFIG
[
'proxy_database'
]
=
os
.
path
.
join
(
CONFIG
[
'slapos_directory'
],
'proxy.db'
)
CONFIG
[
'proxy_host'
]
=
self
.
getLocalIPv4Address
()
CONFIG
[
'master_url'
]
=
'http://%s:%s'
%
(
CONFIG
[
'proxy_host'
],
CONFIG
[
'proxy_port'
])
self
.
_createDirectory
(
CONFIG
[
'software_root'
])
self
.
_createDirectory
(
CONFIG
[
'instance_root'
])
CONFIG
[
'slapos_config'
]
=
self
.
createConfigurationFile
(
'slapos.cfg'
,
self
.
substituteTemplate
(
pkg_resources
.
resource_filename
(
__name__
,
'template/slapos.cfg.in'
),
CONFIG
))
self
.
path_list
.
append
(
CONFIG
[
'slapos_config'
])
def
setupRunningWrapper
(
self
):
self
.
path_list
.
extend
(
zc
.
buildout
.
easy_install
.
scripts
([(
'testnode'
,
__name__
+
'.testnode'
,
'run'
)],
self
.
ws
,
sys
.
executable
,
self
.
wrapper_directory
,
arguments
=
[
dict
(
computer_id
=
CONFIG
[
'computer_id'
],
instance_dict
=
eval
(
self
.
parameter_dict
.
get
(
'instance_dict'
,
'{}'
)),
instance_root
=
CONFIG
[
'instance_root'
],
ipv4_address
=
self
.
getLocalIPv4Address
(),
ipv6_address
=
self
.
getGlobalIPv6Address
(),
master_url
=
CONFIG
[
'master_url'
],
profile_path
=
self
.
parameter_dict
[
'profile_path'
],
proxy_database
=
CONFIG
[
'proxy_database'
],
proxy_port
=
CONFIG
[
'proxy_port'
],
slapgrid_partition_binary
=
self
.
options
[
'slapgrid_partition_binary'
],
slapgrid_software_binary
=
self
.
options
[
'slapgrid_software_binary'
],
slapos_config
=
CONFIG
[
'slapos_config'
],
slapproxy_binary
=
self
.
options
[
'slapproxy_binary'
],
git_binary
=
self
.
options
[
'git_binary'
],
software_root
=
CONFIG
[
'software_root'
],
working_directory
=
CONFIG
[
'working_directory'
],
vcs_repository
=
self
.
parameter_dict
.
get
(
'vcs_repository'
),
node_quantity
=
self
.
parameter_dict
.
get
(
'node_quantity'
,
'1'
),
branch
=
self
.
parameter_dict
.
get
(
'branch'
,
None
),
test_suite_master_url
=
self
.
parameter_dict
.
get
(
'test_suite_master_url'
,
None
),
test_suite_name
=
self
.
parameter_dict
.
get
(
'test_suite_name'
),
test_suite_title
=
self
.
parameter_dict
.
get
(
'test_suite_title'
),
bin_directory
=
self
.
bin_directory
,
foo
=
'bar'
,
# botenvironemnt is splittable string of key=value to substitute
# environment of running bot
bot_environment
=
self
.
parameter_dict
.
get
(
'bot_environment'
,
''
),
partition_reference
=
CONFIG
[
'partition_reference'
],
environment
=
dict
(
PATH
=
os
.
environ
[
'PATH'
]),
)
]))
def
installLocalSvn
(
self
):
svn_dict
=
dict
(
svn_binary
=
self
.
options
[
'svn_binary'
])
svn_dict
.
update
(
self
.
parameter_dict
)
self
.
_writeExecutable
(
os
.
path
.
join
(
self
.
bin_directory
,
'svn'
),
"""
\
#!/bin/sh
%(svn_binary)s --username %(svn_username)s --password %(svn_password)s
\
--non-interactive --trust-server-cert --no-auth-cache "$@" """
%
svn_dict
)
svnversion
=
os
.
path
.
join
(
self
.
bin_directory
,
'svnversion'
)
if
os
.
path
.
lexists
(
svnversion
):
os
.
unlink
(
svnversion
)
os
.
symlink
(
self
.
options
[
'svnversion_binary'
],
svnversion
)
def
installLocalGit
(
self
):
git_dict
=
dict
(
git_binary
=
self
.
options
[
'git_binary'
])
git_dict
.
update
(
self
.
parameter_dict
)
double_slash_end_position
=
1
# XXX, this should be provided by slapos
print
"bin_directory : %r"
%
self
.
bin_directory
home_directory
=
os
.
path
.
join
(
*
os
.
path
.
split
(
self
.
bin_directory
)[
0
:
-
1
])
print
"home_directory : %r"
%
home_directory
git_dict
.
setdefault
(
"git_server_name"
,
"git.erp5.org"
)
if
git_dict
.
get
(
'vcs_username'
,
None
)
is
not
None
:
netrc_file
=
open
(
os
.
path
.
join
(
home_directory
,
'.netrc'
),
'w'
)
netrc_file
.
write
(
"""
machine %(git_server_name)s
login %(vcs_username)s
password %(vcs_password)s"""
%
git_dict
)
netrc_file
.
close
()
def
installLocalRepository
(
self
):
if
self
.
parameter_dict
.
get
(
'vcs_repository'
).
endswith
(
'git'
):
self
.
installLocalGit
()
else
:
self
.
installLocalSvn
()
def
installLocalZip
(
self
):
zip
=
os
.
path
.
join
(
self
.
bin_directory
,
'zip'
)
if
os
.
path
.
lexists
(
zip
):
os
.
unlink
(
zip
)
os
.
symlink
(
self
.
options
[
'zip_binary'
],
zip
)
def
installLocalPython
(
self
):
"""Installs local python fully featured with eggs"""
self
.
path_list
.
extend
(
zc
.
buildout
.
easy_install
.
scripts
([],
self
.
ws
,
sys
.
executable
,
self
.
bin_directory
,
scripts
=
None
,
interpreter
=
'python'
))
def
installLocalRunUnitTest
(
self
):
link
=
os
.
path
.
join
(
self
.
bin_directory
,
'runUnitTest'
)
destination
=
os
.
path
.
join
(
CONFIG
[
'instance_root'
],
CONFIG
[
'partition_reference'
],
'bin'
,
'runUnitTest'
)
if
os
.
path
.
lexists
(
link
):
if
not
os
.
readlink
(
link
)
!=
destination
:
os
.
unlink
(
link
)
if
not
os
.
path
.
lexists
(
link
):
os
.
symlink
(
destination
,
link
)
def
_install
(
self
):
self
.
requirements
,
self
.
ws
=
self
.
egg
.
working_set
([
__name__
])
self
.
path_list
=
[]
self
.
installSlapOs
()
self
.
setupRunningWrapper
()
self
.
installLocalRepository
()
self
.
installLocalZip
()
self
.
installLocalPython
()
self
.
installLocalRunUnitTest
()
return
self
.
path_list
slapos/erp5.recipe.testnode/src/erp5/recipe/testnode/template/slapos.cfg.in
0 → 100644
View file @
43653c40
[slapos]
software_root = %(software_root)s
instance_root = %(instance_root)s
master_url = %(master_url)s
computer_id = %(computer_id)s
[slapproxy]
host = %(proxy_host)s
port = %(proxy_port)s
database_uri = %(proxy_database)s
slapos/erp5.recipe.testnode/src/erp5/recipe/testnode/testnode.py
0 → 100644
View file @
43653c40
from
xml_marshaller
import
xml_marshaller
import
os
,
xmlrpclib
,
time
,
imp
from
glob
import
glob
import
signal
import
slapos.slap
import
subprocess
import
sys
import
socket
import
pprint
from
SlapOSControler
import
SlapOSControler
class
SubprocessError
(
EnvironmentError
):
def
__init__
(
self
,
status_dict
):
self
.
status_dict
=
status_dict
def
__getattr__
(
self
,
name
):
return
self
.
status_dict
[
name
]
def
__str__
(
self
):
return
'Error %i'
%
self
.
status_code
from
Updater
import
Updater
process_group_pid_set
=
set
()
process_pid_file_list
=
[]
process_command_list
=
[]
def
sigterm_handler
(
signal
,
frame
):
for
pgpid
in
process_group_pid_set
:
try
:
os
.
killpg
(
pgpid
,
signal
.
SIGTERM
)
except
:
pass
for
pid_file
in
process_pid_file_list
:
try
:
os
.
kill
(
int
(
open
(
pid_file
).
read
().
strip
()),
signal
.
SIGTERM
)
except
:
pass
for
p
in
process_command_list
:
try
:
subprocess
.
call
(
p
)
except
:
pass
sys
.
exit
(
1
)
signal
.
signal
(
signal
.
SIGTERM
,
sigterm_handler
)
def
safeRpcCall
(
function
,
*
args
):
retry
=
64
while
True
:
try
:
return
function
(
*
args
)
except
(
socket
.
error
,
xmlrpclib
.
ProtocolError
),
e
:
print
>>
sys
.
stderr
,
e
pprint
.
pprint
(
args
,
file
(
function
.
_Method__name
,
'w'
))
time
.
sleep
(
retry
)
retry
+=
retry
>>
1
slapos_controler
=
None
def
run
(
args
):
config
=
args
[
0
]
slapgrid
=
None
branch
=
config
.
get
(
'branch'
,
None
)
supervisord_pid_file
=
os
.
path
.
join
(
config
[
'instance_root'
],
'var'
,
'run'
,
'supervisord.pid'
)
subprocess
.
check_call
([
config
[
'git_binary'
],
"config"
,
"--global"
,
"http.sslVerify"
,
"false"
])
previous_revision
=
None
run_software
=
True
# find what will be the path of the repository
repository_name
=
config
[
'vcs_repository'
].
split
(
'/'
)[
-
1
].
split
(
'.'
)[
0
]
repository_path
=
os
.
path
.
join
(
config
[
'working_directory'
],
repository_name
)
config
[
'repository_path'
]
=
repository_path
sys
.
path
.
append
(
repository_path
)
# Write our own software.cfg to use the local repository
custom_profile_path
=
os
.
path
.
join
(
config
[
'working_directory'
],
'software.cfg'
)
config
[
'custom_profile_path'
]
=
custom_profile_path
# create a profile in order to use the repository we already have
custom_profile
=
open
(
custom_profile_path
,
'w'
)
profile_content
=
"""
[buildout]
extends = %(software_config_path)s
[%(repository_name)s]
repository = %(repository_path)s
"""
%
{
'software_config_path'
:
os
.
path
.
join
(
repository_path
,
config
[
'profile_path'
]),
'repository_name'
:
repository_name
,
'repository_path'
:
repository_path
}
if
branch
is
not
None
:
profile_content
+=
"
\
n
branch = %s"
%
branch
custom_profile
.
write
(
profile_content
)
custom_profile
.
close
()
retry_software
=
False
try
:
while
True
:
# kill processes from previous loop if any
try
:
for
pgpid
in
process_group_pid_set
:
try
:
os
.
killpg
(
pgpid
,
signal
.
SIGTERM
)
except
:
pass
process_group_pid_set
.
clear
()
# Make sure we have local repository
if
not
os
.
path
.
exists
(
repository_path
):
parameter_list
=
[
config
[
'git_binary'
],
'clone'
,
config
[
'vcs_repository'
]]
if
branch
is
not
None
:
parameter_list
.
extend
([
'-b'
,
branch
])
parameter_list
.
append
(
repository_path
)
subprocess
.
check_call
(
parameter_list
)
# XXX this looks like to not wait the end of the command
# Make sure we have local repository
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
])
updater
.
checkout
()
revision
=
updater
.
getRevision
()
if
previous_revision
==
revision
:
time
.
sleep
(
120
)
if
not
(
retry_software
):
continue
retry_software
=
False
previous_revision
=
revision
print
config
portal_url
=
config
[
'test_suite_master_url'
]
test_result_path
=
None
test_result
=
(
test_result_path
,
revision
)
if
portal_url
:
if
portal_url
[
-
1
]
!=
'/'
:
portal_url
+=
'/'
portal
=
xmlrpclib
.
ServerProxy
(
"%s%s"
%
(
portal_url
,
'portal_task_distribution'
),
allow_none
=
1
)
master
=
portal
.
portal_task_distribution
assert
master
.
getProtocolRevision
()
==
1
test_result
=
safeRpcCall
(
master
.
createTestResult
,
config
[
'test_suite_name'
],
revision
,
[],
False
,
config
[
'test_suite_title'
])
print
"testnode, test_result : %r"
%
(
test_result
,)
if
test_result
:
test_result_path
,
test_revision
=
test_result
if
revision
!=
test_revision
:
# other testnodes on other boxes are already ready to test another
# revision
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
revision
=
test_revision
)
updater
.
checkout
()
# Now prepare the installation of SlapOS
slapos_controler
=
SlapOSControler
(
config
,
process_group_pid_set
=
process_group_pid_set
)
# this should be always true later, but it is too slow for now
status_dict
=
slapos_controler
.
runSoftwareRelease
(
config
,
environment
=
config
[
'environment'
],
process_group_pid_set
=
process_group_pid_set
,
)
if
status_dict
[
'status_code'
]
!=
0
:
safeRpcCall
(
master
.
reportTaskFailure
,
test_result_path
,
status_dict
,
config
[
'test_suite_title'
])
retry_software
=
True
continue
# create instances, it should take some seconds only
slapos_controler
.
runComputerPartition
(
config
,
process_group_pid_set
=
process_group_pid_set
)
# update repositories downloaded by buildout. Later we should get
# from master a list of repositories
repository_path_list
=
glob
(
os
.
path
.
join
(
config
[
'software_root'
],
'*'
,
'parts'
,
'git_repository'
,
'*'
))
assert
len
(
repository_path_list
)
>=
0
for
repository_path
in
repository_path_list
:
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
])
updater
.
checkout
()
if
os
.
path
.
split
(
repository_path
)[
-
1
]
==
repository_name
:
# redo checkout with good revision, the previous one is used
# to pull last code
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
revision
=
revision
)
updater
.
checkout
()
# calling dist/externals is only there for backward compatibility,
# the code will be removed soon
if
os
.
path
.
exists
(
os
.
path
.
join
(
repository_path
,
'dist/externals.py'
)):
process
=
subprocess
.
Popen
([
'dist/externals.py'
],
cwd
=
repository_path
)
process
.
wait
()
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
config
[
'partition_reference'
])
run_test_suite_path
=
os
.
path
.
join
(
partition_path
,
'bin'
,
'runTestSuite'
)
if
not
os
.
path
.
exists
(
run_test_suite_path
):
raise
ValueError
(
'No %r provided'
%
run_test_suite_path
)
run_test_suite_revision
=
revision
if
isinstance
(
revision
,
tuple
):
revision
=
','
.
join
(
revision
)
run_test_suite
=
subprocess
.
Popen
([
run_test_suite_path
,
'--test_suite'
,
config
[
'test_suite_name'
],
'--revision'
,
revision
,
'--node_quantity'
,
config
[
'node_quantity'
],
'--master_url'
,
config
[
'test_suite_master_url'
],
],
)
process_group_pid_set
.
add
(
run_test_suite
.
pid
)
run_test_suite
.
wait
()
process_group_pid_set
.
remove
(
run_test_suite
.
pid
)
except
SubprocessError
:
time
.
sleep
(
120
)
continue
finally
:
# Nice way to kill *everything* generated by run process -- process
# groups working only in POSIX compilant systems
# Exceptions are swallowed during cleanup phase
print
"going to kill %r"
%
(
process_group_pid_set
,)
for
pgpid
in
process_group_pid_set
:
try
:
os
.
killpg
(
pgpid
,
signal
.
SIGTERM
)
except
:
pass
try
:
if
os
.
path
.
exists
(
supervisord_pid_file
):
os
.
kill
(
int
(
open
(
supervisord_pid_file
).
read
().
strip
()),
signal
.
SIGTERM
)
except
:
pass
slapos/slapos.recipe.erp5/CHANGES.txt
0 → 100644
View file @
43653c40
Changelog
=========
1.1 (unreleased)
----------------
* backup enabled for Certificate Authority [Łukasz Nowak]
slapos/slapos.recipe.erp5/MANIFEST.in
0 → 100644
View file @
43653c40
include CHANGES.txt
recursive-include src/slapos/recipe/erp5 *.in
slapos/slapos.recipe.erp5/README.txt
0 → 100644
View file @
43653c40
The slapos.recipe.erp5 aims to instanciate an ERP5 environnment
===============================================================
slapos/slapos.recipe.erp5/setup.py
0 → 100644
View file @
43653c40
from
setuptools
import
setup
,
find_packages
#def getGitIteration():
# import subprocess
# return str(int(subprocess.Popen(["git", "rev-list", "--count", "HEAD", "--",
# "."], stdout=subprocess.PIPE).communicate()[0]))
name
=
"slapos.recipe.erp5"
version
=
'1.1-dev-184'
def
read
(
name
):
return
open
(
name
).
read
()
long_description
=
(
read
(
'README.txt'
)
+
'
\
n
'
+
read
(
'CHANGES.txt'
)
)
setup
(
name
=
name
,
version
=
version
,
description
=
"ZC Buildout recipe for create an erp5 instance"
,
long_description
=
long_description
,
license
=
"GPLv3"
,
keywords
=
"buildout slapos erp5"
,
classifiers
=
[
"Framework :: Buildout :: Recipe"
,
"Programming Language :: Python"
,
],
packages
=
find_packages
(
'src'
),
package_dir
=
{
''
:
'src'
},
include_package_data
=
True
,
install_requires
=
[
'zc.recipe.egg'
,
'setuptools'
,
'slapos.lib.recipe'
,
'Zope2'
,
],
namespace_packages
=
[
'slapos'
,
'slapos.recipe'
],
entry_points
=
{
'zc.buildout'
:
[
'default = %s:Recipe'
%
name
]},
)
slapos/slapos.recipe.erp5/src/slapos/__init__.py
0 → 100644
View file @
43653c40
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
).
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
slapos/slapos.recipe.erp5/src/slapos/recipe/__init__.py
0 → 100644
View file @
43653c40
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
).
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py
0 → 100644
View file @
43653c40
This diff is collapsed.
Click to expand it.
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/apache.py
0 → 100644
View file @
43653c40
import
os
import
sys
import
time
def
runApache
(
args
):
sleep
=
60
conf
=
args
[
0
]
while
True
:
ready
=
True
for
f
in
conf
.
get
(
'required_path_list'
,
[]):
if
not
os
.
path
.
exists
(
f
):
print
'File %r does not exists, sleeping for %s'
%
(
f
,
sleep
)
ready
=
False
if
ready
:
break
time
.
sleep
(
sleep
)
apache_wrapper_list
=
[
conf
[
'binary'
],
'-f'
,
conf
[
'config'
],
'-DFOREGROUND'
]
apache_wrapper_list
.
extend
(
sys
.
argv
[
1
:])
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
os
.
execl
(
apache_wrapper_list
[
0
],
*
apache_wrapper_list
)
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/catdatefile.py
0 → 100644
View file @
43653c40
import
os
import
sys
import
time
def
catdatefile
(
args
):
directory
=
args
[
0
]
try
:
suffix
=
args
[
1
]
except
IndexError
:
suffix
=
'.log'
f
=
open
(
os
.
path
.
join
(
directory
,
time
.
strftime
(
'%Y-%m-%d.%H:%M.%s'
)
+
suffix
),
'aw'
)
for
line
in
sys
.
stdin
.
read
():
f
.
write
(
line
)
f
.
close
()
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/certificate_authority.py
0 → 100644
View file @
43653c40
import
os
import
subprocess
import
time
import
ConfigParser
def
popenCommunicate
(
command_list
,
input
=
None
):
subprocess_kw
=
dict
(
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
if
input
is
not
None
:
subprocess_kw
.
update
(
stdin
=
subprocess
.
PIPE
)
popen
=
subprocess
.
Popen
(
command_list
,
**
subprocess_kw
)
result
=
popen
.
communicate
(
input
)[
0
]
if
popen
.
returncode
is
None
:
popen
.
kill
()
if
popen
.
returncode
!=
0
:
raise
ValueError
(
'Issue during calling %r, result was:
\
n
%s'
%
(
command_list
,
result
))
return
result
class
CertificateAuthority
:
def
__init__
(
self
,
key
,
certificate
,
openssl_binary
,
openssl_configuration
,
request_dir
):
self
.
key
=
key
self
.
certificate
=
certificate
self
.
openssl_binary
=
openssl_binary
self
.
openssl_configuration
=
openssl_configuration
self
.
request_dir
=
request_dir
def
checkAuthority
(
self
):
file_list
=
[
self
.
key
,
self
.
certificate
]
ca_ready
=
True
for
f
in
file_list
:
if
not
os
.
path
.
exists
(
f
):
ca_ready
=
False
break
if
ca_ready
:
return
for
f
in
file_list
:
if
os
.
path
.
exists
(
f
):
os
.
unlink
(
f
)
try
:
# no CA, let us create new one
popenCommunicate
([
self
.
openssl_binary
,
'req'
,
'-nodes'
,
'-config'
,
self
.
openssl_configuration
,
'-new'
,
'-x509'
,
'-extensions'
,
'v3_ca'
,
'-keyout'
,
self
.
key
,
'-out'
,
self
.
certificate
,
'-days'
,
'10950'
],
'Automatic Certificate Authority
\
n
'
)
except
:
try
:
for
f
in
file_list
:
if
os
.
path
.
exists
(
f
):
os
.
unlink
(
f
)
except
:
# do not raise during cleanup
pass
raise
def
_checkCertificate
(
self
,
common_name
,
key
,
certificate
):
file_list
=
[
key
,
certificate
]
ready
=
True
for
f
in
file_list
:
if
not
os
.
path
.
exists
(
f
):
ready
=
False
break
if
ready
:
return
False
for
f
in
file_list
:
if
os
.
path
.
exists
(
f
):
os
.
unlink
(
f
)
csr
=
certificate
+
'.csr'
try
:
popenCommunicate
([
self
.
openssl_binary
,
'req'
,
'-config'
,
self
.
openssl_configuration
,
'-nodes'
,
'-new'
,
'-keyout'
,
key
,
'-out'
,
csr
,
'-days'
,
'3650'
],
common_name
+
'
\
n
'
)
try
:
popenCommunicate
([
self
.
openssl_binary
,
'ca'
,
'-batch'
,
'-config'
,
self
.
openssl_configuration
,
'-out'
,
certificate
,
'-infiles'
,
csr
])
finally
:
if
os
.
path
.
exists
(
csr
):
os
.
unlink
(
csr
)
except
:
try
:
for
f
in
file_list
:
if
os
.
path
.
exists
(
f
):
os
.
unlink
(
f
)
except
:
# do not raise during cleanup
pass
raise
else
:
return
True
def
checkRequestDir
(
self
):
for
request_file
in
os
.
listdir
(
self
.
request_dir
):
parser
=
ConfigParser
.
RawConfigParser
()
parser
.
readfp
(
open
(
os
.
path
.
join
(
self
.
request_dir
,
request_file
),
'r'
))
if
self
.
_checkCertificate
(
parser
.
get
(
'certificate'
,
'name'
),
parser
.
get
(
'certificate'
,
'key_file'
),
parser
.
get
(
'certificate'
,
'certificate_file'
)):
print
'Created certificate %r'
%
parser
.
get
(
'certificate'
,
'name'
)
def
runCertificateAuthority
(
args
):
ca_conf
=
args
[
0
]
ca
=
CertificateAuthority
(
ca_conf
[
'key'
],
ca_conf
[
'certificate'
],
ca_conf
[
'openssl_binary'
],
ca_conf
[
'openssl_configuration'
],
ca_conf
[
'request_dir'
])
while
True
:
ca
.
checkAuthority
()
ca
.
checkRequestDir
()
time
.
sleep
(
60
)
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/erp5.py
0 → 100644
View file @
43653c40
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
time
import
urllib
import
xmlrpclib
import
socket
def
updateERP5
(
args
):
# FIXME Use a dict
site_id
=
args
[
0
]
mysql_string
=
args
[
1
]
base_url
=
args
[
2
]
memcached_provider
=
args
[
3
]
conversion_server
=
args
[
4
]
kumo_provider
=
args
[
5
]
bt5_list
=
args
[
6
]
bt5_repository_list
=
[]
if
len
(
args
)
>
7
:
bt5_repository_list
=
args
[
7
]
if
len
(
bt5_list
)
>
0
and
len
(
bt5_repository_list
)
==
0
:
bt5_repository_list
=
[
"http://www.erp5.org/dists/snapshot/bt5"
]
erp5_catalog_storage
=
"erp5_mysql_innodb_catalog"
business_template_setup_finished
=
0
external_service_assertion
=
1
update_script_id
=
"ERP5Site_assertExternalServiceList"
sleep
=
120
while
True
:
try
:
proxy
=
xmlrpclib
.
ServerProxy
(
base_url
)
print
"Adding site at %r"
%
base_url
if
proxy
.
isERP5SitePresent
()
==
False
:
url
=
'%s/manage_addProduct/ERP5/manage_addERP5Site'
%
base_url
result
=
urllib
.
urlopen
(
url
,
urllib
.
urlencode
({
"id"
:
site_id
,
"erp5_catalog_storage"
:
erp5_catalog_storage
,
"erp5_sql_connection_string"
:
mysql_string
,
"cmf_activity_sql_connection_string"
:
mysql_string
,
}))
print
"ERP5 Site creation output: %s"
%
result
.
read
()
if
not
business_template_setup_finished
:
if
proxy
.
isERP5SitePresent
()
==
True
:
print
"Start to set initial business template setup."
# Update URL to ERP5 Site
erp5
=
xmlrpclib
.
ServerProxy
(
"%s/%s"
%
(
base_url
,
site_id
),
allow_none
=
1
)
repository_list
=
erp5
.
portal_templates
.
getRepositoryList
()
if
len
(
bt5_repository_list
)
>
0
and
\
set
(
bt5_repository_list
)
!=
set
(
repository_list
):
erp5
.
portal_templates
.
\
updateRepositoryBusinessTemplateList
(
bt5_repository_list
,
None
)
installed_bt5_list
=
\
erp5
.
portal_templates
.
getInstalledBusinessTemplateTitleList
()
for
bt5
in
bt5_list
:
if
bt5
not
in
installed_bt5_list
:
erp5
.
portal_templates
.
\
installBusinessTemplatesFromRepositories
([
bt5
])
repository_set
=
set
(
erp5
.
portal_templates
.
getRepositoryList
())
installed_bt5_list
=
erp5
.
portal_templates
.
\
getInstalledBusinessTemplateTitleList
()
if
(
set
(
repository_set
)
==
set
(
bt5_repository_list
))
and
\
len
([
i
for
i
in
bt5_list
if
i
not
in
installed_bt5_list
])
==
0
:
print
"Repositories updated and business templates installed."
business_template_setup_finished
=
1
if
external_service_assertion
:
url
=
"%s/%s/%s"
%
(
base_url
,
site_id
,
update_script_id
)
result
=
urllib
.
urlopen
(
url
,
urllib
.
urlencode
({
"memcached"
:
memcached_provider
,
"kumo"
:
kumo_provider
,
"conversion_server"
:
conversion_server
,})).
read
()
external_service_assertion
=
not
(
result
==
"True"
)
except
IOError
:
print
"Unable to create the ERP5 Site!"
except
socket
.
error
,
e
:
print
"Unable to connect to ZOPE! %s"
%
e
except
xmlrpclib
.
Fault
,
e
:
print
"XMLRPC Fault: %s"
%
e
time
.
sleep
(
sleep
)
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/execute.py
0 → 100644
View file @
43653c40
import
sys
import
os
import
signal
import
subprocess
import
time
def
execute
(
args
):
"""Portable execution with process replacement"""
# Note: Candidate for slapos.lib.recipe
os
.
execv
(
args
[
0
],
args
+
sys
.
argv
[
1
:])
child_pg
=
None
def
executee
(
args
):
"""Portable execution with process replacement and environment manipulation"""
exec_list
=
list
(
args
[
0
])
environment
=
args
[
1
]
env
=
os
.
environ
.
copy
()
for
k
,
v
in
environment
.
iteritems
():
env
[
k
]
=
v
os
.
execve
(
exec_list
[
0
],
exec_list
+
sys
.
argv
[
1
:],
env
)
def
sig_handler
(
signal
,
frame
):
print
'Received signal %r, killing children and exiting'
%
signal
if
child_pg
is
not
None
:
os
.
killpg
(
child_pg
,
signal
.
SIGHUP
)
os
.
killpg
(
child_pg
,
signal
.
SIGTERM
)
sys
.
exit
(
0
)
signal
.
signal
(
signal
.
SIGINT
,
sig_handler
)
signal
.
signal
(
signal
.
SIGQUIT
,
sig_handler
)
signal
.
signal
(
signal
.
SIGTERM
,
sig_handler
)
def
execute_with_signal_translation
(
args
):
"""Run process as children and translate from SIGTERM to another signal"""
child
=
subprocess
.
Popen
(
args
,
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
child_pg
=
child
.
pid
try
:
print
'Process %r started'
%
args
while
True
:
time
.
sleep
(
10
)
finally
:
os
.
killpg
(
child_pg
,
signal
.
SIGHUP
)
os
.
killpg
(
child_pg
,
signal
.
SIGTERM
)
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/innobackupex.py
0 → 100644
View file @
43653c40
import
os
import
glob
def
controller
(
args
):
"""Creates full or incremental backup
If no full backup is done, it is created
If full backup exists incremental backup is done starting with base
base is the newest (according to date) full or incremental backup
"""
innobackupex_incremental
,
innobackupex_full
,
full_backup
,
incremental_backup
\
=
args
if
len
(
os
.
listdir
(
full_backup
))
==
0
:
print
'Doing full backup in %r'
%
full_backup
os
.
execv
(
innobackupex_full
,
[
innobackupex_full
,
full_backup
])
else
:
backup_list
=
filter
(
os
.
path
.
isdir
,
glob
.
glob
(
full_backup
+
"/*"
)
+
glob
.
glob
(
incremental_backup
+
"/*"
))
backup_list
.
sort
(
key
=
lambda
x
:
os
.
path
.
getmtime
(
x
),
reverse
=
True
)
base
=
backup_list
[
0
]
print
'Doing incremental backup in %r using %r as a base'
%
(
incremental_backup
,
base
)
os
.
execv
(
innobackupex_incremental
,
[
innobackupex_incremental
,
'--incremental-basedir=%s'
%
base
,
incremental_backup
])
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/killpidfromfile.py
0 → 100644
View file @
43653c40
import
sys
import
os
import
signal
def
killpidfromfile
():
file
=
sys
.
argv
[
1
]
sig
=
getattr
(
signal
,
sys
.
argv
[
2
],
None
)
if
sig
is
None
:
raise
ValueError
(
'Unknwon signal name %s'
%
sys
.
argv
[
2
])
if
os
.
path
.
exists
(
file
):
pid
=
int
(
open
(
file
).
read
())
print
'Killing pid %s with signal %s'
%
(
pid
,
sys
.
argv
[
2
])
os
.
kill
(
pid
,
sig
)
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py
0 → 100644
View file @
43653c40
import
os
import
subprocess
import
time
import
sys
def
runMysql
(
args
):
sleep
=
60
conf
=
args
[
0
]
mysqld_wrapper_list
=
[
conf
[
'mysqld_binary'
],
'--defaults-file=%s'
%
conf
[
'configuration_file'
]]
# we trust mysql_install that if mysql directory is available mysql was
# correctly initalised
if
not
os
.
path
.
isdir
(
os
.
path
.
join
(
conf
[
'data_directory'
],
'mysql'
)):
while
True
:
# XXX: Protect with proper root password
# XXX: Follow http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html
popen
=
subprocess
.
Popen
([
conf
[
'mysql_install_binary'
],
'--skip-name-resolve'
,
'--no-defaults'
,
'--datadir=%s'
%
conf
[
'data_directory'
]],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
result
=
popen
.
communicate
()[
0
]
if
popen
.
returncode
is
None
or
popen
.
returncode
!=
0
:
print
"Failed to initialise server.
\
n
The error was: %s"
%
result
print
"Waiting for %ss and retrying"
%
sleep
time
.
sleep
(
sleep
)
else
:
print
"Mysql properly initialised"
break
else
:
print
"MySQL already initialised"
print
"Starting %r"
%
mysqld_wrapper_list
[
0
]
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
os
.
execl
(
mysqld_wrapper_list
[
0
],
*
mysqld_wrapper_list
)
def
updateMysql
(
args
):
conf
=
args
[
0
]
sleep
=
30
is_succeed
=
False
while
True
:
if
not
is_succeed
:
mysql_upgrade_list
=
[
conf
[
'mysql_upgrade_binary'
],
'--no-defaults'
,
'--user=root'
,
'--socket=%s'
%
conf
[
'socket'
]]
mysql_upgrade
=
subprocess
.
Popen
(
mysql_upgrade_list
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
result
=
mysql_upgrade
.
communicate
()[
0
]
if
mysql_upgrade
.
returncode
is
None
:
mysql_upgrade
.
kill
()
if
mysql_upgrade
.
returncode
!=
0
and
not
'is already upgraded'
in
result
:
print
"Command %r failed with result:
\
n
%s"
%
(
mysql_upgrade_list
,
result
)
print
'Sleeping for %ss and retrying'
%
sleep
else
:
if
mysql_upgrade
.
returncode
==
0
:
print
"MySQL database upgraded with result:
\
n
%s"
%
result
else
:
print
"No need to upgrade MySQL database"
mysql_list
=
[
conf
[
'mysql_binary'
].
strip
(),
'--no-defaults'
,
'-B'
,
'--user=root'
,
'--socket=%s'
%
conf
[
'socket'
]]
mysql
=
subprocess
.
Popen
(
mysql_list
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
result
=
mysql
.
communicate
(
conf
[
'mysql_script'
])[
0
]
if
mysql
.
returncode
is
None
:
mysql
.
kill
()
if
mysql
.
returncode
!=
0
:
print
'Command %r failed with:
\
n
%s'
%
(
mysql_list
,
result
)
print
'Sleeping for %ss and retrying'
%
sleep
else
:
is_succeed
=
True
print
'SlapOS initialisation script succesfully applied on database.'
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
time
.
sleep
(
sleep
)
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/apache.location-snippet.conf.in
0 → 100644
View file @
43653c40
<Location %(location)s>
Order Deny,Allow
Deny from all
Allow from %(allow_string)s
</Location>
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/apache.ssl-snippet.conf.in
0 → 100644
View file @
43653c40
SSLEngine on
SSLCertificateFile %(login_certificate)s
SSLCertificateKeyFile %(login_key)s
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/apache.zope.conf.in
0 → 100644
View file @
43653c40
# Apache configuration file for Zope
# Automatically generated
# Basic server configuration
PidFile "%(pid_file)s"
LockFile "%(lock_file)s"
Listen %(ip)s:%(port)s
ServerAdmin %(server_admin)s
DefaultType text/plain
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
# As backend is trusting REMOTE_USER header unset it always
RequestHeader unset REMOTE_USER
# SSL Configuration
%(ssl_snippet)s
# Log configuration
ErrorLog "%(error_log)s"
LogLevel warn
LogFormat "%%h %%{REMOTE_USER}i %%l %%u %%t \"%%r\" %%>s %%b \"%%{Referer}i\" \"%%{User-Agent}i\"" combined
LogFormat "%%h %%{REMOTE_USER}i %%l %%u %%t \"%%r\" %%>s %%b" common
CustomLog "%(access_log)s" common
# Directory protection
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
%(path_enable)s
# Magic of Zope related rewrite
RewriteEngine On
%(rewrite_rule)s
# List of modules
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule headers_module modules/mod_headers.so
LoadModule antiloris_module modules/mod_antiloris.so
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/apache.zope.conf.path-protected.in
0 → 100644
View file @
43653c40
# Path protected
<Location %(path)s>
Order Deny,Allow
Deny from all
Allow from %(access_control_string)s
</Location>
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/apache.zope.conf.path.in
0 → 100644
View file @
43653c40
# Path enabled
<Location %(path)s>
Order Allow,Deny
Allow from all
</Location>
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/cloudooo.cfg.in
0 → 100644
View file @
43653c40
[app:main]
use = egg:cloudooo
#
## System config
#
debug_mode = True
# Folder where pid files, lock files and virtual frame buffer mappings
# are stored. In this folder is necessary create a folder tmp, because this
# folder is used to create all temporary documents.
working_path = %(working_path)s
# Folder where UNO library is installed
uno_path = %(uno_path)s
# Folder where soffice.bin is installed
office_binary_path = %(office_binary_path)s
#
## Monitor Settings
#
# Limit to use the Openoffice Instance. if pass of the limit, the instance is
# stopped and another is started.
limit_number_request = 100
# Interval to check the factory
monitor_interval = 10
timeout_response = 180
enable_memory_monitor = True
# Set the limit in MB
# e.g 1000 = 1 GB, 100 = 100 MB
limit_memory_used = 3000
#
## OOFactory Settings
#
# The pool consist of several OpenOffice.org instances
application_hostname = %(ip)s
# OpenOffice Port
openoffice_port = %(openoffice_port)s
# LD_LIBRARY_PATH passed to OpenOffice
env-LD_LIBRARY_PATH = %(LD_LIBRARY_PATH)s
#
# Mimetype Registry
# It is used to select the handler that will be used in conversion.
# Priority matters, first match take precedence on next lines.
mimetype_registry =
application/pdf * pdf
application/vnd.oasis.opendocument* * ooo
application/vnd.sun.xml* * ooo
text/* * ooo
image/* image/* imagemagick
video/* * ffmpeg
* application/vnd.oasis.opendocument* ooo
[server:main]
use = egg:PasteScript#wsgiutils
host = %(ip)s
port = %(port)s
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/haproxy.cfg.in
0 → 100644
View file @
43653c40
global
maxconn 4096
defaults
log global
mode http
option httplog
option dontlognull
retries 1
option redispatch
maxconn 2000
timeout server 3000s
timeout queue 5s
timeout connect 10s
timeout client 3600s
listen %(name)s %(ip)s:%(port)s
cookie SERVERID insert
balance roundrobin
%(server_text)s
option httpchk GET %(server_check_path)s
stats uri /haproxy
stats realm Global\ statistics
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/initmysql.sql.in
0 → 100644
View file @
43653c40
CREATE DATABASE IF NOT EXISTS %(mysql_database)s;
GRANT ALL PRIVILEGES ON %(mysql_database)s.* TO %(mysql_user)s@'%%' IDENTIFIED BY '%(mysql_password)s';
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/kumo_gateway.in
0 → 100644
View file @
43653c40
#!/bin/sh
exec
%
(
kumo_gateway_binary
)
s
-F
-E
-m
%
(
kumo_manager_ip
)
s:%
(
kumo_manager_port
)
s
-t
%
(
kumo_gateway_ip
)
s:%
(
kumo_gateway_port
)
s
-o
%
(
kumo_gateway_log
)
s
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/kumo_manager.in
0 → 100644
View file @
43653c40
#!/bin/sh
exec
%
(
kumo_manager_binary
)
s
-a
-l
%
(
kumo_manager_ip
)
s:%
(
kumo_manager_port
)
s
-o
%
(
kumo_manager_log
)
s
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/kumo_server.in
0 → 100644
View file @
43653c40
#!/bin/sh
exec
%
(
kumo_server_binary
)
s
-l
%
(
kumo_server_ip
)
s:%
(
kumo_server_port
)
s
-L
%
(
kumo_server_listen_port
)
s
-m
%
(
kumo_manager_ip
)
s:%
(
kumo_manager_port
)
s
-s
%
(
kumo_server_storage
)
s
-o
%
(
kumo_server_log
)
s
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/logrotate_entry.in
0 → 100644
View file @
43653c40
%(file_list)s {
daily
dateext
rotate 30
compress
notifempty
sharedscripts
create
postrotate
%(postrotate)s
endscript
olddir %(olddir)s
}
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/memcached.in
0 → 100644
View file @
43653c40
#!/bin/sh
exec
%
(
memcached_binary
)
s
-p
%
(
memcached_port
)
s
-U
%
(
memcached_port
)
s
-l
%
(
memcached_ip
)
s
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/my.cnf.in
0 → 100644
View file @
43653c40
# ERP5 buildout my.cnf template based on my-huge.cnf shipped with mysql
# The MySQL server
[mysqld]
# ERP5 by default requires InnoDB storage. MySQL by default fallbacks to using
# different engine, like MyISAM. Such behaviour generates problems only, when
# tables requested as InnoDB are silently created with MyISAM engine.
#
# Loud fail is really required in such case.
sql-mode="NO_ENGINE_SUBSTITUTION"
skip-show-database
port = %(tcp_port)s
bind-address = %(ip)s
socket = %(socket)s
datadir = %(data_directory)s
pid-file = %(pid_file)s
log-error = %(error_log)s
log-slow-file = %(slow_query_log)s
long_query_time = 5
max_allowed_packet = 128M
query_cache_size = 32M
plugin-load = ha_innodb_plugin.so
# The following are important to configure and depend a lot on to the size of
# your database and the available resources.
#innodb_buffer_pool_size = 4G
#innodb_log_file_size = 256M
#innodb_log_buffer_size = 8M
# Some dangerous settings you may want to uncomment if you only want
# performance or less disk access. Useful for unit tests.
#innodb_flush_log_at_trx_commit = 0
#innodb_flush_method = nosync
#innodb_doublewrite = 0
#sync_frm = 0
# Uncomment the following if you need binary logging, which is recommended
# on production instances (either for replication or incremental backups).
#log-bin=mysql-bin
# Force utf8 usage
collation_server = utf8_unicode_ci
character_set_server = utf8
skip-character-set-client-handshake
[mysql]
no-auto-rehash
socket = %(socket)s
[mysqlhotcopy]
interactive-timeout
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/openssl.cnf.ca.in
0 → 100644
View file @
43653c40
This diff is collapsed.
Click to expand it.
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/tidstorage.py.in
0 → 100644
View file @
43653c40
known_tid_storage_identifier_dict = %(known_tid_storage_identifier_dict)s
base_url = '%(base_url)s'
address = '%(host)s'
port = %(port)s
#fork = False
#setuid = None
#setgid = None
burst_period = 30
full_dump_period = 300
timestamp_file_path = '%(timestamp_file_path)s'
logfile_name = '%(logfile)s'
pidfile_name = '%(pidfile)s'
status_file = '%(statusfile)s'
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zeo.conf.in
0 → 100644
View file @
43653c40
# ZEO configuration file generated by SlapOS
<zeo>
address %(zeo_ip)s:%(zeo_port)s
read-only false
invalidation-queue-size 100
pid-filename %(zeo_pid)s
</zeo>
%(zeo_filestorage_snippet)s
<eventlog>
<logfile>
path %(zeo_event_log)s
</logfile>
</eventlog>
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zope-deadlockdebugger-snippet.conf.in
0 → 100644
View file @
43653c40
# DeadlockDebugger configuration
<product-config DeadlockDebugger>
dump_url %(dump_url)s
secret %(secret)s
</product-config>
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zope-tidstorage-snippet.conf.in
0 → 100644
View file @
43653c40
# TIDStorage connection
<product-config TIDStorage>
backend-ip %(host)s
backend-port %(port)s
</product-config>
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zope-zeo-snippet.conf.in
0 → 100644
View file @
43653c40
<zodb_db %(storage_name)s>
mount-point %(mount_point)s
<zeoclient>
server %(address)s
storage %(storage_name)s
name %(storage_name)s
</zeoclient>
</zodb_db>
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zope-zodb-snippet.conf.in
0 → 100644
View file @
43653c40
<zodb_db root>
<filestorage>
path %(zodb_root_path)s
</filestorage>
mount-point /
</zodb_db>
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zope.conf.in
0 → 100644
View file @
43653c40
## Zope 2 configuration file generated by SlapOS
# Some defines
%%define INSTANCE %(instance)s
instancehome $INSTANCE
# Used products
%(products)s
# Environment override
<environment>
TMP %(tmp_directory)s
TMPDIR %(tmp_directory)s
HOME %(tmp_directory)s
PATH %(path)s
</environment>
# No need to debug
debug-mode off
# One thread is safe enough
zserver-threads %(thread_amount)s
# File location
pid-filename %(pid-filename)s
lock-filename %(lock-filename)s
# Temporary storage database (for sessions)
<zodb_db temporary>
<temporarystorage>
name temporary storage for sessioning
</temporarystorage>
mount-point /temp_folder
container-class Products.TemporaryFolder.TemporaryContainer
</zodb_db>
# Logging configuration
<eventlog>
<logfile>
path %(event_log)s
</logfile>
</eventlog>
<logger access>
<logfile>
path %(z2_log)s
</logfile>
</logger>
# Serving configuration
<http-server>
address %(address)s
</http-server>
# ZODB configuration
%(zodb_configuration_string)s
<zoperunner>
program $INSTANCE/bin/runzope
</zoperunner>
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/template/zope.conf.timerservice.in
0 → 100644
View file @
43653c40
# ERP5 Timer Service
%%import timerserver
<timer-server>
interval 5
</timer-server>
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/test_suite_runner.py
0 → 100644
View file @
43653c40
import
os
import
sys
def
runTestSuite
(
args
):
env
=
os
.
environ
.
copy
()
d
=
args
[
0
]
env
[
'OPENSSL_BINARY'
]
=
d
[
'openssl_binary'
]
env
[
'TEST_CA_PATH'
]
=
d
[
'test_ca_path'
]
env
[
'PATH'
]
=
':'
.
join
([
d
[
'prepend_path'
]]
+
os
.
environ
[
'PATH'
].
split
(
':'
))
env
[
'INSTANCE_HOME'
]
=
d
[
'instance_home'
]
env
[
'REAL_INSTANCE_HOME'
]
=
d
[
'instance_home'
]
os
.
execve
(
d
[
'call_list'
][
0
],
d
[
'call_list'
]
+
sys
.
argv
[
1
:],
env
)
slapos/slapos.recipe.erp5/src/slapos/recipe/erp5/testrunner.py
0 → 100644
View file @
43653c40
import
os
import
sys
def
runUnitTest
(
args
):
env
=
os
.
environ
.
copy
()
d
=
args
[
0
]
env
[
'OPENSSL_BINARY'
]
=
d
[
'openssl_binary'
]
env
[
'TEST_CA_PATH'
]
=
d
[
'test_ca_path'
]
env
[
'PATH'
]
=
':'
.
join
([
d
[
'prepend_path'
]]
+
os
.
environ
[
'PATH'
].
split
(
':'
))
env
[
'INSTANCE_HOME'
]
=
d
[
'instance_home'
]
env
[
'REAL_INSTANCE_HOME'
]
=
d
[
'instance_home'
]
os
.
execve
(
d
[
'call_list'
][
0
],
d
[
'call_list'
]
+
sys
.
argv
[
1
:],
env
)
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