active_record_proxy_adapters 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b80e3ab832bc332967c0f4840f9f35563725497e61a48339c46e4f65a15b2458
4
- data.tar.gz: fc85aed94e09aa25bd15e46102ae318f9b790bc2bb67a24243c2340952ff4fa2
3
+ metadata.gz: 0650c0793e1af3d7f06f1da1708cc590942468daca491353b57a74575926a5e2
4
+ data.tar.gz: 44cd716171d8a8d2d430ac8ae3780f54634ecdf1ae1014ca09720f9fef95bf5b
5
5
  SHA512:
6
- metadata.gz: 5a81cf2441d0f1548311474fbaa3326b9d2fbccc0b25c481408f0f99ce6634710dc589e0aed60f63ca55e5debe2635eb4cd6a75c2a0cf444fb7929292dc02dac
7
- data.tar.gz: c4bd34a35fa68b8257a5839b99055efdd11d18ce436afea98fd695475c4dae7cfda7ecc26fc2aed61f0981258c65684f22185c6d8fddc143ceb06b400b9219b1
6
+ metadata.gz: 68b00c13361168d78b70752002443988132725b013330d1e1161277f73c1a808f0153e76e6fb397bc7dd23c9bc8ba108a6c99ec3bdfc60d45f59a2c47902f693
7
+ data.tar.gz: a2bb48e98f0a57bb4f4546ca5bf821be670205a50a0b2ec439a79c98e3db1e43c28b63fe90c7d5849ba0ae048b4b20300658ce7fee62dd874e345c9ac50a0e86
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordProxyAdapters
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_proxy_adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Cruz
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-01-04 00:00:00.000000000 Z
10
+ date: 2025-02-25 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activerecord
@@ -58,18 +57,12 @@ email:
58
57
  - matt.cruz@nasdaq.com
59
58
  executables: []
60
59
  extensions: []
61
- extra_rdoc_files: []
60
+ extra_rdoc_files:
61
+ - README.md
62
+ - LICENSE.txt
62
63
  files:
63
- - ".rspec"
64
- - ".rubocop.yml"
65
- - CHANGELOG.md
66
- - CODE_OF_CONDUCT.md
67
- - Dockerfile
68
64
  - LICENSE.txt
69
65
  - README.md
70
- - db/postgresql_structure.sql
71
- - docker-compose.yml
72
- - docker/postgres_replica/cmd.sh
73
66
  - lib/active_record/connection_adapters/postgresql_proxy_adapter.rb
74
67
  - lib/active_record/tasks/postgresql_proxy_database_tasks.rb
75
68
  - lib/active_record_proxy_adapters.rb
@@ -81,9 +74,6 @@ files:
81
74
  - lib/active_record_proxy_adapters/primary_replica_proxy.rb
82
75
  - lib/active_record_proxy_adapters/railtie.rb
83
76
  - lib/active_record_proxy_adapters/version.rb
84
- - postgres_primary.dockerfile
85
- - postgres_replica.dockerfile
86
- - sig/active_record_proxy_adapters.rbs
87
77
  homepage: https://github.com/Nasdaq/active_record_proxy_adapters
88
78
  licenses:
89
79
  - MIT
@@ -93,7 +83,6 @@ metadata:
93
83
  source_code_uri: https://github.com/Nasdaq/active_record_proxy_adapters
94
84
  changelog_uri: https://github.com/Nasdaq/active_record_proxy_adapters/blob/main/CHANGELOG.md
95
85
  rubygems_mfa_required: 'true'
96
- post_install_message:
97
86
  rdoc_options: []
98
87
  require_paths:
99
88
  - lib
@@ -108,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
97
  - !ruby/object:Gem::Version
109
98
  version: '0'
110
99
  requirements: []
111
- rubygems_version: 3.5.11
112
- signing_key:
100
+ rubygems_version: 3.6.2
113
101
  specification_version: 4
114
102
  summary: Read replica proxy adapters for ActiveRecord!
