Commit 52a81eca authored by Nicolas Wavrant's avatar Nicolas Wavrant

Merge branch 'slaprunner-paas'

parents 7c0ed323 8d26c030
...@@ -127,11 +127,11 @@ Example : ...@@ -127,11 +127,11 @@ Example :
Git repositories : Git repositories :
------------------ ------------------
It is easy to give access to your git repository/ies to everyone, or to clone it on your own computer. For this, there are 2 urls to remember: It is easy to give access to your git repository/ies to everyone, or to clone it on your own computer. For this, fetch the git_url parameter returned by your webrunner instance. It should look like that : https://[IPV6]:PORT/git/YourRepo.git/
- For read only, you can clone : https://[IPV6]:PORT/git-public/YourRepo.git/
- For read and write access, using your runner account : https://[IPV6]:PORT/git/YourRepo.git/
To create the repo, go in the folder srv/runner/project and initiate a new git repo (git init/clone --bare XXX). To create the repo, go to the folder srv/runner/project and initiate a new git repo (git init/clone --bare YourRepo). Then, to clone the repo, just append its name to the previous URL.
Please notice that your repositories are in public access for reading. However, an account is needed to push to the repository (use your webrunner account, or create a new user in the parameters section of the webrunner).
For the moment, the PORT is the port of monitoring, which is 9685. For the moment, the PORT is the port of monitoring, which is 9685.
......
...@@ -43,7 +43,7 @@ mode = 0644 ...@@ -43,7 +43,7 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-runner.cfg url = ${:_profile_base_location_}/instance-runner.cfg
output = ${buildout:directory}/template-runner.cfg.in output = ${buildout:directory}/template-runner.cfg.in
md5sum = 9878115a2969489b57e8563ef3d4d6d3 md5sum = b5644037da14e79576840975415ee1a4
mode = 0644 mode = 0644
[template-runner-import-script] [template-runner-import-script]
...@@ -58,7 +58,7 @@ mode = 0644 ...@@ -58,7 +58,7 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-runner-import.cfg.in url = ${:_profile_base_location_}/instance-runner-import.cfg.in
output = ${buildout:directory}/instance-runner-import.cfg output = ${buildout:directory}/instance-runner-import.cfg
md5sum = 354ff83819e8379f5e4a2e2985e34e9e md5sum = a85d054b3e2ae9243d8d188c897dc121
mode = 0644 mode = 0644
[template-runner-export-script] [template-runner-export-script]
...@@ -73,13 +73,13 @@ mode = 0644 ...@@ -73,13 +73,13 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-runner-export.cfg.in url = ${:_profile_base_location_}/instance-runner-export.cfg.in
output = ${buildout:directory}/instance-runner-export.cfg output = ${buildout:directory}/instance-runner-export.cfg
md5sum = 6930a0d6c88896c43a8e60509ba6bd1c md5sum = 521bad4c571b5b2dc3eee6090802de95
mode = 0644 mode = 0644
[template-resilient] [template-resilient]
recipe = slapos.recipe.download recipe = slapos.recipe.download
url = ${:_profile_base_location_}/instance-resilient.cfg.jinja2 url = ${:_profile_base_location_}/instance-resilient.cfg.jinja2
md5sum = 1f7332d0b0671929a2de87ef9ce998c8 md5sum = aec7fb7fe57b48c5c26c7adcdff36d26
filename = instance-resilient.cfg.jinja2 filename = instance-resilient.cfg.jinja2
mode = 0644 mode = 0644
...@@ -87,7 +87,7 @@ mode = 0644 ...@@ -87,7 +87,7 @@ mode = 0644
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/instance-resilient-test.cfg.jinja2 url = ${:_profile_base_location_}/instance-resilient-test.cfg.jinja2
download-only = true download-only = true
md5sum = abba49f5f397bfe6f6ea5e5dd185b1e9 md5sum = 01545742e97b4b95cd5e14d5d7cb1584
filename = instance-resilient-test.cfg.jinja2 filename = instance-resilient-test.cfg.jinja2
mode = 0644 mode = 0644
...@@ -103,7 +103,7 @@ mode = 0644 ...@@ -103,7 +103,7 @@ mode = 0644
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/httpd_conf.in url = ${:_profile_base_location_}/httpd_conf.in
download-only = true download-only = true
md5sum = 63782f8eaa94af729ec6bba80e062d8f md5sum = 444399390eb19c7e23dd06593c067b4d
filename = httpd_conf.in filename = httpd_conf.in
mode = 0644 mode = 0644
...@@ -118,13 +118,13 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_} ...@@ -118,13 +118,13 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_}
[template-slapos-cfg] [template-slapos-cfg]
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/${:filename} url = ${:_profile_base_location_}/template/${:filename}
md5sum = 847df63cf5a226ed338d7ca34b0220b5 md5sum = ba3721425ba34e265b1f8390ed7196cf
location = ${buildout:parts-directory}/${:_buildout_section_name_} location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = slapos.cfg.in filename = slapos.cfg.in
download-only = true download-only = true
mode = 0644 mode = 0644
[parameters-template] [template-parameters]
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:filename}
md5sum = f8446fcf254b4929eb828a9a1d7e5f62 md5sum = f8446fcf254b4929eb828a9a1d7e5f62
...@@ -133,6 +133,33 @@ filename = parameters.xml.in ...@@ -133,6 +133,33 @@ filename = parameters.xml.in
download-only = true download-only = true
mode = 0644 mode = 0644
[template-bash-profile]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/${:filename}
md5sum = 39dc910743c70d5120a778779a052cad
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = bash_profile.in
download-only = true
mode = 0644
[template-supervisord]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/${:filename}
md5sum = af2d78440a358ec268d7ece4fce99ec9
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = supervisord.conf.in
download-only = true
mode = 0644
[template-listener-slapgrid]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/${:filename}
md5sum = 49d50410cf7467175a841eb7cd0d93d4
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = listener_slapgrid.py.in
download-only = true
mode = 0644
[eggs] [eggs]
recipe = z3c.recipe.scripts recipe = z3c.recipe.scripts
eggs = eggs =
...@@ -152,6 +179,7 @@ eggs = ...@@ -152,6 +179,7 @@ eggs =
slapos.recipe.build slapos.recipe.build
slapos.toolbox[flask_auth] slapos.toolbox[flask_auth]
slapos.core slapos.core
supervisor
xml_marshaller xml_marshaller
Gunicorn Gunicorn
...@@ -171,3 +199,9 @@ eggs = ...@@ -171,3 +199,9 @@ eggs =
xml_marshaller xml_marshaller
pytz pytz
slapos.libnetworkcache slapos.libnetworkcache
[extra-eggs]
recipe = zc.recipe.egg
interpreter = pythonwitheggs
eggs +=
supervisor
...@@ -21,9 +21,12 @@ LoadModule ssl_module modules/mod_ssl.so ...@@ -21,9 +21,12 @@ LoadModule ssl_module modules/mod_ssl.so
LoadModule alias_module modules/mod_alias.so LoadModule alias_module modules/mod_alias.so
LoadModule env_module modules/mod_env.so LoadModule env_module modules/mod_env.so
LoadModule rewrite_module modules/mod_rewrite.so LoadModule rewrite_module modules/mod_rewrite.so
LoadModule headers_module modules/mod_headers.so
LoadModule log_config_module modules/mod_log_config.so LoadModule log_config_module modules/mod_log_config.so
LoadModule dav_module modules/mod_dav.so LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule cache_module modules/mod_cache.so
LoadModule file_cache_module modules/mod_file_cache.so
ErrorLog "{{ parameters.path_error_log }}" ErrorLog "{{ parameters.path_error_log }}"
LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat "%h %l %u %t \"%r\" %>s %b" common
...@@ -71,17 +74,15 @@ Alias /share {{ parameters.runner_home }} ...@@ -71,17 +74,15 @@ Alias /share {{ parameters.runner_home }}
ScriptSock {{ parameters.path_pid }} ScriptSock {{ parameters.path_pid }}
SetEnv GIT_PROJECT_ROOT {{ parameters.project_folder }}
SetEnv GIT_HTTP_EXPORT_ALL SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ {{ parameters.git_http_backend }}/ ScriptAlias /git/ {{ parameters.git_http_backend }}/
ScriptAlias /git-public/ {{ parameters.git_http_backend }}/ ScriptAlias /git-public/ {{ parameters.git_http_backend }}/
RewriteCond %{QUERY_STRING} service=git-receive-pack [OR] RewriteCond %{QUERY_STRING} service=git-receive-pack [OR]
RewriteCond %{REQUEST_URI} /git-receive-pack$ RewriteCond %{REQUEST_URI} /git-receive-pack$
RewriteRule ^/git/ - [E=AUTHREQUIRED:yes]
RewriteRule ^/git-public/ - [E=AUTHREQUIRED:yes]
<LocationMatch "^/git-public/"> <LocationMatch "^/git/">
SetEnv GIT_PROJECT_ROOT:{{- parameters.project_private_folder -}}
Order Deny,Allow Order Deny,Allow
Deny from env=AUTHREQUIRED Deny from env=AUTHREQUIRED
...@@ -89,10 +90,10 @@ RewriteRule ^/git-public/ - [E=AUTHREQUIRED:yes] ...@@ -89,10 +90,10 @@ RewriteRule ^/git-public/ - [E=AUTHREQUIRED:yes]
AuthName "Git Access" AuthName "Git Access"
AuthUserFile "{{ parameters.etc_dir }}/.htpasswd" AuthUserFile "{{ parameters.etc_dir }}/.htpasswd"
Require valid-user Require valid-user
Satisfy any
</LocationMatch> </LocationMatch>
<LocationMatch "^/git/"> <LocationMatch "^/git-public/">
SetEnv GIT_PROJECT_ROOT:{{- parameters.project_public_folder -}}
Order Deny,Allow Order Deny,Allow
Deny from env=AUTHREQUIRED Deny from env=AUTHREQUIRED
...@@ -100,6 +101,7 @@ RewriteRule ^/git-public/ - [E=AUTHREQUIRED:yes] ...@@ -100,6 +101,7 @@ RewriteRule ^/git-public/ - [E=AUTHREQUIRED:yes]
AuthName "Git Access" AuthName "Git Access"
AuthUserFile "{{ parameters.etc_dir }}/.htpasswd" AuthUserFile "{{ parameters.etc_dir }}/.htpasswd"
Require valid-user Require valid-user
Satisfy any
</LocationMatch> </LocationMatch>
include {{ parameters.cgi_httpd_conf }} include {{ parameters.cgi_httpd_conf }}
...@@ -42,7 +42,7 @@ software-url = ${slap-connection:software-release-url} ...@@ -42,7 +42,7 @@ software-url = ${slap-connection:software-release-url}
software-type = resilient software-type = resilient
name = Resilient Instance (Root Instance) name = Resilient Instance (Root Instance)
{% set cluster_parameter_dict = slapparameter_dict.get('cluster', {}) -%} {% set cluster_parameter_dict = slapparameter_dict.get('cluster', {}) -%}
config = resiliency-backup-periodicity {{ cluster_parameter_dict.keys() | join(' ') }} config = resiliency-backup-periodicity resilient-clone-number {{ cluster_parameter_dict.keys() | join(' ') }}
{% for key, value in cluster_parameter_dict.items() -%} {% for key, value in cluster_parameter_dict.items() -%}
config-{{ key }} = {{ dumps(value) }} config-{{ key }} = {{ dumps(value) }}
{% endfor -%} {% endfor -%}
......
...@@ -28,7 +28,7 @@ parts += ...@@ -28,7 +28,7 @@ parts +=
# Bubble up the parameters # Bubble up the parameters
[request-runner] [request-runner]
return = url ssh-public-key ssh-url notification-id ip backend_url url ssh_command access_url 1_info 2_info monitor_url webdav_url public_url return = url ssh-public-key ssh-url notification-id ip backend_url url ssh_command access_url 1_info 2_info monitor_url webdav_url public_url git_public_url git_private_url
[publish-connection-informations] [publish-connection-informations]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
...@@ -41,6 +41,8 @@ ssh_command = ${request-runner:connection-ssh_command} ...@@ -41,6 +41,8 @@ ssh_command = ${request-runner:connection-ssh_command}
monitor_url = ${request-runner:connection-monitor_url} monitor_url = ${request-runner:connection-monitor_url}
webdav_url = ${request-runner:connection-webdav_url} webdav_url = ${request-runner:connection-webdav_url}
public_url = ${request-runner:connection-public_url} public_url = ${request-runner:connection-public_url}
git_public_url = ${request-runner:connection-git_public_url}
git_private_url = ${request-runner:connection-git_private_url}
[slap-parameter] [slap-parameter]
# Default parameters for distributed deployment # Default parameters for distributed deployment
......
...@@ -27,6 +27,7 @@ parts += ...@@ -27,6 +27,7 @@ parts +=
cron-entry-prepare-software cron-entry-prepare-software
deploy-instance-parameters deploy-instance-parameters
minishell-cwd minishell-cwd
supervisord-wrapper
## Monitoring part ## Monitoring part
###Parts to add for monitoring ###Parts to add for monitoring
cron cron
...@@ -45,6 +46,7 @@ parts += ...@@ -45,6 +46,7 @@ parts +=
cgi-httpd-graceful-wrapper cgi-httpd-graceful-wrapper
monitor-promise monitor-promise
monitor-instance-log-access monitor-instance-log-access
bash-profile
## Monitor for runner ## Monitor for runner
monitor-current-log-access monitor-current-log-access
monitor-check-resilient-feed-file monitor-check-resilient-feed-file
......
...@@ -24,6 +24,8 @@ parts += ...@@ -24,6 +24,8 @@ parts +=
cron-entry-prepare-software cron-entry-prepare-software
deploy-instance-parameters deploy-instance-parameters
instance-software-type instance-software-type
bash-profile
supervisord-wrapper
# have to repeat the next one, as it's not inherited from pbsready-import # have to repeat the next one, as it's not inherited from pbsready-import
import-on-notification import-on-notification
## Monitoring part ## Monitoring part
......
...@@ -24,6 +24,9 @@ parts = ...@@ -24,6 +24,9 @@ parts =
deploy-instance-parameters deploy-instance-parameters
instance-software-type instance-software-type
minishell-cwd minishell-cwd
bash-profile
supervisord-wrapper
supervisord-promise
{% if slapparameter_dict.get('custom-frontend-backend-url') %} {% if slapparameter_dict.get('custom-frontend-backend-url') %}
custom-frontend-promise custom-frontend-promise
{% endif %} {% endif %}
...@@ -136,6 +139,8 @@ project-test = $${:test}/project ...@@ -136,6 +139,8 @@ project-test = $${:test}/project
software-test = $${:test}/software software-test = $${:test}/software
instance-test = $${:test}/instance instance-test = $${:test}/instance
sessions = $${buildout:directory}/.sessions sessions = $${buildout:directory}/.sessions
private-project = $${:home}/.git-private
public-project = $${:home}/.git-public
#Create password recovery code for slaprunner #Create password recovery code for slaprunner
[recovery-code] [recovery-code]
...@@ -155,8 +160,7 @@ working-directory = $${runnerdirectory:home} ...@@ -155,8 +160,7 @@ working-directory = $${runnerdirectory:home}
project-directory = $${runnerdirectory:project} project-directory = $${runnerdirectory:project}
instance_root = $${runnerdirectory:instance-root} instance_root = $${runnerdirectory:instance-root}
software_root = $${runnerdirectory:software-root} software_root = $${runnerdirectory:software-root}
#XXX-Nico hardcoded default port because overridden by this buildout config instance-monitor-url = https://[$${:ipv6}]:$${monitor-parameters:port}
instance-monitor-url = https://[$${:ipv6}]:9685
etc_dir = $${directory:etc} etc_dir = $${directory:etc}
log_dir = $${directory:log} log_dir = $${directory:log}
run_dir = $${directory:run} run_dir = $${directory:run}
...@@ -173,6 +177,7 @@ wrapper = $${directory:services}/slaprunner ...@@ -173,6 +177,7 @@ wrapper = $${directory:services}/slaprunner
debug = $${slap-parameter:debug} debug = $${slap-parameter:debug}
access-url = https://[$${:ipv6}]:$${:runner_port} access-url = https://[$${:ipv6}]:$${:runner_port}
supervisord_config = $${directory:etc}/supervisord.conf supervisord_config = $${directory:etc}/supervisord.conf
supervisord_server = http://$${supervisord:server}
proxy_database = $${slaprunner:working-directory}/proxy.db proxy_database = $${slaprunner:working-directory}/proxy.db
console = False console = False
verbose = False verbose = False
...@@ -183,6 +188,8 @@ autorun = $${slap-parameter:autorun} ...@@ -183,6 +188,8 @@ autorun = $${slap-parameter:autorun}
knowledge0_file = $${buildout:directory}/$${public:filename} knowledge0_file = $${buildout:directory}/$${public:filename}
minishell_cwd_file = $${directory:etc}/.minishell-cwd minishell_cwd_file = $${directory:etc}/.minishell-cwd
minishell_history_file = $${directory:etc}/.minishell_history minishell_history_file = $${directory:etc}/.minishell_history
software_info_json = $${runnerdirectory:home}/software_info.json
instance_info_json = $${runnerdirectory:home}/instance_info.json
[test-runner] [test-runner]
<= slaprunner <= slaprunner
...@@ -219,7 +226,7 @@ keygen-binary = ${dropbear:location}/bin/dropbearkey ...@@ -219,7 +226,7 @@ keygen-binary = ${dropbear:location}/bin/dropbearkey
recipe = slapos.cookbook:dropbear recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6} host = $${slap-network-information:global-ipv6}
port = 22222 port = 22222
home = $${directory:ssh} home = $${buildout:directory}
wrapper = $${directory:bin}/runner_sshd wrapper = $${directory:bin}/runner_sshd
shell = ${bash:location}/bin/bash shell = ${bash:location}/bin/bash
rsa-keyfile = $${directory:ssh}/server_key.rsa rsa-keyfile = $${directory:ssh}/server_key.rsa
...@@ -316,6 +323,8 @@ dav_lock = $${directory:var}/DavLock ...@@ -316,6 +323,8 @@ dav_lock = $${directory:var}/DavLock
etc_dir = $${directory:etc} etc_dir = $${directory:etc}
var_dir = $${directory:var} var_dir = $${directory:var}
project_folder = $${directory:project} project_folder = $${directory:project}
project_private_folder = $${runnerdirectory:private-project}
project_public_folder = $${runnerdirectory:public-project}
runner_home = $${runnerdirectory:home} runner_home = $${runnerdirectory:home}
git_http_backend = ${git:location}/libexec/git-core/git-http-backend git_http_backend = ${git:location}/libexec/git-core/git-http-backend
cgi_httpd_conf = $${monitor-httpd-configuration-file:rendered} cgi_httpd_conf = $${monitor-httpd-configuration-file:rendered}
...@@ -351,6 +360,7 @@ error-log-file = gunicorn-error.log ...@@ -351,6 +360,7 @@ error-log-file = gunicorn-error.log
wrapper-path = $${gunicorn:bin_launcher} wrapper-path = $${gunicorn:bin_launcher}
environment = PATH=$${environ:PATH}:${git:location}/bin/ environment = PATH=$${environ:PATH}:${git:location}/bin/
RUNNER_CONFIG=$${slaprunner:slapos.cfg} RUNNER_CONFIG=$${slaprunner:slapos.cfg}
LANG=en_GB.UTF-8
[gunicorn-graceful] [gunicorn-graceful]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
...@@ -459,6 +469,7 @@ path = $${directory:promises}/slaprunner_frontend ...@@ -459,6 +469,7 @@ path = $${directory:promises}/slaprunner_frontend
url = https://$${request-frontend:connection-domain}/login url = https://$${request-frontend:connection-domain}/login
dash_path = ${dash:location}/bin/dash dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl curl_path = ${curl:location}/bin/curl
check-secure = 1
[dropbear-promise] [dropbear-promise]
recipe = slapos.cookbook:check_port_listening recipe = slapos.cookbook:check_port_listening
...@@ -570,7 +581,7 @@ command = $${prepare-software:wrapper-path} ...@@ -570,7 +581,7 @@ command = $${prepare-software:wrapper-path}
[instance-parameters] [instance-parameters]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do extensions = jinja2.ext.do
template = ${parameters-template:location}/${parameters-template:filename} template = ${template-parameters:location}/${template-parameters:filename}
rendered = $${directory:etc}/.parameter.xml.default rendered = $${directory:etc}/.parameter.xml.default
mode = 0644 mode = 0644
context = context =
...@@ -610,6 +621,78 @@ command = if [ ! -f $${slaprunner:minishell_cwd_file} ]; then echo $${runnerdire ...@@ -610,6 +621,78 @@ command = if [ ! -f $${slaprunner:minishell_cwd_file} ]; then echo $${runnerdire
location = $${slaprunner:minishell_cwd_file} location = $${slaprunner:minishell_cwd_file}
stop-on-error = true stop-on-error = true
[bash-profile]
recipe = slapos.recipe.template:jinja2
template = ${template-bash-profile:location}/${template-bash-profile:filename}
rendered = $${buildout:directory}/.bash_profile
context =
raw path $PATH:${nano:location}/bin:${vim:location}/bin:${screen:location}/bin:${git:location}/bin:${curl:location}/bin:${python2.7:location}/bin
key workdir runnerdirectory:home
[supervisord]
autorestart = false
autostart = false
directory = $${buildout:directory}
exitcodes = 0
logfile = $${directory:log}/supervisord.log
no_logfile = NONE
numprocs = 1
path = $${environ:PATH}
pidfile = $${directory:run}/supervisord.pid
server = $${slaprunner:ipv4}:$${:port}
port = 39986
slapgrid-cp = slapgrid-cp
slapgrid-cp-command = $${slaprunner:slapos} node instance --all --cfg $${slaprunner:slapos.cfg} --pidfile $${:slapgrid-cp-pid} --verbose --logfile $${:slapgrid-cp-log}
slapgrid-cp-log = $${runnerdirectory:home}/instance.log
slapgrid-cp-pid = $${directory:run}/slapgrid-cp.pid
slapgrid-cp-startretries = 0
slapgrid-sr = slapgrid-sr
slapgrid-sr-command = $${slaprunner:slapos} node software --all --cfg $${slaprunner:slapos.cfg} --pidfile $${:slapgrid-sr-pid} --verbose --logfile $${:slapgrid-sr-log}
slapgrid-sr-log = $${runnerdirectory:home}/software.log
slapgrid-sr-pid = $${directory:run}/slapgrid-sr.pid
slapgrid-sr-startretries = 0
slapproxy = slapproxy
slapproxy-autorestart = true
slapproxy-autostart = true
slapproxy-startsecs = 1
slapproxy-command = $${slaprunner:slapos} proxy start --logfile $${:slapproxy-log} --cfg $${slaprunner:slapos.cfg}
slapproxy-log = $${directory:log}/slapproxy.log
socket_name = unix://$${:socket_path}
socket_path = $${directory:tmp}/supervisord.sock
startsecs = 0
# This file logs errors from listeners. Supervisord has its own logfile.
# Processes should handle their logs by themselves
stderr_logfile = $${directory:log}/supervisord-errors.log
[supervisord-conf]
recipe = slapos.recipe.template:jinja2
template = ${template-supervisord:location}/${template-supervisord:filename}
rendered = $${directory:etc}/supervisord.conf
context =
section supervisord supervisord
key listener_slapgrid listener-slapgrid-bin:rendered
[listener-slapgrid-bin]
recipe = slapos.recipe.template:jinja2
template = ${template-listener-slapgrid:location}/${template-listener-slapgrid:filename}
rendered = $${directory:bin}/listener_slapgrid.py
mode = 0744
context =
section supervisord supervisord
section slaprunner slaprunner
raw python_executable ${buildout:directory}/bin/${extra-eggs:interpreter}
[supervisord-wrapper]
recipe = slapos.cookbook:wrapper
command-line = $${buildout:directory}/bin/supervisord -c $${supervisord-conf:rendered} --nodaemon
wrapper-path = $${directory:services}/supervisord
[supervisord-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/supervisord
hostname = $${slaprunner:ipv4}
port = $${supervisord:port}
[monitor-current-log-access] [monitor-current-log-access]
< = monitor-directory-access < = monitor-directory-access
source = $${directory:log} source = $${directory:log}
...@@ -21,9 +21,12 @@ gunicorn = 19.1.0 ...@@ -21,9 +21,12 @@ gunicorn = 19.1.0
plone.recipe.command = 1.1 plone.recipe.command = 1.1
pycrypto = 2.6.1 pycrypto = 2.6.1
rdiff-backup = 1.0.5 rdiff-backup = 1.0.5
slapos.core = 1.0.5
slapos.recipe.build = 0.12 slapos.recipe.build = 0.12
slapos.recipe.download = 1.0.dev-r4053 slapos.recipe.download = 1.0.dev-r4053
slapos.toolbox = 0.39.3 slapos.toolbox = 0.40.1
slapos.recipe.template = 2.5
supervisor = 3.1.1
smmap = 0.8.2 smmap = 0.8.2
z3c.recipe.scripts = 1.0.1 z3c.recipe.scripts = 1.0.1
...@@ -46,3 +49,5 @@ feedparser = 5.1.3 ...@@ -46,3 +49,5 @@ feedparser = 5.1.3
# Required by: # Required by:
# slapos.toolbox==0.39.3 # slapos.toolbox==0.39.3
paramiko = 1.14.1 paramiko = 1.14.1
Jinja2 = 2.7.3
# Beware, this file is automatically processed by slapgrid
# Do not modify it, your changes will be lost
# If you want to load your custom bash configuration, please use a .bashrc file
cd {{ workdir }}
export PATH={{- path }}
export PS1="\w $ "
export LANG="en_GB.UTF-8"
#!{{ python_executable }}
import datetime
import json
import sys
import xmlrpclib
from supervisor import childutils
def write_stdout(s):
sys.stdout.write(s)
sys.stdout.flush()
def write_stderr(s):
sys.stderr.write(s)
sys.stderr.flush()
def write_slapgrid_result(process):
server = xmlrpclib.Server("http://{{- supervisord['server'] -}}")
# Tuple of tuples containing 2 elements : process name and the path of its info file
json_files = dict([("slapgrid-sr", "{{- slaprunner['software_info_json'] -}}"),
("slapgrid-cp", "{{- slaprunner['instance_info_json'] -}}")])
info = server.supervisor.getProcessInfo(process)
result = dict()
result['last_build'] = datetime.datetime.fromtimestamp(info['stop']).strftime("%Y-%m-%d %H:%M:%S")
result['success'] = info['exitstatus']
open(json_files[process], 'w').write(json.dumps(result))
def main():
while 1:
headers, payload = writer.wait()
try:
processname = dict(x.split(':') for x in payload.split())['processname']
write_slapgrid_result(processname)
except:
pass
writer.ok()
if __name__ == '__main__':
writer = childutils.EventListenerProtocol()
main()
...@@ -15,6 +15,7 @@ slapos_cfg = {{ slaprunner['slapos.cfg'] }} ...@@ -15,6 +15,7 @@ slapos_cfg = {{ slaprunner['slapos.cfg'] }}
slapproxy = {{ slaprunner['slapproxy'] }} slapproxy = {{ slaprunner['slapproxy'] }}
supervisor = {{ slaprunner['supervisor'] }} supervisor = {{ slaprunner['supervisor'] }}
supervisord_config = {{ slaprunner['supervisord_config'] }} supervisord_config = {{ slaprunner['supervisord_config'] }}
supervisord_server = {{ slaprunner['supervisord_server'] }}
runner_workdir = {{ slaprunner['working-directory'] }} runner_workdir = {{ slaprunner['working-directory'] }}
runner_host = {{ slaprunner['ipv4'] }} runner_host = {{ slaprunner['ipv4'] }}
runner_port = {{ slaprunner['runner_port'] }} runner_port = {{ slaprunner['runner_port'] }}
......
[unix_http_server]
file = {{ supervisord['socket_path'] }}
[supervisorctl]
serverurl = {{ supervisord['socket_name'] }}
[inet_http_server]
port = {{ supervisord['server'] }}
[supervisord]
logfile = {{ supervisord['logfile'] }}
pidfile = {{ supervisord['pidfile'] }}
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[program:{{- supervisord['slapgrid-sr'] -}}]
command = {{ supervisord['slapgrid-sr-command'] }}
process_name = {{ supervisord['slapgrid-sr'] }}
numprocs = {{ supervisord['numprocs'] }}
autostart = {{ supervisord['autostart'] }}
exitcodes = {{ supervisord['exitcodes'] }}
startretries = {{ supervisord['slapgrid-sr-startretries'] }}
startsecs = {{ supervisord['startsecs'] }}
autorestart = {{ supervisord['autorestart'] }}
stdout_logfile = {{ supervisord['no_logfile'] }}
stderr_logfile = {{ supervisord['no_logfile'] }}
directory = {{ supervisord['directory'] }}
environment = PATH="{{- supervisord['path'] -}}"
[program:{{- supervisord['slapgrid-cp'] -}}]
command = {{ supervisord['slapgrid-cp-command'] }}
process_name = {{ supervisord['slapgrid-cp'] }}
numprocs = {{ supervisord['numprocs'] }}
autostart = {{ supervisord['autostart'] }}
exitcodes = {{ supervisord['exitcodes'] }}
startretries = {{ supervisord['slapgrid-cp-startretries'] }}
startsecs = {{ supervisord['startsecs'] }}
autorestart = {{ supervisord['autorestart'] }}
stdout_logfile = {{ supervisord['no_logfile'] }}
stderr_logfile = {{ supervisord['no_logfile'] }}
directory = {{ supervisord['directory'] }}
environment = PATH="{{- supervisord['path'] -}}"
[program:{{- supervisord['slapproxy'] -}}]
command = {{ supervisord['slapproxy-command'] }}
process_name = {{ supervisord['slapproxy'] }}
numprocs = {{ supervisord['numprocs'] }}
autostart = {{ supervisord['slapproxy-autostart'] }}
startsecs = {{ supervisord['slapproxy-startsecs'] }}
exitcodes = {{ supervisord['exitcodes'] }}
autorestart = {{ supervisord['slapproxy-autorestart'] }}
stdout_logfile = {{ supervisord['no_logfile'] }}
stderr_logfile = {{ supervisord['no_logfile'] }}
directory = {{ supervisord['directory'] }}
environment = PATH="{{- supervisord['path'] -}}"
[eventlistener:listener-slapgrid]
command = {{ listener_slapgrid }}
events = PROCESS_STATE_EXITED
stdout_logfile = {{ supervisord['no_logfile'] }}
stderr_logfile = {{ supervisord['stderr_logfile'] }}
...@@ -49,7 +49,7 @@ recipe = hexagonit.recipe.download ...@@ -49,7 +49,7 @@ recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:filename}
download-only = true download-only = true
md5sum = cb2f15850d3dc82459a0044adb4416cf md5sum = cb2f15850d3dc82459a0044adb4416cf
destination = ${buildout:directory}/parts/monitor-template-monitor-bin destination = ${buildout:parts-directory}/monitor-template-monitor-bin
filename = monitor.py.in filename = monitor.py.in
mode = 0644 mode = 0644
...@@ -66,7 +66,7 @@ recipe = hexagonit.recipe.download ...@@ -66,7 +66,7 @@ recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename} url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true download-only = true
md5sum = e759977b21c70213daa4c2701f2c2078 md5sum = e759977b21c70213daa4c2701f2c2078
destination = ${buildout:directory}/parts/monitor-index destination = ${buildout:parts-directory}/monitor-index
filename = index.cgi.in filename = index.cgi.in
mode = 0644 mode = 0644
...@@ -74,7 +74,7 @@ mode = 0644 ...@@ -74,7 +74,7 @@ mode = 0644
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename} url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true download-only = true
destination = ${buildout:directory}/parts/monitor-template-index destination = ${buildout:parts-directory}/monitor-template-index
md5sum = 7400c8cfa16a15a0d41f512b8bbb1581 md5sum = 7400c8cfa16a15a0d41f512b8bbb1581
filename = index.html.jinja2 filename = index.html.jinja2
mode = 0644 mode = 0644
...@@ -84,7 +84,7 @@ recipe = hexagonit.recipe.download ...@@ -84,7 +84,7 @@ recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename} url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true download-only = true
md5sum = e43d79bec8824265e22df7960744113a md5sum = e43d79bec8824265e22df7960744113a
destination = ${buildout:directory}/parts/monitor-template-status-cgi destination = ${buildout:parts-directory}/monitor-template-status-cgi
filename = status.cgi.in filename = status.cgi.in
mode = 0644 mode = 0644
...@@ -93,7 +93,7 @@ recipe = hexagonit.recipe.download ...@@ -93,7 +93,7 @@ recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename} url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true download-only = true
#md5sum = 4fb26753ee669b8ac90ffe33dbd12e8f #md5sum = 4fb26753ee669b8ac90ffe33dbd12e8f
destination = ${buildout:directory}/parts/monitor-template-status-history-cgi destination = ${buildout:parts-directory}/monitor-template-status-history-cgi
filename = status-history.cgi.in filename = status-history.cgi.in
mode = 0644 mode = 0644
...@@ -102,7 +102,7 @@ recipe = hexagonit.recipe.download ...@@ -102,7 +102,7 @@ recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename} url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true download-only = true
md5sum = b4cef123a3273e848e8fe496e22b20a8 md5sum = b4cef123a3273e848e8fe496e22b20a8
destination = ${buildout:directory}/parts/monitor-template-settings-cgi destination = ${buildout:parts-directory}/monitor-template-settings-cgi
filename = settings.cgi.in filename = settings.cgi.in
mode = 0644 mode = 0644
...@@ -111,7 +111,7 @@ recipe = hexagonit.recipe.download ...@@ -111,7 +111,7 @@ recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename} url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true download-only = true
md5sum = c7ba7ecb09d0d1d24e7cb73a212cc33f md5sum = c7ba7ecb09d0d1d24e7cb73a212cc33f
destination = ${buildout:directory}/parts/monitor-template-monitor-password-cgi destination = ${buildout:parts-directory}/monitor-template-monitor-password-cgi
filename = monitor-password.cgi.in filename = monitor-password.cgi.in
mode = 0644 mode = 0644
...@@ -120,7 +120,7 @@ recipe = hexagonit.recipe.download ...@@ -120,7 +120,7 @@ recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:filename}
download-only = true download-only = true
md5sum = 5f1b93ccdea7c3031aef396154c64938 md5sum = 5f1b93ccdea7c3031aef396154c64938
destination = ${buildout:directory}/parts/monitor-template-rss-bin destination = ${buildout:parts-directory}/monitor-template-rss-bin
filename = status2rss.py filename = status2rss.py
mode = 0644 mode = 0644
...@@ -136,7 +136,7 @@ recipe = hexagonit.recipe.download ...@@ -136,7 +136,7 @@ recipe = hexagonit.recipe.download
url = http://git.erp5.org/gitweb/slapos.git/snapshot/930be99041ea26b7b1186830e5eb56ef0acc1bdf.tar.gz url = http://git.erp5.org/gitweb/slapos.git/snapshot/930be99041ea26b7b1186830e5eb56ef0acc1bdf.tar.gz
download-only = false download-only = false
filename = monitor-static.tar.gz filename = monitor-static.tar.gz
destination = ${buildout:directory}/parts/monitor-static-files destination = ${buildout:parts-directory}/monitor-static-files
ignore-existing = true ignore-existing = true
strip-top-level-dir = true strip-top-level-dir = true
mode = 0644 mode = 0644
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment