воскресенье, 27 марта 2011 г.

switch postgresql from standby to normal mode.

After configure hot standby on postgresql 9.0, i configure heartbeat for switch slave server to master.
require add to recovery.conf this line
trigger_file = '/var/lib/pgsql/9.0/data/MASTER'

And after
touch /var/lib/pgsql/9.0/data/MASTER
and service postgresql-9.0 restart
server work as read/write server.

for return to standby require sync db files between master and slave
and
mv /var/lib/pgsql/9.0/data/recovery.done /var/lib/pgsql/9.0/data/recovery.conf
and again restart postgresql server

четверг, 3 марта 2011 г.

postgresql tablespace selinux

I need store separate databases in different path.
require define this space - it is called tablespace in postgresql.
For create tablespace require set selinux context to path.
example: i create new path /ooo/target
chcon -u system_u -r object_r -t var_lib_t /ooo
chcon -u system_u -r object_r -t postgresql_db_t /ooo/target

Complete for create table space:
CREATE TABLESPACE new_target_space LOCATION '/ooo/target';

четверг, 6 января 2011 г.

hudson utf8 encoding

For test we use hudson, but it show russian letters not correct.
Require set java option
-Dfile.encoding=UTF8
and restart hudson
for fedora and centos
HUDSON_JAVA_OPTIONS="-Djava.awt.headless=true -Dfile.encoding=UTF8"
in /etc/sysconfig/hudson

суббота, 18 декабря 2010 г.

Spree + webmoney

Сприи в россии не хватало приема вебманей.
Теперь все просто.
Ставим плагин https://github.com/pronix/spree_webmoney
В Gemfile прописываем
gem "spree_webmoney", :git => "git://github.com/pronix/spree_webmoney.git"

Запускаем:
bundle install
rake spree_webmoney:install
И готово. Регистрируйтесь мерчантом в вебмани и принимайте платежи.

четверг, 11 ноября 2010 г.

Random ActiveRecord row:

Model.first(:offset => rand(Model.count))

суббота, 6 ноября 2010 г.

tranz

Быстро добавляем платежные системы и транзакции в проект
https://github.com/pronix/tranz

Ставим плагин

rails plugin install git://github.com/pronix/tranz.git
rails g tranz

Если все получилось удачно - то удаляем плагин

rails plugin remove tranz