2011年5月4日 星期三

dotcloud + Drupal 7.0

*use Ubuntu 11.04
sudo apt-get install python-setuptools
sudo easy_install dotcloud

* create namespace (plz change all of "helloworld" for your application)
dotcloud create helloworld

* create services
dotcloud deploy -t php helloworld.www
dotcloud deploy -t postgresql helloworld.pgsql

********** you need to wait for your server available ****************

* download Drupal 7.0 from http://drupal.org/project/drupal
tar zxf drupal-7.0.tar.gz
cd drupal-7.0
git init
git add .
git commit -am 'drupal 7.0'

* setup postgresql at first
dotcloud ssh helloworld.pgsql
# createuser --pwprompt --encrypted --no-createrole --no-createdb drupal
# createdb --encoding=UTF8 --owner=drupal drupal

* tune some settings on your local drupal-7.0
** 000-nginx.conf
location ~ \.php$ {
fastcgi_index index.php;
}

** fastcgi.conf
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_buffers 256 4k;
fastcgi_intercept_errors on;
## allow 4 hrs - pass timeout responsibility to upstrea
fastcgi_read_timeout 14400;
fastcgi_index index.php;
fastcgi_param PATH_INFO $fastcgi_script_name;

** php.ini
; nginx fix
cgi.fix_pathinfo = 0

** postinstall
#!/bin/sh
[ -d ~/drupal-files ] || mkdir -p ~/drupal-files
ln -sf ~/drupal-files ~/current/sites/default/file

** copy sites/default/settings.php.sample to sites/default/settings.php and modify it with proper settings (not sure if you need to do this)
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'drupal',
'username' => 'drupal',
'password' => 'drupal',
'host' => 'pgsql.helloworld.dotcloud.com',
'port' => '4015',
'driver' => 'pgsql',
'prefix' => '',
),
),
);

* and then push your local drupal-7.0 to server
dotcloud push helloworld.www drupal-7.0

* and then connects http://www.helloworld.dotcloud.com/install.php
re-try it and make sure you see the progress bar during "creating database"

Good Luck...

沒有留言: