pg_easy_replicate 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 183ef6099fbe9da9d5a472f59cdd1adb1a1a62dbc3d6280d0ecdf429fcf5e2d5
4
- data.tar.gz: 5af07f7ec6714711eee12c5e1fd16a911248602dc585be0bb83979895d450afb
3
+ metadata.gz: 4b921457ac5cd3cdf95ddd58ebd9450599da1db6598b38bc9983ea3edd5a9e7f
4
+ data.tar.gz: 37b390c0d6b8b8c7c067f3fe0458e99f798e49bbc3550fa5d9ed4232d1ebc061
5
5
  SHA512:
6
- metadata.gz: 2fa2a8a4938fc55fae28be71724318a1237f95cb7de0a49590008ac469ec3b8f3641a4bd1e048a4c63a73a5aff4edbcf423509df68794bcc93280cee0ec75d6a
7
- data.tar.gz: 927015aef583a0f095911fe5d37335825f528e17ff43e579abf0bc617f82f433d0f27413845f209c177d8c26e85220dadcee24ca00db8f453d8752800ee7abb2
6
+ metadata.gz: 1625c146ca54678cef9bf052b70a1f863f78010718f135e4a06647fcb97765eb1c6034bdeba00d392ad696077096fa98fe498e21e7d00653cc374498acd9b1d1
7
+ data.tar.gz: d3eb21ae669cd98ea0f817f1b6454f16b12f7b40397e849d72386759c6d3a1a72022a8b30214f2211744e259c59dcfcb345f54548c2b76e6cd00be84eea0320c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.1.1] - 2023-06-21
2
+
3
+ - Don't leak bin/console and bin/setup into `$PATH`
4
+
1
5
  ## [0.1.0] - 2023-06-19
2
6
 
3
7
  - Initial release
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
1
  FROM ruby:3.0
2
2
 
3
- ARG VERSION=0.1.0
3
+ ARG VERSION=0.1.1
4
4
 
5
5
  RUN gem install pg_easy_replicate -v $VERSION
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pg_easy_replicate (0.1.0)
4
+ pg_easy_replicate (0.1.1)
5
5
  lockbox (~> 1.2.0)
6
6
  ougai (~> 2.0.0)
7
7
  pg (~> 1.5.3)
@@ -25,17 +25,19 @@ GEM
25
25
  ougai (2.0.0)
26
26
  oj (~> 3.10)
27
27
  parallel (1.23.0)
28
- parser (3.2.2.1)
28
+ parser (3.2.2.3)
29
29
  ast (~> 2.4.1)
30
+ racc
30
31
  pg (1.5.3)
31
32
  prettier_print (1.2.1)
32
33
  pry (0.14.2)
33
34
  coderay (~> 1.1)
34
35
  method_source (~> 1.0)
36
+ racc (1.7.1)
35
37
  rainbow (3.1.1)
36
38
  rake (13.0.6)
37
39
  rbs (3.1.0)
38
- regexp_parser (2.8.0)
40
+ regexp_parser (2.8.1)
39
41
  rexml (3.2.5)
40
42
  rspec (3.12.0)
41
43
  rspec-core (~> 3.12.0)
@@ -50,17 +52,17 @@ GEM
50
52
  diff-lcs (>= 1.2.0, < 2.0)
51
53
  rspec-support (~> 3.12.0)
52
54
  rspec-support (3.12.0)
53
- rubocop (1.51.0)
55
+ rubocop (1.52.1)
54
56
  json (~> 2.3)
55
57
  parallel (~> 1.10)
56
- parser (>= 3.2.0.0)
58
+ parser (>= 3.2.2.3)
57
59
  rainbow (>= 2.2.2, < 4.0)
58
60
  regexp_parser (>= 1.8, < 3.0)
59
61
  rexml (>= 3.2.5, < 4.0)
60
62
  rubocop-ast (>= 1.28.0, < 2.0)
61
63
  ruby-progressbar (~> 1.7)
62
64
  unicode-display_width (>= 2.4.0, < 3.0)
63
- rubocop-ast (1.28.1)
65
+ rubocop-ast (1.29.0)
64
66
  parser (>= 3.2.1.0)
65
67
  rubocop-capybara (2.18.0)
66
68
  rubocop (~> 1.41)
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # pg_easy_replicate
2
2
 
