Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Rails Postgresql replication via Octopus gem when in Development env

$
0
0

Apparently when using the Octopus gem to do Postgres replication everything should be plug and play. However I can't seem to find what I'm doing wrong.

This is my config/shards.yml

octopus:
  environments:
    - development
  replicated: true
  development:
    slave1:
      adapter: postgresql
      host: localhost
      database: slaveapp_development
      username: pguser
      password: pgpass

The AR model Provider(I create the exact same tables in each app via Rake tasks) I'd like to sync/replicate to my slave:

class Provider < ActiveRecord::Base
  has_many :products
  replicated_model()
end

I boot both apps via Rails server and enter Masterapp's console and from there:

> Provider.using(:slave1).create({provider_params...})  
#=> works! I get a new record in slave1's DB.
> Provider.using(:master).create({provider_params...})  
#=> works partly. Creates record only in master's DB.

The problem is that when calling Provider.using(:master)... I'm expecting:

1 - Create record at master's DB.

2 - Replicate same record at slave1's DB. <--- This is NOT happening.


Viewing all articles
Browse latest Browse all 17268

Trending Articles