Skip to content

Instantly share code, notes, and snippets.

View JosimarCamargo's full-sized avatar

Josimar Camargo JosimarCamargo

View GitHub Profile
@JosimarCamargo
JosimarCamargo / README.md
Last active April 6, 2024 15:39
How to setup a Postgres replication with docker and docker-compose

How to setup a Postgres replication with docker and docker-compose

How to use

To run you will need docker and docker-compose installed, and run the command docker-compose up on a folder within this file named docker-compose.yml(attached in this Gist)

How the PGAudit is enable, you will see the queries log and in which database is running which query, this is the main purpose of this Gist, along with have a database with replication working out of the box

To add user with just reading rights to access the database on slave replica

@JosimarCamargo
JosimarCamargo / defaults.rb
Created September 5, 2018 18:16 — forked from stevenharman/defaults.rb
A subtle difference between Ruby's Hash.fetch(:key, :default) vs. (Hash[:key] || :default)
h = {
'a' => :a_value,
'b' => nil,
'c' => false
}
h.fetch('a', :default_value) #=> :a_value
h.fetch('b', :default_value) #=> nil
h.fetch('c', :default_value) #=> false
h.fetch('d', :default_value) #=> :default_value