115
103
  test_files: []
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --format documentation
2
- --color
3
- --order random
4
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,16 +0,0 @@
1
- require:
2
- - rubocop-rspec
3
-
4
- AllCops:
5
- TargetRubyVersion: 3.1
6
- NewCops: enable
7
-
8
- Style/StringLiterals:
9
- EnforcedStyle: double_quotes
10
-
11
- Style/StringLiteralsInInterpolation:
12
- EnforcedStyle: double_quotes
13
-
14
- RSpec/NestedGroups:
15
- Enabled: true
16
- Max: 5
data/CHANGELOG.md DELETED
@@ -1,37 +0,0 @@
1
- ## [Unreleased]
2
-
3
- - Handle PendingMigrationConnection introduced by Rails 7.2 and backported to Rails 7.1
4
- - Stick to same connection throughout request span
5
-
6
- ## [0.2.1] - 2025-01-02
7
-
8
- - Fix replica connection pool getter when specific connection name is not found https://github.com/Nasdaq/active_record_proxy_adapters/commit/847e150dd21c5bc619745ee1d9d8fcaa9b8f2eea
9
-
10
- ## [0.2.0] - 2024-12-24
11
-
12
- - Add custom log subscriber to tag queries based on the adapter being used https://github.com/Nasdaq/active_record_proxy_adapters/commit/68b8c1f4191388eb957bf12e0f84289da667e940
13
-
14
- ## [0.1.4] - 2025-01-02
15
-
16
- - Fix replica connection pool getter when specific connection name is not found https://github.com/Nasdaq/active_record_proxy_adapters/commit/88b32a282b54d420e652f638656dbcf063ac8796
17
-
18
- ## [0.1.3] - 2024-12-24
19
-
20
- - Fix replica connection pool getter when database configurations have multiple replicas https://github.com/Nasdaq/active_record_proxy_adapters/commit/ea5a33997da45ac073f166b3fbd2d12426053cd6
21
- - Retrieve replica pool without checking out a connection https://github.com/Nasdaq/active_record_proxy_adapters/commit/6470ef58e851082ae1f7a860ecdb5b451ef903c8
22
-
23
- ## [0.1.2] - 2024-12-16
24
-
25
- - Fix CTE regex matcher https://github.com/Nasdaq/active_record_proxy_adapters/commit/4b1d10bfd952fb1f5b102de8cc1a5bd05d25f5e9
26
-
27
- ## [0.1.1] - 2024-11-27
28
-
29
- - Enable RubyGems MFA https://github.com/Nasdaq/active_record_proxy_adapters/commit/2a71b1f4354fb966cc0aa68231ca5837814e07ee
30
-
31
- ## [0.1.0] - 2024-11-19
32
-
33
- - Add PostgreSQLProxyAdapter https://github.com/Nasdaq/active_record_proxy_adapters/commit/2b3bb9f7359139519b32af3018ceb07fed8c6b33
34
-
35
- ## [0.1.0.rc2] - 2024-10-28
36
-
37
- - Add PostgreSQLProxyAdapter https://github.com/Nasdaq/active_record_proxy_adapters/commit/2b3bb9f7359139519b32af3018ceb07fed8c6b33
data/CODE_OF_CONDUCT.md DELETED
@@ -1,132 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our
6
- community a harassment-free experience for everyone, regardless of age, body
7
- size, visible or invisible disability, ethnicity, sex characteristics, gender
8
- identity and expression, level of experience, education, socio-economic status,
9
- nationality, personal appearance, race, caste, color, religion, or sexual
10
- identity and orientation.
11
-
12
- We pledge to act and interact in ways that contribute to an open, welcoming,
13
- diverse, inclusive, and healthy community.
14
-
15
- ## Our Standards
16
-
17
- Examples of behavior that contributes to a positive environment for our
18
- community include:
19
-
20
- * Demonstrating empathy and kindness toward other people
21
- * Being respectful of differing opinions, viewpoints, and experiences
22
- * Giving and gracefully accepting constructive feedback
23
- * Accepting responsibility and apologizing to those affected by our mistakes,
24
- and learning from the experience
25
- * Focusing on what is best not just for us as individuals, but for the overall
26
- community
27
-
28
- Examples of unacceptable behavior include:
29
-
30
- * The use of sexualized language or imagery, and sexual attention or advances of
31
- any kind
32
- * Trolling, insulting or derogatory comments, and personal or political attacks
33
- * Public or private harassment
34
- * Publishing others' private information, such as a physical or email address,
35
- without their explicit permission
36
- * Other conduct which could reasonably be considered inappropriate in a
37
- professional setting
38
-
39
- ## Enforcement Responsibilities
40
-
41
- Community leaders are responsible for clarifying and enforcing our standards of
42
- acceptable behavior and will take appropriate and fair corrective action in
43
- response to any behavior that they deem inappropriate, threatening, offensive,
44
- or harmful.
45
-
46
- Community leaders have the right and responsibility to remove, edit, or reject
47
- comments, commits, code, wiki edits, issues, and other contributions that are
48
- not aligned to this Code of Conduct, and will communicate reasons for moderation
49
- decisions when appropriate.
50
-
51
- ## Scope
52
-
53
- This Code of Conduct applies within all community spaces, and also applies when
54
- an individual is officially representing the community in public spaces.
55
- Examples of representing our community include using an official email address,
56
- posting via an official social media account, or acting as an appointed
57
- representative at an online or offline event.
58
-
59
- ## Enforcement
60
-
61
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
- reported to the community leaders responsible for enforcement at
63
- [INSERT CONTACT METHOD].
64
- All complaints will be reviewed and investigated promptly and fairly.
65
-
66
- All community leaders are obligated to respect the privacy and security of the
67
- reporter of any incident.
68
-
69
- ## Enforcement Guidelines
70
-
71
- Community leaders will follow these Community Impact Guidelines in determining
72
- the consequences for any action they deem in violation of this Code of Conduct:
73
-
74
- ### 1. Correction
75
-
76
- **Community Impact**: Use of inappropriate language or other behavior deemed
77
- unprofessional or unwelcome in the community.
78
-
79
- **Consequence**: A private, written warning from community leaders, providing
80
- clarity around the nature of the violation and an explanation of why the
81
- behavior was inappropriate. A public apology may be requested.
82
-
83
- ### 2. Warning
84
-
85
- **Community Impact**: A violation through a single incident or series of
86
- actions.
87
-
88
- **Consequence**: A warning with consequences for continued behavior. No
89
- interaction with the people involved, including unsolicited interaction with
90
- those enforcing the Code of Conduct, for a specified period of time. This
91
- includes avoiding interactions in community spaces as well as external channels
92
- like social media. Violating these terms may lead to a temporary or permanent
93
- ban.
94
-
95
- ### 3. Temporary Ban
96
-
97
- **Community Impact**: A serious violation of community standards, including
98
- sustained inappropriate behavior.
99
-
100
- **Consequence**: A temporary ban from any sort of interaction or public
101
- communication with the community for a specified period of time. No public or
102
- private interaction with the people involved, including unsolicited interaction
103
- with those enforcing the Code of Conduct, is allowed during this period.
104
- Violating these terms may lead to a permanent ban.
105
-
106
- ### 4. Permanent Ban
107
-
108
- **Community Impact**: Demonstrating a pattern of violation of community
109
- standards, including sustained inappropriate behavior, harassment of an
110
- individual, or aggression toward or disparagement of classes of individuals.
111
-
112
- **Consequence**: A permanent ban from any sort of public interaction within the
113
- community.
114
-
115
- ## Attribution
116
-
117
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
- version 2.1, available at
119
- [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
-
121
- Community Impact Guidelines were inspired by
122
- [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
-
124
- For answers to common questions about this code of conduct, see the FAQ at
125
- [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
- [https://www.contributor-covenant.org/translations][translations].
127
-
128
- [homepage]: https://www.contributor-covenant.org
129
- [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
- [Mozilla CoC]: https://github.com/mozilla/diversity
131
- [FAQ]: https://www.contributor-covenant.org/faq
132
- [translations]: https://www.contributor-covenant.org/translations
data/Dockerfile DELETED
@@ -1,18 +0,0 @@
1
- ARG RUBY_VERSION=3.2.3
2
- ARG DOCKER_REGISTRY=docker.io
3
- FROM $DOCKER_REGISTRY/ruby:$RUBY_VERSION-alpine
4
- ARG RAILS_VERSION="~> 6.1.0"
5
- ENV RAILS_VERSION=$RAILS_VERSION
6
-
7
- RUN apk --update add \
8
- build-base \
9
- git \
10
- postgresql-dev \
11
- postgresql17-client
12
- RUN gem install bundler -v 2.5.13
13
-
14
- COPY . /app
15
- WORKDIR /app
16
-
17
- RUN bundle install
18
-
@@ -1,86 +0,0 @@
1
- SET statement_timeout = 0;
2
- SET lock_timeout = 0;
3
- SET idle_in_transaction_session_timeout = 0;
4
- SET transaction_timeout = 0;
5
- SET client_encoding = 'UTF8';
6
- SET standard_conforming_strings = on;
7
- SELECT pg_catalog.set_config('search_path', '', false);
8
- SET check_function_bodies = false;
9
- SET xmloption = content;
10
- SET client_min_messages = warning;
11
- SET row_security = off;
12
-
13
- SET default_tablespace = '';
14
-
15
- SET default_table_access_method = heap;
16
-
17
- --
18
- -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
19
- --
20
-
21
- CREATE TABLE public.schema_migrations (
22
- version character varying(255) NOT NULL
23
- );
24
-
25
-
26
- --
27
- -- Name: users; Type: TABLE; Schema: public; Owner: -
28
- --
29
-
30
- CREATE TABLE public.users (
31
- id integer NOT NULL,
32
- name text NOT NULL,
33
- email text NOT NULL,
34
- created_at timestamp without time zone DEFAULT now() NOT NULL,
35
- updated_at timestamp without time zone DEFAULT now() NOT NULL
36
- );
37
-
38
-
39
- --
40
- -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
41
- --
42
-
43
- CREATE SEQUENCE public.users_id_seq
44
- AS integer
45
- START WITH 1
46
- INCREMENT BY 1
47
- NO MINVALUE
48
- NO MAXVALUE
49
- CACHE 1;
50
-
51
-
52
- --
53
- -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
54
- --
55
-
56
- ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
57
-
58
-
59
- --
60
- -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
61
- --
62
-
63
- ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
64
-
65
-
66
- --
67
- -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
68
- --
69
-
70
- ALTER TABLE ONLY public.users
71
- ADD CONSTRAINT users_pkey PRIMARY KEY (id);
72
-
73
-
74
- --
75
- -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -
76
- --
77
-
78
- CREATE UNIQUE INDEX unique_schema_migrations ON public.schema_migrations USING btree (version);
79
-
80
-
81
- --
82
- -- PostgreSQL database dump complete
83
- --
84
-
85
- SET search_path TO "$user", public;
86
-
@@ -1,9 +0,0 @@
1
- until pg_basebackup --pgdata=/var/lib/postgresql/data -R --slot=$PRIMARY_REPLICATION_SLOT --host=$PRIMARY_DATABASE_HOST --port=$PRIMARY_DATABASE_PORT
2
- do
3
- echo 'Waiting for primary to connect...'
4
- sleep 1s
5
- done
6
-
7
- echo 'Backup done, starting replica...'
8
- chmod 0700 /var/lib/postgresql/data
9
- postgres
data/docker-compose.yml DELETED
@@ -1,77 +0,0 @@
1
- name: active_record_proxy_adapters
2
-
3
- x-postgres-common: &postgres-common
4
- restart: always
5
- user: postgres
6
- healthcheck:
7
- test: 'pg_isready -U postgres_primary_test --dbname=postgres'
8
- interval: 10s
9
- timeout: 5s
10
- retries: 5
11
- networks:
12
- - postgres
13
-
14
- services:
15
- app:
16
- build:
17
- args:
18
- - RUBY_VERSION=${RUBY_VERSION:-3.3.6}
19
- - RAILS_VERSION=${RAILS_VERSION:-8.0.0}
20
- container_name: app
21
- image: active_record_proxy_adapters-app:${ENV_TAG:-latest}
22
- tty: true
23
- stdin_open: true
24
- environment:
25
- PGHOST: postgres_primary
26
- PG_PRIMARY_USER: postgres_primary_test
27
- PG_PRIMARY_PASSWORD: postgres_primary_test
28
- PG_PRIMARY_HOST: postgres_primary
29
- PG_PRIMARY_PORT: 5432
30
- PG_REPLICA_USER: postgres_primary_test
31
- PG_REPLICA_PASSWORD: postgres_primary_test
32
- PG_REPLICA_HOST: postgres_replica
33
- PG_REPLICA_PORT: 5432
34
- depends_on:
35
- - postgres_primary
36
- - postgres_replica
37
- networks:
38
- - app
39
- - postgres
40
- volumes:
41
- - .:/app
42
- postgres_primary:
43
- <<: *postgres-common
44
- build:
45
- context: .
46
- dockerfile: postgres_primary.dockerfile
47
- args:
48
- - POSTGRES_LOGGING_COLLECTOR=${POSTGRES_LOGGING_COLLECTOR:-}
49
- - POSTGRES_LOG_DESTINATION=${POSTGRES_LOG_DESTINATION:-}
50
- - POSTGRES_LOG_STATEMENT=${POSTGRES_LOG_STATEMENT:-}
51
- - REPLICA_USER=replicator
52
- - REPLICA_PASSWORD=replicator
53
- environment:
54
- POSTGRES_DB: postgres
55
- POSTGRES_USER: postgres_primary_test
56
- POSTGRES_PASSWORD: postgres_primary_test
57
- POSTGRES_HOST_AUTH_METHOD: "scram-sha-256\nhost replication all 0.0.0.0/0 md5"
58
- POSTGRES_INITDB_ARGS: "--auth-host=scram-sha-256"
59
-
60
- postgres_replica:
61
- <<: *postgres-common
62
- build:
63
- context: .
64
- dockerfile: postgres_replica.dockerfile
65
- container_name: postgres_replica
66
- environment:
67
- PGUSER: replicator
68
- PGPASSWORD: replicator
69
- PRIMARY_DATABASE_HOST: postgres_primary
70
- depends_on:
71
- - postgres_primary
72
- networks:
73
- app:
74
- postgres:
75
-
76
- volumes:
77
- postgres_primary:
@@ -1,34 +0,0 @@
1
- FROM docker.io/postgres:17-alpine
2
-
3
- ARG REPLICA_USER=replicator
4
- ARG REPLICA_PASSWORD=replicator
5
- ARG REPLICATION_SLOT_NAME=replication_slot
6
- ARG INIT_SQL=00_init.sql
7
- ARG POSTGRES_LOGGING_COLLECTOR=
8
- ARG POSTGRES_LOG_DESTINATION=
9
- ARG POSTGRES_LOG_STATEMENT=
10
- ENV CONF_SAMPLE="/usr/local/share/postgresql/postgresql.conf.sample"
11
-
12
- WORKDIR /docker-entrypoint-initdb.d
13
-
14
- USER root
15
-
16
- RUN touch $INIT_SQL
17
- RUN chown -R postgres:postgres $INIT_SQL
18
- RUN echo "CREATE USER ${REPLICA_USER} WITH REPLICATION ENCRYPTED PASSWORD '${REPLICA_PASSWORD}';" > $INIT_SQL
19
- RUN echo "SELECT pg_create_physical_replication_slot('${REPLICATION_SLOT_NAME}');" >> $INIT_SQL
20
-
21
- # Enable logging collector if given
22
- RUN if [[ ! -z "${POSTGRES_LOGGING_COLLECTOR}" ]]; then sed -i "s/#\(logging_collector = \)off\(.*\)/\1${POSTGRES_LOGGING_COLLECTOR}\2/" ${CONF_SAMPLE}; fi
23
-
24
- # Override default log destination if given
25
- RUN if [[ ! -z "${POSTGRES_LOG_DESTINATION}" ]]; then sed -i "s/#\(log_destination = \)'stderr'\(.*\)/\1'${POSTGRES_LOG_DESTINATION}'\2/" ${CONF_SAMPLE}; fi
26
-
27
- # Override log statement if given
28
- RUN if [[ ! -z "${POSTGRES_LOG_STATEMENT}" ]]; then sed -i "s/#\(log_statement = \)'none'\(.*\)/\1'${POSTGRES_LOG_STATEMENT}'\2/" ${CONF_SAMPLE}; fi
29
-
30
- WORKDIR /
31
-
32
- USER postgres
33
-
34
- CMD ["postgres", "-c", "wal_level=replica", "-c", "hot_standby=on", "-c", "max_wal_senders=10", "-c", "max_replication_slots=10", "-c", "hot_standby_feedback=on" ]
@@ -1,15 +0,0 @@
1
- FROM docker.io/postgres:17-alpine
2
-
3
- ENV PRIMARY_DATABASE_HOST=localhost
4
- ENV PRIMARY_DATABASE_PORT=5432
5
- ENV PRIMARY_REPLICATION_SLOT=replication_slot
6
-
7
-
8
- COPY docker/postgres_replica/cmd.sh cmd.sh
9
-
10
- USER root
11
- RUN chown -R postgres:postgres cmd.sh
12
- USER postgres
13
- RUN chmod u+x cmd.sh
14
-
15
- CMD [ "./cmd.sh" ]
@@ -1,4 +0,0 @@
1
- module ActiveRecordProxyAdapters
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end