3 # hack to update/add read-only permissions for a user on the db
5 # usage: pg-readonly freesideuser readonlyuser
9 use FS::UID qw(adminsuidsetup);
10 use FS::Record qw(dbdef);
12 my $user = shift or die &usage;
13 adminsuidsetup($user);
17 #su postgres -c 'createlang plpgsql freeside'
21 my $MASTERHOST = '172.21.0.204';
22 my $SLAVEHOST = '172.21.0.205';
23 #my $REPLICATIONUSER='pgsql';
24 my $REPLICATIONUSER='postgres';
26 #drop set ( id = 1, origin = 1);
29 cluster name = freeside;
30 node 1 admin conninfo = 'dbname=freeside host=$MASTERHOST user=$REPLICATIONUSER';
31 node 2 admin conninfo = 'dbname=freeside host=$SLAVEHOST user=$REPLICATIONUSER';
32 init cluster ( id=1, comment = 'Master Node');
33 create set (id=1, origin=1, comment='All freeside tables');
39 foreach my $table ( dbdef->tables ) {
40 #next if $table =~ /^sql_/i;
41 print "set add table (set id=1, origin=1, id=". $id++. ", fully qualified name = 'public.$table' );\n";
46 store node (id=2, comment = 'Slave node');
47 store path (server = 1, client = 2, conninfo='dbname=freeside host=$MASTERHOST user=$REPLICATIONUSER');
48 store path (server = 2, client = 1, conninfo='dbname=freeside host=$SLAVEHOST user=$REPLICATIONUSER');
49 store listen (origin=1, provider = 1, receiver =2);
50 store listen (origin=2, provider = 2, receiver =1);