3
- `pg_easy_replicate` is a CLI orchestrator tool that simplifies the process of setting up [logical replication](https://www.postgresql.org/docs/current/logical-replication.html) between two PostgreSQL databases. `pg_easy_replicate` also supports switchover. After the source (primary database) is fully replicating, `pg_easy_replicate` puts it into read-only mode and via logical replication flushes all data to the new target database. This ensures zero data loss and minimal downtime for the application. This method can be useful for performing minimal downtime major version upgrades between two PostgreSQL databases, load testing with blue/green database setup and other similar use cases.
3
+ [![CI](https://github.com/shayonj/pg_easy_replicate/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/shayonj/pg_easy_replicate/actions/workflows/ci.yaml)
4
+ [![Gem Version](https://badge.fury.io/rb/pg_easy_replicate.svg)](https://badge.fury.io/rb/pg_easy_replicate)
5
+
6
+ `pg_easy_replicate` is a CLI orchestrator tool that simplifies the process of setting up [logical replication](https://www.postgresql.org/docs/current/logical-replication.html) between two PostgreSQL databases. `pg_easy_replicate` also supports switchover. After the source (primary database) is fully replicating, `pg_easy_replicate` puts it into read-only mode and via logical replication flushes all data to the new target database. This ensures zero data loss and minimal downtime for the application. This method can be useful for performing minimal downtime (up to <1min, depending) major version upgrades between two PostgreSQL databases, load testing with blue/green database setup and other similar use cases.
7
+
8
+ Battle tested in production at [Tines](https://www.tines.com/) 🚀
4
9
 
5
10
  - [Installation](#installation)
6
11
  - [Requirements](#requirements)
@@ -65,9 +70,9 @@ $ export TARGET_DB_URL="postgres://USERNAME:PASSWORD@localhost:5433/DATABASE_NAM
65
70
  Any `pg_easy_replicate` command can be run the same way with the docker image as well. As long the container is running in an environment where it has access to both the databases. Example
66
71
 
67
72
  ```bash
68
- docker run -it --rm shayonj/pg_easy_replicate:latest \
69
- -e SOURCE_DB_URL="postgres://USERNAME:PASSWORD@localhost:5432/DATABASE_NAME" \
73
+ docker run -e SOURCE_DB_URL="postgres://USERNAME:PASSWORD@localhost:5432/DATABASE_NAME" \
70
74
  -e TARGET_DB_URL="postgres://USERNAME:PASSWORD@localhost:5433/DATABASE_NAME" \
75
+ -it --rm shayonj/pg_easy_replicate:latest \
71
76
  pg_easy_replicate config_check
72
77
  ```
73
78
 
@@ -210,4 +215,4 @@ Next, you can set up a program that watches the `stats` and waits until `switcho
210
215
 
211
216
  In this strategy, you have a weighted based DNS system (example [AWS Route53 weighted records](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-values-weighted.html)) where 100% of traffic goes to a primary origin and 0% to a secondary origin. The primary origin here is the DNS host for your source database and secondary origin is the DNS host for your target database. You can set up your application ahead of time to interact with the database using DNS from the weighted group.
212
217
 
213
- Next, you can set up a program that watches the `stats` and waits until `switchover_completed_at` is reporting as `true`. Once that happens it updates the weight in the DNS weighted group where 100% of the requests now go to the new/target database. Note: Keeping a lot `ttl` is recommended.
218
+ Next, you can set up a program that watches the `stats` and waits until `switchover_completed_at` is reporting as `true`. Once that happens it updates the weight in the DNS weighted group where 100% of the requests now go to the new/target database. Note: Keeping a low `ttl` is recommended.
data/bin/release.sh CHANGED
@@ -15,14 +15,14 @@ echo "=== Sleeping for 5s ===="
15
15
  sleep 5
16
16
 
17
17
  echo "=== Building Image ===="
18
- docker build . --build-arg VERSION="$VERSION" -t shayonj/pg-osc:"$VERSION"
18
+ docker build . --build-arg VERSION="$VERSION" -t shayonj/pg_easy_replicate:"$VERSION"
19
19
 
20
20
  echo "=== Tagging Image ===="
21
- docker image tag shayonj/pg-osc:"$VERSION" shayonj/pg-osc:latest
21
+ docker image tag shayonj/pg_easy_replicate:"$VERSION" shayonj/pg_easy_replicate:latest
22
22
 
23
23
  echo "=== Pushing Image ===="
24
- docker push shayonj/pg-osc:"$VERSION"
25
- docker push shayonj/pg-osc:latest
24
+ docker push shayonj/pg_easy_replicate:"$VERSION"
25
+ docker push shayonj/pg_easy_replicate:latest
26
26
 
27
27
  echo "=== Cleaning up ===="
28
28
  rm pg_easy_replicate-"$VERSION".gem
@@ -55,7 +55,7 @@ module PgEasyReplicate
55
55
  method_option :schema_name,
56
56
  aliases: "-s",
57
57
  desc:
58
- "Name of the schema tables are in, only required if passsing list of tables"
58
+ "Name of the schema tables are in, only required if passing list of tables"
59
59
  method_option :tables,
60
60
  aliases: "-t",
61
61
  desc:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgEasyReplicate
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_easy_replicate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shayon Mukherjee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-19 00:00:00.000000000 Z
11
+ date: 2023-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lockbox
@@ -253,10 +253,9 @@ description: Easily setup logical replication and switchover to new database wit
253
253
  email:
254
254
  - shayonj@gmail.com
255
255
  executables:
256
- - console
257
256
  - pg_easy_replicate
257
+ - pg_easy_replicate_console
258
258
  - release.sh
259
- - setup
260
259
  extensions: []
261
260
  extra_rdoc_files: []
262
261
  files:
@@ -272,10 +271,9 @@ files:
272
271
  - LICENSE.txt
273
272
  - README.md
274
273
  - Rakefile
275
- - bin/console
276
274
  - bin/pg_easy_replicate
275
+ - bin/pg_easy_replicate_console
277
276
  - bin/release.sh
278
- - bin/setup
279
277
  - docker-compose.yml
280
278
  - lib/pg_easy_replicate.rb
281
279
  - lib/pg_easy_replicate/cli.rb
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
File without changes