Commit 5035baae authored by Marco Mariani's avatar Marco Mariani

added recipe for site and db init

parent 4db10c16
......@@ -60,6 +60,7 @@ setup(name=name,
'dropbear.add_authorized_key = slapos.recipe.dropbear:AddAuthorizedKey',
'dropbear.client = slapos.recipe.dropbear:Client',
'dropbear = slapos.recipe.dropbear:Recipe',
'drupal_init = slapos.recipe.drupal:InitRecipe',
'dumpmdb = slapos.recipe.dumpmdb:Recipe',
'duplicity = slapos.recipe.duplicity:Recipe',
'egg_test = slapos.recipe.erp5_test:EggTestRecipe',
......
##############################################################################
#
# 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 os
import subprocess
from slapos.recipe.librecipe import GenericBaseRecipe
class InitRecipe(GenericBaseRecipe):
"""\
This recipe performs deployment steps for Drupal:
- Call the 'drush' command to install a Drupal site and initial database schema.
"""
def install(self):
drush_binary = self.options['drush-binary']
htdocs = self.options['htdocs']
os.chdir(htdocs)
output = subprocess.check_output([drush_binary,
'-y', 'site-install',
'--account-name=admin',
'--account-pass=admin'
])
# XXX return what?
return []
[buildout]
[drupal-init]
recipe = slapos.cookbook:drupal_init
drush-binary = ${apache-php:location}/bin/drush
htdocs = $${rootdirectory:srv}/www
dependency = $${apache-php:recipe}
......@@ -200,12 +200,23 @@
* );
* @endcode
*/
/*
* The apachephp recipe provided with both host+port in the same string.
* Split them again, php way.
* And it could be an ipv6 as well, so beware of colons.
*/
$mysql_host_port = '%(mysql_host)s';
$mysql_port = substr(strrchr($mysql_host_port, ":"), 1);
$mysql_host = substr($mysql_host_port, 0, strlen($mysql_host_port) - strlen($mysql_port) - 1);
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => '%(mysql_database)s',
'username' => '%(mysql_user)s',
'password' => '%(mysql_password)s',
'host' => '%(mysql_host)s',
'host' => $mysql_host,
'port' => $mysql_port,
'prefix' => '',
);
......
......@@ -3,6 +3,13 @@
extends =
../../stack/lamp/buildout.cfg
develop =
/opt/slapdev
parts +=
pear-modules
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://ftp.drupal.org/files/projects/drupal-7.16.tar.gz
......@@ -11,16 +18,33 @@ md5sum = 352497b2df94b5308e31cb8da020b631
[application-template]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/settings.php.in
md5sum = add9e4e96094a9d3fb7cf0f4d26ae544
md5sum = b4dfbdb950c25c93a8c3f9f78e9bff6e
download-only = True
filename = template.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[application-configuration]
location = sites/default/default.settings.php
location = sites/default/settings.php
[custom-application-deployment]
path = {:_profile_base_location_}/instance.cfg
part-list =
setup-database
path = ${custom-application-deployment-template:output}
part-list = drupal-init
[custom-application-deployment-template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-custom.cfg.in
output = ${buildout:directory}/instance-custom.cfg
md5sum = bd071532528120f5da1fb6050d4c80e8
mode = 0644
[pear-modules]
recipe = cp.recipe.cmd
pear = ${apache-php:location}/bin/pear
install_cmd =
${:pear} channel-info pear.drush.org >/dev/null || ${:pear} channel-discover pear.drush.org
${:pear} info drush/drush >/dev/null || ${:pear} install drush/drush
${:pear} info Console_Table >/dev/null || ${:pear} install Console_Table
[buildout]
extends = ${custom-php-part:path}
extends = ${custom-application-deployment:path}
parts =
certificate-authority
......@@ -15,7 +15,7 @@ parts =
frontend-promise
content-promise
publish-connection-informations
${custom-php-part:part-list}
${custom-application-deployment:part-list}
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
......
......@@ -84,7 +84,7 @@ mode = 0644
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/apache/instance-apache-php.cfg
output = ${buildout:directory}/template-apache-php.cfg
md5sum = a5dd222b3faa4e1ef2df9b3b9bb47966
md5sum = f789d2a84e0cd3ca28a6377c4f7b5ab2
mode = 0644
[template-apache-backup]
......
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