Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Commits
2f20db4c
Commit
2f20db4c
authored
Oct 06, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update boinc recipe to use a specified python
parent
00c5090c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
41 deletions
+44
-41
slapos/recipe/boinc/__init__.py
slapos/recipe/boinc/__init__.py
+8
-4
slapos/recipe/boinc/configure.py
slapos/recipe/boinc/configure.py
+33
-35
stack/boinc/buildout.cfg
stack/boinc/buildout.cfg
+1
-1
stack/boinc/instance-boinc.cfg
stack/boinc/instance-boinc.cfg
+2
-1
No files found.
slapos/recipe/boinc/__init__.py
View file @
2f20db4c
...
@@ -62,6 +62,7 @@ class Recipe(GenericBaseRecipe):
...
@@ -62,6 +62,7 @@ class Recipe(GenericBaseRecipe):
#Get binary path
#Get binary path
self
.
svn
=
options
[
'svn-binary'
].
strip
()
self
.
svn
=
options
[
'svn-binary'
].
strip
()
self
.
perl
=
options
[
'perl-binary'
].
strip
()
self
.
perl
=
options
[
'perl-binary'
].
strip
()
self
.
pythonbin
=
options
[
'python-binary'
].
strip
()
#Apache php informations
#Apache php informations
self
.
ipv6
=
options
[
'ip'
].
strip
()
self
.
ipv6
=
options
[
'ip'
].
strip
()
...
@@ -69,7 +70,6 @@ class Recipe(GenericBaseRecipe):
...
@@ -69,7 +70,6 @@ class Recipe(GenericBaseRecipe):
self
.
htpasswd
=
options
[
'htpasswd'
].
strip
()
self
.
htpasswd
=
options
[
'htpasswd'
].
strip
()
self
.
phpini
=
options
[
'php-ini'
].
strip
()
self
.
phpini
=
options
[
'php-ini'
].
strip
()
self
.
phpbin
=
options
[
'php-bin'
].
strip
()
self
.
phpbin
=
options
[
'php-bin'
].
strip
()
self
.
wrapperphp
=
options
[
'php-wrapper'
].
strip
()
#get Mysql parameters
#get Mysql parameters
self
.
username
=
options
[
'mysql-username'
].
strip
()
self
.
username
=
options
[
'mysql-username'
].
strip
()
...
@@ -103,7 +103,10 @@ class Recipe(GenericBaseRecipe):
...
@@ -103,7 +103,10 @@ class Recipe(GenericBaseRecipe):
slapuser
=
self
.
options
[
'user'
]
slapuser
=
self
.
options
[
'user'
]
#Define environment variable here
#Define environment variable here
python
=
os
.
path
.
join
(
self
.
home
,
'bin/python'
)
python_path
=
self
.
boinc_egg
+
":"
+
os
.
environ
[
'PYTHONPATH'
]
python_path
=
self
.
boinc_egg
+
":"
+
os
.
environ
[
'PYTHONPATH'
]
if
not
os
.
path
.
exists
(
python
):
os
.
symlink
(
self
.
pythonbin
,
python
)
for
f
in
os
.
listdir
(
self
.
developegg
):
for
f
in
os
.
listdir
(
self
.
developegg
):
dir
=
os
.
path
.
join
(
self
.
developegg
,
f
)
dir
=
os
.
path
.
join
(
self
.
developegg
,
f
)
if
os
.
path
.
isdir
(
dir
):
if
os
.
path
.
isdir
(
dir
):
...
@@ -115,13 +118,14 @@ class Recipe(GenericBaseRecipe):
...
@@ -115,13 +118,14 @@ class Recipe(GenericBaseRecipe):
)
)
#Generate wrapper for php
#Generate wrapper for php
php_wrapper
=
self
.
createPythonScript
(
self
.
wrapperphp
,
wrapperphp
=
os
.
path
.
join
(
self
.
home
,
'bin/php'
)
php_wrapper
=
self
.
createPythonScript
(
wrapperphp
,
'slapos.recipe.librecipe.execute.executee'
,
'slapos.recipe.librecipe.execute.executee'
,
([
self
.
phpbin
,
'-c'
,
self
.
phpini
],
os
.
environ
)
([
self
.
phpbin
,
'-c'
,
self
.
phpini
],
os
.
environ
)
)
)
path_list
.
append
(
php_wrapper
)
path_list
.
append
(
php_wrapper
)
#Generate python script for MySQL database
marker
(starting)
#Generate python script for MySQL database
test
(starting)
file_status
=
os
.
path
.
join
(
self
.
home
,
'.boinc_config'
)
file_status
=
os
.
path
.
join
(
self
.
home
,
'.boinc_config'
)
if
os
.
path
.
exists
(
file_status
):
if
os
.
path
.
exists
(
file_status
):
os
.
unlink
(
file_status
)
os
.
unlink
(
file_status
)
...
@@ -185,7 +189,7 @@ class Recipe(GenericBaseRecipe):
...
@@ -185,7 +189,7 @@ class Recipe(GenericBaseRecipe):
installroot
=
self
.
installroot
,
drop_install
=
drop_install
,
installroot
=
self
.
installroot
,
drop_install
=
drop_install
,
mysql_port
=
self
.
mysqlport
,
mysql_host
=
self
.
mysqlhost
,
mysql_port
=
self
.
mysqlport
,
mysql_host
=
self
.
mysqlhost
,
mysql_user
=
self
.
username
,
mysql_password
=
self
.
password
,
mysql_user
=
self
.
username
,
mysql_password
=
self
.
password
,
database
=
self
.
database
,
python_path
=
python_path
)
database
=
self
.
database
,
PATH
=
environment
[
'PATH'
]
)
start_wrapper
=
self
.
createPythonScript
(
os
.
path
.
join
(
self
.
wrapperdir
,
start_wrapper
=
self
.
createPythonScript
(
os
.
path
.
join
(
self
.
wrapperdir
,
'start_boinc'
),
'start_boinc'
),
'%s.configure.restart_boinc'
%
__name__
,
'%s.configure.restart_boinc'
%
__name__
,
...
...
slapos/recipe/boinc/configure.py
View file @
2f20db4c
...
@@ -73,23 +73,15 @@ def services(args):
...
@@ -73,23 +73,15 @@ def services(args):
topath
=
os
.
path
.
join
(
args
[
'installroot'
],
'html/ops/.htpasswd'
)
topath
=
os
.
path
.
join
(
args
[
'installroot'
],
'html/ops/.htpasswd'
)
print
"Generating .htpasswd file... File=%s"
%
topath
print
"Generating .htpasswd file... File=%s"
%
topath
passwd
=
open
(
args
[
'passwd'
],
'r'
).
read
()
passwd
=
open
(
args
[
'passwd'
],
'r'
).
read
()
p_htpasswd
=
subprocess
.
Popen
([
args
[
'htpasswd'
],
'-b'
,
'-c'
,
topath
,
htpwd_args
=
[
args
[
'htpasswd'
],
'-b'
,
'-c'
,
topath
,
args
[
'username'
],
passwd
]
args
[
'username'
],
passwd
],
if
not
startProcess
(
htpwd_args
):
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
result
=
p_htpasswd
.
communicate
()[
0
]
if
p_htpasswd
.
returncode
is
None
or
p_htpasswd
.
returncode
!=
0
:
print
"Failed to create file %s.
\
n
The error was: %s"
%
(
topath
,
result
)
return
return
print
"Running xadd script..."
print
"Running xadd script..."
env
=
os
.
environ
env
=
os
.
environ
env
[
'PATH'
]
=
args
[
'environment'
][
'PATH'
]
env
[
'PATH'
]
=
args
[
'environment'
][
'PATH'
]
env
[
'PYTHONPATH'
]
=
args
[
'environment'
][
'PYTHONPATH'
]
env
[
'PYTHONPATH'
]
=
args
[
'environment'
][
'PYTHONPATH'
]
p_xadd
=
subprocess
.
Popen
([
args
[
'xadd'
]],
stdout
=
subprocess
.
PIPE
,
if
not
startProcess
([
args
[
'xadd'
]],
env
):
stderr
=
subprocess
.
STDOUT
,
env
=
env
)
result
=
p_xadd
.
communicate
()[
0
]
if
p_xadd
.
returncode
is
None
or
p_xadd
.
returncode
!=
0
:
print
"Failed to execute bin/xadd.
\
n
The error was: %s"
%
result
return
return
print
"Update files and directories permissions..."
print
"Update files and directories permissions..."
upload
=
os
.
path
.
join
(
args
[
'installroot'
],
'upload'
)
upload
=
os
.
path
.
join
(
args
[
'installroot'
],
'upload'
)
...
@@ -115,12 +107,8 @@ def services(args):
...
@@ -115,12 +107,8 @@ def services(args):
#Execute php create_forum.php...
#Execute php create_forum.php...
print
"Boinc Forum: Execute php create_forum.php..."
print
"Boinc Forum: Execute php create_forum.php..."
p_forum
=
subprocess
.
Popen
([
"php"
,
forum_file
],
stdout
=
subprocess
.
PIPE
,
cwd
=
os
.
path
.
join
(
args
[
'installroot'
],
'html/ops'
)
stderr
=
subprocess
.
STDOUT
,
env
=
env
,
cwd
=
os
.
path
.
join
(
args
[
'installroot'
],
if
not
startProcess
([
"php"
,
forum_file
],
env
,
cwd
):
'html/ops'
))
result
=
p_forum
.
communicate
()[
0
]
if
p_forum
.
returncode
is
None
or
p_forum
.
returncode
!=
0
:
print
"Failed to execute bin/xadd.
\
n
The error was: %s"
%
result
return
return
status
=
open
(
args
[
'service_status'
],
"w"
)
status
=
open
(
args
[
'service_status'
],
"w"
)
...
@@ -140,15 +128,18 @@ def restart_boinc(args):
...
@@ -140,15 +128,18 @@ def restart_boinc(args):
else
:
else
:
checkMysql
(
args
)
checkMysql
(
args
)
print
"Restart Boinc..."
print
"Restart Boinc..."
os
.
environ
[
'PATH'
]
=
args
[
'PATH'
]
binstart
=
os
.
path
.
join
(
args
[
'installroot'
],
'bin/start'
)
binstart
=
os
.
path
.
join
(
args
[
'installroot'
],
'bin/start'
)
binstop
=
os
.
path
.
join
(
args
[
'installroot'
],
'bin/stop'
)
binstop
=
os
.
path
.
join
(
args
[
'installroot'
],
'bin/stop'
)
# startProcess([binstart], env)
# startProcess([binstop], env)
os
.
system
(
binstop
)
os
.
system
(
binstop
)
os
.
system
(
binstart
)
os
.
system
(
binstart
)
print
"Done."
print
"Done."
def
deployApp
(
args
):
def
deployApp
(
args
):
print
"Cheking if needed to install %s..."
%
args
[
'appname'
]
print
"Cheking if needed to install %s..."
%
args
[
'appname'
]
if
os
.
path
.
exists
(
os
.
path
.
join
(
args
[
'installroot'
],
"."
+
args
[
'appname'
])):
if
os
.
path
.
exists
(
os
.
path
.
join
(
args
[
'installroot'
],
"."
+
args
[
'appname'
])):
print
args
[
'appname'
]
+
" is already installed in this Boinc instance... skipped"
print
args
[
'appname'
]
+
" is already installed in this Boinc instance... skipped"
return
return
#Sleep until file .start_service exist (Mark the end of boinc configuration)
#Sleep until file .start_service exist (Mark the end of boinc configuration)
...
@@ -169,6 +160,8 @@ def deployApp(args):
...
@@ -169,6 +160,8 @@ def deployApp(args):
base_app
=
os
.
path
.
join
(
args
[
'installroot'
],
'apps'
,
args
[
'appname'
])
base_app
=
os
.
path
.
join
(
args
[
'installroot'
],
'apps'
,
args
[
'appname'
])
base_app_version
=
os
.
path
.
join
(
base_app
,
args
[
'version'
])
base_app_version
=
os
.
path
.
join
(
base_app
,
args
[
'version'
])
args
[
'templates'
]
=
os
.
path
.
join
(
args
[
'installroot'
],
'templates'
)
args
[
'templates'
]
=
os
.
path
.
join
(
args
[
'installroot'
],
'templates'
)
t_result
=
os
.
path
.
join
(
args
[
'templates'
],
args
[
'appname'
]
+
'_result'
)
t_wu
=
os
.
path
.
join
(
args
[
'templates'
],
args
[
'appname'
]
+
'_wu'
)
if
not
os
.
path
.
exists
(
base_app
):
if
not
os
.
path
.
exists
(
base_app
):
os
.
mkdir
(
base_app
)
os
.
mkdir
(
base_app
)
if
os
.
path
.
exists
(
base_app_version
):
if
os
.
path
.
exists
(
base_app_version
):
...
@@ -177,10 +170,14 @@ def deployApp(args):
...
@@ -177,10 +170,14 @@ def deployApp(args):
os
.
mkdir
(
args
[
'application'
])
os
.
mkdir
(
args
[
'application'
])
if
not
os
.
path
.
exists
(
args
[
'templates'
]):
if
not
os
.
path
.
exists
(
args
[
'templates'
]):
os
.
mkdir
(
args
[
'templates'
])
os
.
mkdir
(
args
[
'templates'
])
shutil
.
copy
(
args
[
't_result'
],
os
.
path
.
join
(
args
[
'templates'
],
else
:
args
[
'appname'
]
+
'_result'
))
if
os
.
path
.
exists
(
t_result
):
shutil
.
copy
(
args
[
't_wu'
],
os
.
path
.
join
(
args
[
'templates'
],
os
.
unlink
(
t_result
)
args
[
'appname'
]
+
'_wu'
))
if
os
.
path
.
exists
(
t_result
):
os
.
unlink
(
t_wu
)
shutil
.
copy
(
args
[
't_result'
],
t_result
)
shutil
.
copy
(
args
[
't_wu'
],
t_wu
)
if
not
os
.
path
.
exists
(
args
[
'inputfile'
]):
os
.
symlink
(
args
[
't_input'
],
args
[
'inputfile'
])
os
.
symlink
(
args
[
't_input'
],
args
[
'inputfile'
])
shutil
.
copy
(
args
[
'binary'
],
os
.
path
.
join
(
args
[
'application'
],
shutil
.
copy
(
args
[
'binary'
],
os
.
path
.
join
(
args
[
'application'
],
args
[
'binary_name'
]))
args
[
'binary_name'
]))
...
@@ -190,20 +187,13 @@ def deployApp(args):
...
@@ -190,20 +187,13 @@ def deployApp(args):
project_xml
=
os
.
path
.
join
(
args
[
'installroot'
],
'project.xml'
)
project_xml
=
os
.
path
.
join
(
args
[
'installroot'
],
'project.xml'
)
config_xml
=
os
.
path
.
join
(
args
[
'installroot'
],
'config.xml'
)
config_xml
=
os
.
path
.
join
(
args
[
'installroot'
],
'config.xml'
)
sed_args
=
[
args
[
'bash'
],
args
[
'appname'
],
args
[
'installroot'
]]
sed_args
=
[
args
[
'bash'
],
args
[
'appname'
],
args
[
'installroot'
]]
sed
=
subprocess
.
Popen
(
sed_args
,
stderr
=
subprocess
.
STDOUT
,
startProcess
(
sed_args
)
stdout
=
subprocess
.
PIPE
)
result
=
sed
.
communicate
()[
0
]
print
result
print
"Running xadd script..."
print
"Running xadd script..."
env
=
os
.
environ
env
=
os
.
environ
env
[
'PATH'
]
=
args
[
'environment'
][
'PATH'
]
env
[
'PATH'
]
=
args
[
'environment'
][
'PATH'
]
env
[
'PYTHONPATH'
]
=
args
[
'environment'
][
'PYTHONPATH'
]
env
[
'PYTHONPATH'
]
=
args
[
'environment'
][
'PYTHONPATH'
]
p_xadd
=
subprocess
.
Popen
([
os
.
path
.
join
(
args
[
'installroot'
],
'bin/xadd'
)],
if
not
startProcess
([
os
.
path
.
join
(
args
[
'installroot'
],
'bin/xadd'
)],
env
):
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
env
=
env
)
result
=
p_xadd
.
communicate
()[
0
]
if
p_xadd
.
returncode
is
None
or
p_xadd
.
returncode
!=
0
:
print
"Failed to execute bin/xadd.
\
n
The error was: %s"
%
result
return
return
print
"Sign the application binary..."
print
"Sign the application binary..."
...
@@ -237,6 +227,7 @@ def deployApp(args):
...
@@ -237,6 +227,7 @@ def deployApp(args):
print
"Restart Boinc..."
print
"Restart Boinc..."
binstart
=
os
.
path
.
join
(
args
[
'installroot'
],
'bin/start'
)
binstart
=
os
.
path
.
join
(
args
[
'installroot'
],
'bin/start'
)
binstop
=
os
.
path
.
join
(
args
[
'installroot'
],
'bin/stop'
)
binstop
=
os
.
path
.
join
(
args
[
'installroot'
],
'bin/stop'
)
sys
.
environ
=
env
os
.
system
(
binstop
)
os
.
system
(
binstop
)
os
.
system
(
binstart
)
os
.
system
(
binstart
)
...
@@ -255,9 +246,16 @@ def create_wu(args, env):
...
@@ -255,9 +246,16 @@ def create_wu(args, env):
for
i
in
range
(
count
):
for
i
in
range
(
count
):
print
"Creating project wroker %s..."
%
str
(
i
+
1
)
print
"Creating project wroker %s..."
%
str
(
i
+
1
)
launch_args
[
4
]
=
args
[
'wu_name'
]
+
str
(
i
+
1
)
launch_args
[
4
]
=
args
[
'wu_name'
]
+
str
(
i
+
1
)
startProcess
(
launch_args
,
env
,
args
[
'installroot'
])
def
startProcess
(
launch_args
,
env
=
None
,
cwd
=
None
):
process
=
subprocess
.
Popen
(
launch_args
,
stdout
=
subprocess
.
PIPE
,
process
=
subprocess
.
Popen
(
launch_args
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
env
=
env
,
stderr
=
subprocess
.
STDOUT
,
env
=
env
,
cwd
=
args
[
'installroot'
])
cwd
=
cwd
)
process
.
communicate
()[
0
]
result
=
process
.
communicate
()[
0
]
if
process
.
returncode
is
None
or
process
.
returncode
!=
0
:
print
"Failed to execute executable.
\
n
The error was: %s"
%
result
return
False
return
True
\ No newline at end of file
stack/boinc/buildout.cfg
View file @
2f20db4c
...
@@ -41,7 +41,7 @@ eggs =
...
@@ -41,7 +41,7 @@ eggs =
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-boinc.cfg
url = ${:_profile_base_location_}/instance-boinc.cfg
output = ${buildout:directory}/template-boinc.cfg
output = ${buildout:directory}/template-boinc.cfg
md5sum =
bf1cafe595dbf694a92dfcc78743b29d
md5sum =
2ab17fad66dd07677367fcb7283d55e5
mode = 0644
mode = 0644
#Template for deploying MySQL Database Server
#Template for deploying MySQL Database Server
...
...
stack/boinc/instance-boinc.cfg
View file @
2f20db4c
...
@@ -134,7 +134,7 @@ project = $${slap-parameter:project}
...
@@ -134,7 +134,7 @@ project = $${slap-parameter:project}
installroot = $${rootdirectory:project}/$${slap-parameter:project}
installroot = $${rootdirectory:project}/$${slap-parameter:project}
[environment]
[environment]
PATH =
%(PATH)s:$${rootdirectory:bin}:${subversion:location}/bin:${perl:location}/bin
PATH =
$${rootdirectory:bin}:${subversion:location}/bin:${perl:location}/bin:%(PATH)s
# Deploy Apache + PHP application
# Deploy Apache + PHP application
[apache-php]
[apache-php]
...
@@ -193,6 +193,7 @@ develop-egg = ${buildout:develop-eggs-directory}
...
@@ -193,6 +193,7 @@ develop-egg = ${buildout:develop-eggs-directory}
#Other binary path
#Other binary path
svn-binary = ${subversion:location}/bin
svn-binary = ${subversion:location}/bin
perl-binary = ${perl:location}/bin
perl-binary = ${perl:location}/bin
python-binary = ${buildout:executable}
#Apache and php
#Apache and php
ip = $${apache-php:ip}
ip = $${apache-php:ip}
...
...
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