diff --git a/stack/boinc/buildout.cfg b/stack/boinc/buildout.cfg new file mode 100644 index 0000000000000000000000000000000000000000..73e02223f55e2318b517857e2f1218d65d2b8edd --- /dev/null +++ b/stack/boinc/buildout.cfg @@ -0,0 +1,59 @@ +[buildout] + +parts = + slapos-cookbook + instance-egg + apache-php + template-mariadb + template-boinc + template + boinc-configuration + +extends = + ../../component/boinc/buildout.cfg + ../../component/mysql-python/buildout.cfg + ../../component/gzip/buildout.cfg + ../../component/apache/buildout.cfg + ../../component/apache-php/buildout.cfg + ../../component/mariadb/buildout.cfg + ../../component/dash/buildout.cfg + ../../component/logrotate/buildout.cfg + ../../component/lxml-python/buildout.cfg + ../../component/stunnel/buildout.cfg + ../../component/dcron/buildout.cfg + ../slapos.cfg + +[instance-egg] +recipe = zc.recipe.egg +eggs = + ${mysql-python:egg} + slapos.toolbox + +[template] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/instance.cfg +output = ${buildout:directory}/template.cfg +mode = 0644 +md5sum = 4a286795a6822ee6d53743191d5374a6 + +#Because Boinc deamon and Boinc sheduler(with apache) work side by side, we deploy +#Boinc and apache-php in the same partition. +[template-boinc] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/instance-boinc.cfg +output = ${buildout:directory}/template-boinc.cfg +md5sum = f026a82512ac5f9b486e617e5bf392be +mode = 0644 + +#Template for deploying MySQL Database Server +[template-mariadb] +recipe = slapos.recipe.template +url = ${:_profile_base_location_}/instance-mariadb.cfg +output = ${buildout:directory}/template-mariadb.cfg +md5sum = 4d9907f27910533959e8e56c8438b84a +mode = 0644 + +#default Configuration for boinc project +[boinc-configuration] +dbname = boinctest +project = boinc_test \ No newline at end of file diff --git a/stack/boinc/instance-boinc.cfg b/stack/boinc/instance-boinc.cfg new file mode 100644 index 0000000000000000000000000000000000000000..86bb369985d32ed01e16e7b2707f32dd02bb7a99 --- /dev/null +++ b/stack/boinc/instance-boinc.cfg @@ -0,0 +1,325 @@ +[buildout] + +parts = + boinc-server + certificate-authority + ca-stunnel + logrotate + logrotate-entry-apache + logrotate-entry-stunnel + cron + cron-entry-logrotate + promise + slapmonitor + slapreport + frontend-promise + publish-connection-informations + +eggs-directory = ${buildout:eggs-directory} +develop-eggs-directory = ${buildout:develop-eggs-directory} +offline = true + + +# Creation of all needed directories +[rootdirectory] +recipe = slapos.cookbook:mkdirectory +etc = $${buildout:directory}/etc/ +var = $${buildout:directory}/var/ +srv = $${buildout:directory}/srv/ +bin = $${buildout:directory}/bin/ +tmp = $${buildout:directory}/tmp/ +project = $${buildout:directory}/projects/ + +[basedirectory] +recipe = slapos.cookbook:mkdirectory +log = $${rootdirectory:var}/log/ +services = $${rootdirectory:etc}/run/ +run = $${rootdirectory:var}/run/ +backup = $${rootdirectory:srv}/backup/ +promises = $${rootdirectory:etc}/promise/ +application = $${rootdirectory:tmp}/application + +[directory] +recipe = slapos.cookbook:mkdirectory +ca-dir = $${rootdirectory:srv}/ssl/ +httpd-log = $${basedirectory:log}/apache/ +php-ini-dir = $${rootdirectory:etc}/php/ +tmp-php = $${rootdirectory:tmp}/php/ +logrotate-entries = $${rootdirectory:etc}/logrotate.d/ +logrotate-backup = $${basedirectory:backup}/logrotate/ +stunnel-conf = $${rootdirectory:etc}/stunnel/ +cronstamps = $${rootdirectory:etc}/cronstamps/ +cron-entries = $${rootdirectory:etc}/cron.d/ +crontabs = $${rootdirectory:etc}/crontabs/ + +[cadirectory] +recipe = slapos.cookbook:mkdirectory +requests = $${directory:ca-dir}/requests/ +private = $${directory:ca-dir}/private/ +certs = $${directory:ca-dir}/certs/ +newcerts = $${directory:ca-dir}/newcerts/ +crl = $${directory:ca-dir}/crl/ + + +# Deploy stunnel +[stunnel] +recipe = slapos.cookbook:stunnel +client = true +stunnel-binary = ${stunnel:location}/bin/stunnel +remote-host = $${mariadb-urlparse:host} +remote-port = $${mariadb-urlparse:port} +local-host = $${slap-network-information:local-ipv4} +local-port = 33060 +log-file = $${basedirectory:log}/stunnel.log +config-file = $${directory:stunnel-conf}/stunnel.conf +key-file = $${directory:stunnel-conf}/stunnel.key +cert-file = $${directory:stunnel-conf}/stunnel.crt +pid-file = $${basedirectory:run}/stunnel.pid +wrapper = $${rootdirectory:bin}/raw_stunnel +post-rotate-script = $${rootdirectory:bin}/stunnel_post_rotate + + +# Certificate stuffs +[certificate-authority] +recipe = slapos.cookbook:certificate_authority +openssl-binary = ${openssl:location}/bin/openssl +ca-dir = $${directory:ca-dir} +requests-directory = $${cadirectory:requests} +wrapper = $${basedirectory:services}/ca +ca-private = $${cadirectory:private} +ca-certs = $${cadirectory:certs} +ca-newcerts = $${cadirectory:newcerts} +ca-crl = $${cadirectory:crl} + +[ca-stunnel] +<= certificate-authority +recipe = slapos.cookbook:certificate_authority.request +executable = $${stunnel:wrapper} +wrapper = $${basedirectory:services}/stunnel +key-file = $${stunnel:key-file} +cert-file = $${stunnel:cert-file} + + +# Request MariaDB instance and parse its URL +[request-mariadb] +<= slap-connection +recipe = slapos.cookbook:request +name = MariaDB +software-url = $${slap-connection:software-release-url} +software-type = mariadb +return = url + +[mariadb-urlparse] +recipe = slapos.cookbook:urlparse +url = $${request-mariadb:connection-url} + + +# Deploy Apache + PHP application +[apache-php] +recipe = slapos.cookbook:apachephp +source = $${basedirectory:application} + +htdocs = $${rootdirectory:srv}/www/ +pid-file = $${basedirectory:run}/apache.pid +lock-file = $${basedirectory:run}/apache.lock +ip = $${slap-network-information:global-ipv6} +port = 8080 +url = http://[$${:ip}]:$${:port}/ +error-log = $${directory:httpd-log}/error.log +access-log = $${directory:httpd-log}/access.log +php-ini-dir = $${directory:php-ini-dir} +tmp-dir = $${directory:tmp-php} +httpd-conf = $${rootdirectory:etc}/apache.conf +wrapper = $${basedirectory:services}/apache + +httpd-binary = ${apache:location}/bin/httpd + +mysql-username = $${mariadb-urlparse:username} +mysql-password = $${mariadb-urlparse:password} +mysql-database = $${mariadb-urlparse:path} +mysql-host = $${stunnel:local-host} +mysql-port = $${stunnel:local-port} + +template = +configuration = + +#Create password recovery code for slaprunner +[boinc-passwd] +recipe = slapos.cookbook:generate.password +storage-path = $${rootdirectory:etc}/.boincpasswd +bytes = 4 + +#deploy boinc server instance now +#Boinc server depend on apache-php instance +[boinc-server] +recipe = slapos.cookbook:boinc +home = $${buildout:directory} +project = ${boinc-configuration:project} +project-config = $${:home}/.$${:project}.conf +boinc-httpd-conf = $${rootdirectory:etc}/apache_boinc.conf +boinc = ${boinc:location} +installroot = $${rootdirectory:project}/${boinc-configuration:project} +wrapper-dir = $${basedirectory:services} +source = ${boinc:source} +passwd = $${boinc-passwd:storage-path} +#Manualy add develop-egg and boinc-egg to pythonpath +develop-egg = ${buildout:develop-eggs-directory} + +#Other binary path +svn-binary = ${subversion:location}/bin +python-binary = ${buildout:executable} +perl-binary = ${perl:location}/bin + +#Apache and php +www-data = $${apache-php:htdocs} +ip = $${apache-php:ip} +port = $${apache-php:port} +httpd-conf = $${apache-php:httpd-conf} +apache-bin = ${apache:location}/bin/httpd +apache-wrapper = $${apache-php:wrapper} +htpasswd = ${apache:location}/bin/htpasswd +php-ini = $${apache-php:php-ini-dir}/php.ini +php-bin = ${apache-php:location}/bin/php +php-wrapper = $${rootdirectory:bin}php + +#Mysql Informations +mysql-username = $${mariadb-urlparse:username} +mysql-password = $${mariadb-urlparse:password} +mysql-database = $${mariadb-urlparse:path} +mysql-host = $${stunnel:local-host} +mysql-port = $${stunnel:local-port} + +#This value is return by boinc recipe. use it to configure cron +#cronjob = + +# Deploy logrotate, cron, configure it +[logrotate] +recipe = slapos.cookbook:logrotate +# Binaries +logrotate-binary = ${logrotate:location}/usr/sbin/logrotate +gzip-binary = ${gzip:location}/bin/gzip +gunzip-binary = ${gzip:location}/bin/gunzip +# Directories +wrapper = $${rootdirectory:bin}/logrotate +conf = $${rootdirectory:etc}/logrotate.conf +logrotate-entries = $${directory:logrotate-entries} +backup = $${directory:logrotate-backup} +state-file = $${rootdirectory:srv}/logrotate.status + +[logrotate-entry-apache] +<= logrotate +recipe = slapos.cookbook:logrotate.d +name = apache +log = $${apache-php:error-log} $${apache-php:access-log} +frequency = daily +rotate-num = 30 +sharedscripts = true +notifempty = true +create = true + +[logrotate-entry-stunnel] +<= logrotate +recipe = slapos.cookbook:logrotate.d +name = stunnel +log = $${stunnel:log-file} +frequency = daily +rotate-num = 30 +notifempty = true +create = true +post = $${stunnel:post-rotate-script} + +[cron-simplelogger] +recipe = slapos.cookbook:simplelogger +wrapper = $${rootdirectory:bin}/cron_simplelogger +log = $${basedirectory:log}/crond.log + +[cron] +recipe = slapos.cookbook:cron +dcrond-binary = ${dcron:location}/sbin/crond +cron-entries = $${directory:cron-entries} +crontabs = $${directory:crontabs} +cronstamps = $${directory:cronstamps} +catcher = $${cron-simplelogger:wrapper} +binary = $${basedirectory:services}/crond + +[cron-entry-logrotate] +<= cron +recipe = slapos.cookbook:cron.d +name = logrotate +frequency = 0 0 * * * +command = $${logrotate:wrapper} + + +# Request frontend +[request-frontend] +<= slap-connection +recipe = slapos.cookbook:requestoptional +name = Frontend +# XXX We have hardcoded SR URL here. +software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg +slave = true +config = url custom_domain +config-url = http://[$${apache-php:ip}]:$${apache-php:port}/ +return = site_url +config-custom_domain = $${slap-parameter:domain} + + +# Deploy slapmonitor +[slapmonitor] +recipe = slapos.cookbook:slapmonitor +pid-file = $${basedirectory:run}/apache.pid +database-path = $${basedirectory:log}/slapmonitor.db +shell-path = ${dash:location}/bin/dash +slapmonitor-path = ${buildout:bin-directory}/slapmonitor +path = $${basedirectory:services}/slapmonitor + +[slapreport] +recipe = slapos.cookbook:slapreport +pid-file = $${basedirectory:run}/apache.pid +database-path = $${basedirectory:log}/slapmonitor.db +consumption-log-path = $${basedirectory:log}/instance_consumption.log +logbox-ip = 87.98.152.12 +logbox-port = 5122 +logbox-user = admin +logbox-passwd = passer +shell-path = ${dash:location}/bin/dash +slapreport-path = ${buildout:bin-directory}/slapreport +path = $${basedirectory:services}/slapreport + + +# Publish all instance parameters (url of instance) +[publish-connection-informations] +recipe = slapos.cookbook:publish +backend_url = $${apache-php:url} +url = $${request-frontend:connection-site_url} +admin_page = $${boinc-server:admin_page} +home_page = $${boinc-server:home_page} +user = $${boinc-server:user} +passwd = $${boinc-passwd:passwd} + + +# Deploy promises scripts +[promise] +recipe = slapos.cookbook:check_port_listening +path = $${basedirectory:promises}/apache +hostname = $${apache-php:ip} +port = $${apache-php:port} + +[frontend-promise] +recipe = slapos.cookbook:check_url_available +path = $${basedirectory:promises}/frontend +url = $${request-frontend:connection-site_url} +dash_path = ${dash:location}/bin/dash +curl_path = ${curl:location}/bin/curl + + +[slap-parameter] +#Default value for instance deployment type. If user want to 'erase' previous project instance or to 'update'(install) +request-mode = update +# Default value if no domain is specified +domain = +# Default value if no ssh parameter is specified +logbox-ip = +logbox-port = +logbox-user = +logbox-passwd = diff --git a/stack/boinc/instance-mariadb.cfg b/stack/boinc/instance-mariadb.cfg new file mode 100644 index 0000000000000000000000000000000000000000..a1ec62dc3a235c071c7236a7c8e53441098edf2f --- /dev/null +++ b/stack/boinc/instance-mariadb.cfg @@ -0,0 +1,217 @@ +[buildout] +parts = + urls + mariadb + stunnel + certificate-authority + ca-stunnel + logrotate + logrotate-entry-mariadb + logrotate-entry-stunnel + logrotate-entry-cron + cron + cron-entry-logrotate + slapmonitor + slapreport + +gzip-binary = ${gzip:location}/bin/gzip + +eggs-directory = ${buildout:eggs-directory} +develop-eggs-directory = ${buildout:develop-eggs-directory} +offline = true + +[rootdirectory] +recipe = slapos.cookbook:mkdirectory +etc = $${buildout:directory}/etc/ +var = $${buildout:directory}/var/ +srv = $${buildout:directory}/srv/ +bin = $${buildout:directory}/bin/ + +[basedirectory] +recipe = slapos.cookbook:mkdirectory +log = $${rootdirectory:var}/log/ +services = $${rootdirectory:etc}/run/ +run = $${rootdirectory:var}/run/ +backup = $${rootdirectory:srv}/backup/ +promises = $${rootdirectory:etc}/promise/ + +[directory] +recipe = slapos.cookbook:mkdirectory +cron-entries = $${rootdirectory:etc}/cron.d/ +crontabs = $${rootdirectory:etc}/crontabs/ +cronstamps = $${rootdirectory:etc}/cronstamps/ +ca-dir = $${rootdirectory:srv}/ssl/ +mariadb-data = $${rootdirectory:srv}/mariadb/ +logrotate-backup = $${basedirectory:backup}/logrotate/ +stunnel-conf = $${rootdirectory:etc}/stunnel/ +logrotate-entries = $${rootdirectory:etc}/logrotate.d/ + +[urls] +recipe = slapos.cookbook:publish +url = mysqls://$${mariadb:user}:$${mariadb:password}@[$${stunnel:remote-host}]:$${stunnel:remote-port}/$${mariadb:database} + +[mariadb] +recipe = slapos.cookbook:mysql + +# Options +recovering = false +user = user +port = 3306 +ip = $${slap-network-information:local-ipv4} +database = ${boinc-configuration:dbname} + +# Paths +wrapper = $${basedirectory:services}/mariadb +update-wrapper = $${basedirectory:services}/mariadb_update +logrotate-post = $${rootdirectory:bin}/mariadb_post_logrotate +data-directory = $${directory:mariadb-data} +pid-file = $${basedirectory:run}/mariadb.pid +socket = $${basedirectory:run}/mariadb.sock +error-log = $${basedirectory:log}/mariadb_error.log +conf-file = $${rootdirectory:etc}/mariadb.cnf +promise = $${basedirectory:promises}/mysql + +# Binary information +mysql-base-directory = ${mariadb:location} +mysql-binary = ${mariadb:location}/bin/mysql +mysql-install-binary = ${mariadb:location}/scripts/mysql_install_db +mysql-upgrade-binary = ${mariadb:location}/bin/mysql_upgrade +mysqld-binary = ${mariadb:location}/bin/mysqld + +[slapmonitor] +recipe = slapos.cookbook:slapmonitor +pid-file = $${basedirectory:run}/mariadb.pid +database-path = $${basedirectory:log}/slapmonitor.db +shell-path = ${dash:location}/bin/dash +slapmonitor-path = ${buildout:bin-directory}/slapmonitor +path = $${basedirectory:services}/slapmonitor + +[slapreport] +recipe = slapos.cookbook:slapreport +pid-file = $${basedirectory:run}/mariadb.pid +consumption-log-path = $${basedirectory:log}/instance_consumption.log +database-path = $${basedirectory:log}/slapmonitor.db +logbox-ip = 87.98.152.12 +logbox-port = 5122 +logbox-user = admin +logbox-passwd = passer +shell-path = ${dash:location}/bin/dash +slapreport-path = ${buildout:bin-directory}/slapreport +path = $${basedirectory:services}/slapreport + +[certificate-authority] +recipe = slapos.cookbook:certificate_authority +openssl-binary = ${openssl:location}/bin/openssl +ca-dir = $${directory:ca-dir} +requests-directory = $${cadirectory:requests} +wrapper = $${basedirectory:services}/ca +ca-private = $${cadirectory:private} +ca-certs = $${cadirectory:certs} +ca-newcerts = $${cadirectory:newcerts} +ca-crl = $${cadirectory:crl} + +[cadirectory] +recipe = slapos.cookbook:mkdirectory +requests = $${directory:ca-dir}/requests/ +private = $${directory:ca-dir}/private/ +certs = $${directory:ca-dir}/certs/ +newcerts = $${directory:ca-dir}/newcerts/ +crl = $${directory:ca-dir}/crl/ + +[ca-stunnel] +<= certificate-authority +recipe = slapos.cookbook:certificate_authority.request +executable = $${stunnel:wrapper} +wrapper = $${basedirectory:services}/stunnel +key-file = $${stunnel:key-file} +cert-file = $${stunnel:cert-file} + +[stunnel] +recipe = slapos.cookbook:stunnel +stunnel-binary = ${stunnel:location}/bin/stunnel +wrapper = $${rootdirectory:bin}/stunnel +log-file = $${basedirectory:log}/stunnel.log +config-file = $${directory:stunnel-conf}/stunnel.conf +key-file = $${directory:stunnel-conf}/stunnel.key +cert-file = $${directory:stunnel-conf}/stunnel.crt +pid-file = $${basedirectory:run}/stunnel.pid +local-host = $${mariadb:ip} +local-port = $${mariadb:port} +remote-host = $${slap-network-information:global-ipv6} +remote-port = 6446 +client = false +post-rotate-script = $${rootdirectory:bin}/stunnel_post_rotate + +[logrotate] +recipe = slapos.cookbook:logrotate +# Binaries +logrotate-binary = ${logrotate:location}/usr/sbin/logrotate +gzip-binary = $${buildout:gzip-binary} +gunzip-binary = ${gzip:location}/bin/gunzip +# Directories +wrapper = $${rootdirectory:bin}/logrotate +conf = $${rootdirectory:etc}/logrotate.conf +logrotate-entries = $${directory:logrotate-entries} +backup = $${directory:logrotate-backup} +state-file = $${rootdirectory:srv}/logrotate.status + +[logrotate-entry-mariadb] +<= logrotate +recipe = slapos.cookbook:logrotate.d +name = mariadb +log = $${mariadb:error-log} +frequency = daily +rotate-num = 30 +post = $${mariadb:logrotate-post} +sharedscripts = true +notifempty = true +create = true + +[logrotate-entry-stunnel] +<= logrotate +recipe = slapos.cookbook:logrotate.d +name = stunnel +log = $${stunnel:log-file} +frequency = daily +rotate-num = 30 +notifempty = true +create = true +post = $${stunnel:post-rotate-script} + +[logrotate-entry-cron] +<= logrotate +recipe =slapos.cookbook:logrotate.d +name = crond +log = $${cron-simplelogger:log} +frequency = daily +rotate-num = 30 +notifempty = true +create = true + +[cron] +recipe = slapos.cookbook:cron +dcrond-binary = ${dcron:location}/sbin/crond +cron-entries = $${directory:cron-entries} +crontabs = $${directory:crontabs} +cronstamps = $${directory:cronstamps} +catcher = $${cron-simplelogger:wrapper} +binary = $${basedirectory:services}/crond + +[cron-simplelogger] +recipe = slapos.cookbook:simplelogger +wrapper = $${rootdirectory:bin}/cron_simplelogger +log = $${basedirectory:log}/crond.log + +[cron-entry-logrotate] +<= cron +recipe = slapos.cookbook:cron.d +name = logrotate +frequency = 0 0 * * * +command = $${logrotate:wrapper} + +[slap-parameter] +#Default value if no ssh parameters specified +logbox-ip = +logbox-port = +logbox-user = +logbox-passwd = diff --git a/stack/boinc/instance.cfg b/stack/boinc/instance.cfg new file mode 100644 index 0000000000000000000000000000000000000000..f7a2d73a724ce4435397e06d572f6f28b8452c4d --- /dev/null +++ b/stack/boinc/instance.cfg @@ -0,0 +1,12 @@ +[buildout] +parts = + switch_softwaretype + +eggs-directory = ${buildout:eggs-directory} +develop-eggs-directory = ${buildout:develop-eggs-directory} +offline = true + +[switch_softwaretype] +recipe = slapos.cookbook:softwaretype +default = ${template-boinc:output} +mariadb = ${template-mariadb:output} \ No newline at end of file