Hello evryone
It finally works, using rubber, postgis and rgeo. Here is what I had
to do:
1. Add the postgresql-postgis package to the rubber-postgresql.yml
file:
roles:
postgresql_master:
db_server_id: 1
postgresql_slave:
db_server_id: 2
db:
packages: ["postgresql-#{postgresql_ver}", "postgresql-
#{postgresql_ver}-postgis"]
2. Extend the postgresql:bootstrap task in deploy-postgresql.rb to set
up the database with the postgis table and functions:
...
script_dir = "/usr/share/postgresql/
#{rubber_env.postgresql_ver}/contrib"
rubber.sudo_script "create_master_db", <<-ENDSCRIPT
sudo -u postgres psql -c "#{create_user_cmd}"
sudo -u postgres psql -c
"#{create_replication_user_cmd}"
sudo -u postgres psql -c "CREATE DATABASE #{env.db_name}
WITH OWNER #{env.db_user}"
#Initialize db with postgis data
sudo -u postgres psql -d #{env.db_name} -f #{script_dir}/
postgis-1.5/postgis.sql
sudo -u postgres psql -d #{env.db_name} -f #{script_dir}/
postgis-1.5/spatial_ref_sys.sql
sudo -u postgres psql -d #{env.db_name} -c "GRANT ALL
PRIVILEGES ON ALL TABLES IN SCHEMA public TO #{env.db_user}"
sudo -u postgres psql -d #{env.db_name} -c "GRANT ALL
PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO #{env.db_user}"
ENDSCRIPT
...
3. Create new rubber deploy task file named deploy-rgeo.rb and its
config file rubber-rgeo.yml to install the needed packages and the
rgeo gem:
deploy-rgeo.yml:
#RGeo requires the packages libgeos and proj for internal calculations
packages: [libgeos-3.2.2, proj]
deploy-rgeo.rb:
namespace :rubber do
namespace :rgeo do
after "rubber:install_gems", "rubber:rgeo:install_rgeo"
task :install_rgeo do
#Install the rgeo gem with the path to the required libraries
rubber.sudo_script "install_rgeo", <<-SCRIPT
gem install rgeo -- --with-geos-dir=/usr/lib/
SCRIPT
end
end
end
With this rgeo works using rubber to deploy the whole server. What
I've not tested yet is the use of slave instances, but i think that
should work also.