messaging 3.6.1 → 3.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +33 -17
- data/Gemfile.lock +17 -15
- data/README.md +1 -34
- data/bin/setup +6 -19
- data/lib/messaging/adapters/postgres/categories.rb +51 -3
- data/lib/messaging/adapters/postgres/store.rb +7 -6
- data/lib/messaging/adapters/postgres.rb +4 -24
- data/lib/messaging/config.rb +23 -23
- data/lib/messaging/version.rb +1 -1
- data/lib/messaging.rb +11 -0
- metadata +2 -7
- data/.env +0 -2
- data/Dockerfile +0 -37
- data/bin/de +0 -11
- data/bin/setup_db +0 -3
- data/docker-compose.yml +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '049d3a3eac021195a546e67f3ce5351fa93a105a86a7bddc10b6fcb140533e43'
|
4
|
+
data.tar.gz: bce77446512ba9f31d3b21739ef2af2c59ac8bd89c2ff7d15006459aff3cd387
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b54e3f6633fa243b6fba4d20e2359c8018cbb37634a7420c75f9e2e8cf6a9da44aa0bebc139ed06ded0b887a35383be72c38c8a58ee6f3e6d288d5527b73e28
|
7
|
+
data.tar.gz: f45a5fb8cee52d26d0ef769a5557ac2fcabebc0b27bc5374a2bd5b25c930a3731b80238efc22429290bfdb0be14b915e2fc995af299d2580b1a6f2160462512f
|
data/.circleci/config.yml
CHANGED
@@ -5,32 +5,42 @@
|
|
5
5
|
version: 2
|
6
6
|
jobs:
|
7
7
|
build:
|
8
|
-
|
9
|
-
image:
|
10
|
-
|
8
|
+
docker:
|
9
|
+
- image: circleci/ruby:2.4.1-node-browsers
|
10
|
+
environment:
|
11
|
+
- CC_TEST_REPORTER_ID: 94ada9b95ee3f232a6e984809d37917cfee90ac47805429e8c49742b2e8d2276
|
12
|
+
- RAILS_ENV: test
|
13
|
+
- image: circleci/postgres:12.5-ram
|
14
|
+
environment:
|
15
|
+
- POSTGRES_HOST_AUTH_METHOD: trust
|
16
|
+
- POSTGRES_PASSWORD: password
|
17
|
+
|
11
18
|
working_directory: ~/repo
|
12
|
-
environment:
|
13
|
-
RUBY_VERSION: 2.6.6-buster
|
14
|
-
RAILS_ENV: test
|
15
19
|
|
16
20
|
steps:
|
21
|
+
- run:
|
22
|
+
name: Install aptitude because it has much more helpful error messages when ending up in dependency hell
|
23
|
+
command: sudo apt-get install --assume-yes aptitude
|
24
|
+
|
25
|
+
- run:
|
26
|
+
name: Install Postgres Client
|
27
|
+
command: sudo aptitude -y install postgresql-client
|
28
|
+
|
17
29
|
- checkout
|
18
30
|
|
31
|
+
- run:
|
32
|
+
name: Setup Code Climate test-reporter
|
33
|
+
command: |
|
34
|
+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
35
|
+
chmod +x ./cc-test-reporter
|
36
|
+
|
19
37
|
- restore_cache:
|
20
38
|
name: Restore Bundler Cache
|
21
39
|
key: messaging-bundle-{{ checksum "Gemfile.lock" }}
|
22
40
|
|
23
|
-
- run:
|
24
|
-
name: start postgres runner
|
25
|
-
command: docker-compose up -d postgres
|
26
|
-
|
27
|
-
- run:
|
28
|
-
name: Build runner
|
29
|
-
command: docker-compose --verbose build runner
|
30
|
-
|
31
41
|
- run:
|
32
42
|
name: install dependencies
|
33
|
-
command:
|
43
|
+
command: bundle install --jobs=4 --retry=3 --path vendor/bundle
|
34
44
|
|
35
45
|
- save_cache:
|
36
46
|
key: messagin-bundle-{{ checksum "Gemfile.lock" }}
|
@@ -39,11 +49,17 @@ jobs:
|
|
39
49
|
|
40
50
|
- run:
|
41
51
|
name: Database Setup
|
42
|
-
command:
|
52
|
+
command: |
|
53
|
+
cd spec/example_app
|
54
|
+
bin/rails db:create
|
55
|
+
bin/rails db:migrate
|
43
56
|
|
44
57
|
- run:
|
45
58
|
name: run tests
|
46
|
-
command:
|
59
|
+
command: |
|
60
|
+
./cc-test-reporter before-build
|
61
|
+
bundle exec rspec
|
62
|
+
./cc-test-reporter after-build --exit-code $?
|
47
63
|
|
48
64
|
workflows:
|
49
65
|
version: 2
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
messaging (3.
|
4
|
+
messaging (3.5.7)
|
5
5
|
activerecord
|
6
6
|
activesupport
|
7
7
|
after_transaction
|
@@ -45,8 +45,8 @@ GEM
|
|
45
45
|
tzinfo (~> 1.1)
|
46
46
|
addressable (2.7.0)
|
47
47
|
public_suffix (>= 2.0.2, < 5.0)
|
48
|
-
after_transaction (0.0.
|
49
|
-
activerecord
|
48
|
+
after_transaction (0.0.3)
|
49
|
+
activerecord (< 6.0)
|
50
50
|
arel (9.0.0)
|
51
51
|
axiom-types (0.1.1)
|
52
52
|
descendants_tracker (~> 0.0.4)
|
@@ -73,23 +73,24 @@ GEM
|
|
73
73
|
descendants_tracker (0.0.4)
|
74
74
|
thread_safe (~> 0.3, >= 0.3.1)
|
75
75
|
diff-lcs (1.3)
|
76
|
-
digest-crc (0.
|
76
|
+
digest-crc (0.5.1)
|
77
77
|
dnsruby (1.61.3)
|
78
78
|
addressable (~> 2.5)
|
79
79
|
docile (1.3.2)
|
80
|
-
dry-configurable (0.
|
80
|
+
dry-configurable (0.8.3)
|
81
81
|
concurrent-ruby (~> 1.0)
|
82
|
-
dry-core (~> 0.
|
83
|
-
dry-container (0.
|
82
|
+
dry-core (~> 0.4, >= 0.4.7)
|
83
|
+
dry-container (0.7.2)
|
84
84
|
concurrent-ruby (~> 1.0)
|
85
|
-
dry-configurable (~> 0.
|
86
|
-
dry-core (0.
|
85
|
+
dry-configurable (~> 0.1, >= 0.1.3)
|
86
|
+
dry-core (0.4.9)
|
87
87
|
concurrent-ruby (~> 1.0)
|
88
|
-
dry-equalizer (0.
|
89
|
-
dry-initializer (3.0.
|
88
|
+
dry-equalizer (0.2.2)
|
89
|
+
dry-initializer (3.0.3)
|
90
90
|
em-websocket (0.5.1)
|
91
91
|
eventmachine (>= 0.12.9)
|
92
92
|
http_parser.rb (~> 0.6.0)
|
93
|
+
equalizer (0.0.11)
|
93
94
|
erubi (1.9.0)
|
94
95
|
ethon (0.12.0)
|
95
96
|
ffi (>= 1.3.0)
|
@@ -150,7 +151,7 @@ GEM
|
|
150
151
|
octokit (~> 4.0)
|
151
152
|
public_suffix (~> 3.0)
|
152
153
|
typhoeus (~> 1.3)
|
153
|
-
hashie (
|
154
|
+
hashie (4.1.0)
|
154
155
|
html-pipeline (2.12.2)
|
155
156
|
activesupport (>= 2)
|
156
157
|
nokogiri (>= 1.4)
|
@@ -284,7 +285,7 @@ GEM
|
|
284
285
|
nokogiri (>= 1.5.9)
|
285
286
|
maxminddb (0.1.8)
|
286
287
|
mercenary (0.3.6)
|
287
|
-
meter (1.
|
288
|
+
meter (1.2.7)
|
288
289
|
locality (~> 1.1.0)
|
289
290
|
useragent (~> 0.16.3)
|
290
291
|
method_object (1.0.0)
|
@@ -357,7 +358,7 @@ GEM
|
|
357
358
|
rspec-support (3.9.0)
|
358
359
|
ruby-enum (0.7.2)
|
359
360
|
i18n
|
360
|
-
ruby-kafka (1.
|
361
|
+
ruby-kafka (1.0.0)
|
361
362
|
digest-crc
|
362
363
|
rubyzip (1.3.0)
|
363
364
|
safe_yaml (1.0.5)
|
@@ -390,10 +391,11 @@ GEM
|
|
390
391
|
thread_safe (~> 0.1)
|
391
392
|
unicode-display_width (1.6.0)
|
392
393
|
useragent (0.16.10)
|
393
|
-
virtus (
|
394
|
+
virtus (1.0.5)
|
394
395
|
axiom-types (~> 0.1)
|
395
396
|
coercible (~> 1.0)
|
396
397
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
398
|
+
equalizer (~> 0.0, >= 0.0.9)
|
397
399
|
|
398
400
|
PLATFORMS
|
399
401
|
ruby
|
data/README.md
CHANGED
@@ -1,36 +1,3 @@
|
|
1
1
|
A library for decoupling applications by using messaging to communicate between components.
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
### Setting up Postgresql and Kafka:
|
6
|
-
|
7
|
-
```
|
8
|
-
$ docker-compose up -d kafka postgres
|
9
|
-
```
|
10
|
-
|
11
|
-
If you want to try different version of PG (the default is 12) you can use the environment variable PG_VERSION.
|
12
|
-
|
13
|
-
```
|
14
|
-
$ PG_VERSION=13 docker-compose up -Vd postgres
|
15
|
-
```
|
16
|
-
|
17
|
-
The -V option is for recreating the volume instead of using the one from the previous container. The volume are prefixed with the pg version so that they are indenpendent from each other.
|
18
|
-
|
19
|
-
|
20
|
-
If you already have PG and Kafka running with another compose project you can skip running them and use the environment variables EXTERNAL_NETWORK and NETWORK_NAME:
|
21
|
-
|
22
|
-
```
|
23
|
-
$ EXTERNAL_NETWORK=myproject_default NETWORK_NAME=external docker-compose start runner
|
24
|
-
```
|
25
|
-
|
26
|
-
### Setting up the development environment
|
27
|
-
|
28
|
-
The "runner" service is used for interacting with the code. Bundling, starting a console and running specs etc.
|
29
|
-
|
30
|
-
After PG and Kafka are up and running just run
|
31
|
-
|
32
|
-
```
|
33
|
-
$ bin/setup
|
34
|
-
```
|
35
|
-
|
36
|
-
TODO: Actually implement the bin/setup command :-)
|
3
|
+
More documentation and the code will be released in the near future...
|
data/bin/setup
CHANGED
@@ -1,21 +1,8 @@
|
|
1
|
-
#!/usr/bin/env
|
2
|
-
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
set -vx
|
3
5
|
|
4
|
-
|
5
|
-
APP_ROOT = File.expand_path('..', __dir__)
|
6
|
+
bundle install
|
6
7
|
|
7
|
-
|
8
|
-
system(*args) || abort("\n== Command #{args} failed ==")
|
9
|
-
end
|
10
|
-
|
11
|
-
FileUtils.chdir APP_ROOT do
|
12
|
-
# This script is a way to set up or update your development environment automatically.
|
13
|
-
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
14
|
-
# Add necessary setup steps to this file.
|
15
|
-
|
16
|
-
puts "\n== Setup development database =="
|
17
|
-
system! './bin/de rails db:reset'
|
18
|
-
|
19
|
-
puts "\n== Setup test database =="
|
20
|
-
system! './bin/de rails db:reset RAILS_ENV=test'
|
21
|
-
end
|
8
|
+
# Do any other automated setup that you need to do here
|
@@ -5,21 +5,69 @@ module Messaging
|
|
5
5
|
include Enumerable
|
6
6
|
|
7
7
|
def each
|
8
|
-
return enum_for(:each) unless block_given?
|
9
|
-
|
10
8
|
all_categories.each do |name|
|
11
9
|
yield Category.new(name)
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
13
|
+
# Get a category by name
|
14
|
+
#
|
15
|
+
# @param name [String] the name of the category
|
16
|
+
# @return [nil] if no category exists with the given name
|
17
|
+
# @return [Category]
|
15
18
|
def [](name)
|
19
|
+
category = all_categories.select { |c| c == name }
|
20
|
+
return unless category
|
21
|
+
|
22
|
+
Category.new(category)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Creates a table partition for the given category
|
26
|
+
#
|
27
|
+
# @param name [String] the name of the category
|
28
|
+
# @return [Category]
|
29
|
+
def create(name)
|
30
|
+
table_name = name.parameterize(separator: '_')
|
31
|
+
sql = <<~SQL
|
32
|
+
CREATE TABLE messaging.#{table_name}
|
33
|
+
PARTITION OF messaging.messages FOR VALUES IN ('#{name}');
|
34
|
+
SQL
|
35
|
+
connection.execute sql
|
16
36
|
Category.new(name)
|
17
37
|
end
|
18
38
|
|
39
|
+
# Drops the table partition (including all messages) for the given category
|
40
|
+
#
|
41
|
+
# @param name [String] the name of the category
|
42
|
+
def drop(name)
|
43
|
+
table_name = name.parameterize(separator: '_')
|
44
|
+
sql = <<~SQL
|
45
|
+
drop TABLE messaging.#{table_name}
|
46
|
+
SQL
|
47
|
+
connection.execute sql
|
48
|
+
end
|
49
|
+
|
19
50
|
private
|
20
51
|
|
21
52
|
def all_categories
|
22
|
-
|
53
|
+
@all_categories ||= fetch_categories
|
54
|
+
end
|
55
|
+
|
56
|
+
def fetch_categories
|
57
|
+
sql = <<~SQL
|
58
|
+
SELECT child.relname AS category
|
59
|
+
FROM pg_inherits
|
60
|
+
JOIN pg_class parent ON pg_inherits.inhparent = parent.oid
|
61
|
+
JOIN pg_class child ON pg_inherits.inhrelid = child.oid
|
62
|
+
JOIN pg_namespace ON pg_namespace.oid = parent.relnamespace
|
63
|
+
WHERE pg_namespace.nspname = 'messaging' AND child.relkind in ('r', 'p')
|
64
|
+
ORDER BY category
|
65
|
+
SQL
|
66
|
+
connection.select_values(sql)
|
67
|
+
end
|
68
|
+
|
69
|
+
def connection
|
70
|
+
SerializedMessage.connection
|
23
71
|
end
|
24
72
|
end
|
25
73
|
end
|
@@ -22,16 +22,11 @@ module Messaging
|
|
22
22
|
# @see Streams
|
23
23
|
attr_reader :streams
|
24
24
|
|
25
|
-
# @return [Categories] all the stream categories in the store
|
26
|
-
# @see Categories
|
27
|
-
attr_reader :categories
|
28
|
-
|
29
25
|
# Should not be used directly. Access the store though
|
30
26
|
# Messaging.message_store or Messaging::Adapters::Store[:postgres]
|
31
27
|
# @api private
|
32
28
|
def initialize
|
33
29
|
@streams = Streams.new
|
34
|
-
@categories = Categories.new
|
35
30
|
end
|
36
31
|
|
37
32
|
# Get a specific stream by name
|
@@ -41,8 +36,14 @@ module Messaging
|
|
41
36
|
streams[name]
|
42
37
|
end
|
43
38
|
|
39
|
+
# @return [Categories] all the stream categories in the store
|
40
|
+
# @see Categories
|
41
|
+
def categories
|
42
|
+
Categories.new
|
43
|
+
end
|
44
|
+
|
44
45
|
# Get a specific category by name
|
45
|
-
# @return [
|
46
|
+
# @return [Category]
|
46
47
|
# @see Messaging.category
|
47
48
|
def category(name)
|
48
49
|
categories[name]
|
@@ -19,16 +19,11 @@ module Messaging
|
|
19
19
|
|
20
20
|
register!
|
21
21
|
|
22
|
-
def create_schema
|
23
|
-
connection.execute 'CREATE SCHEMA IF NOT EXISTS messaging'
|
24
|
-
end
|
25
|
-
|
26
|
-
def create_id_sequence
|
27
|
-
connection.execute 'CREATE SEQUENCE IF NOT EXISTS messaging.messages_id_seq'
|
28
|
-
end
|
29
|
-
|
30
22
|
def create_messages_table
|
31
23
|
sql = <<~SQL
|
24
|
+
CREATE SCHEMA IF NOT EXISTS messaging;
|
25
|
+
CREATE SEQUENCE IF NOT EXISTS messaging.messages_id_seq;
|
26
|
+
|
32
27
|
CREATE TABLE messaging.messages (
|
33
28
|
id bigint DEFAULT nextval('messaging.messages_id_seq'::regclass) NOT NULL,
|
34
29
|
uuid uuid NOT NULL,
|
@@ -50,22 +45,7 @@ module Messaging
|
|
50
45
|
connection.execute sql
|
51
46
|
end
|
52
47
|
|
53
|
-
|
54
|
-
table_name = category_name.parameterize(separator: '_')
|
55
|
-
sql = <<~SQL
|
56
|
-
CREATE TABLE messaging.#{table_name}
|
57
|
-
PARTITION OF messaging.messages FOR VALUES IN ('#{category_name}');
|
58
|
-
SQL
|
59
|
-
connection.execute sql
|
60
|
-
end
|
61
|
-
|
62
|
-
def drop_category(category_name)
|
63
|
-
table_name = category_name.parameterize(separator: '_')
|
64
|
-
sql = <<~SQL
|
65
|
-
drop TABLE messaging.#{table_name}
|
66
|
-
SQL
|
67
|
-
connection.execute sql
|
68
|
-
end
|
48
|
+
private
|
69
49
|
|
70
50
|
def connection
|
71
51
|
ActiveRecord::Base.connection
|
data/lib/messaging/config.rb
CHANGED
@@ -2,56 +2,56 @@ module Messaging
|
|
2
2
|
class Config
|
3
3
|
extend ::Dry::Configurable
|
4
4
|
|
5
|
-
setting :app_name,
|
5
|
+
setting :app_name, 'messaging', reader: true
|
6
6
|
|
7
|
-
setting(:error_handlers,
|
7
|
+
setting(:error_handlers, [], reader: true) { |value| Array(value) }
|
8
8
|
|
9
|
-
setting :background_job_handler,
|
9
|
+
setting :background_job_handler, ->(message, handler_name) { handler_name.constantize.call(message) }, reader: true
|
10
10
|
|
11
|
-
setting :logger,
|
11
|
+
setting :logger, Logger.new(STDOUT), reader: true
|
12
12
|
|
13
13
|
setting :consumer, reader: true do
|
14
|
-
setting :adapter,
|
15
|
-
setting(:middlewares,
|
14
|
+
setting :adapter, :kafka
|
15
|
+
setting(:middlewares, []) { |value| Array(value) }
|
16
16
|
end
|
17
17
|
|
18
18
|
setting :dispatcher, reader: true do
|
19
|
-
setting :adapter,
|
20
|
-
setting(:middlewares,
|
19
|
+
setting :adapter, :kafka
|
20
|
+
setting(:middlewares, []) { |value| Array(value) }
|
21
21
|
end
|
22
22
|
|
23
23
|
setting :message_store, reader: true do
|
24
|
-
setting :adapter,
|
25
|
-
setting(:middlewares,
|
24
|
+
setting :adapter, :postgres
|
25
|
+
setting(:middlewares, []) { |value| Array(value) }
|
26
26
|
end
|
27
27
|
|
28
28
|
setting :kafka, reader: true do
|
29
|
-
setting :log_level,
|
30
|
-
setting :pause_timeout,
|
29
|
+
setting :log_level, :warn
|
30
|
+
setting :pause_timeout, 10
|
31
31
|
|
32
32
|
setting :client do
|
33
|
-
setting :seed_brokers,
|
33
|
+
setting :seed_brokers, ['localhost:9092']
|
34
34
|
setting :connect_timeout
|
35
35
|
setting :socket_timeout
|
36
36
|
setting :ssl_ca_certs_from_system
|
37
37
|
setting :sasl_plain_username
|
38
38
|
setting :sasl_plain_password
|
39
|
-
setting :ssl_ca_cert,
|
40
|
-
setting :ssl_client_cert,
|
41
|
-
setting :ssl_client_cert_key,
|
39
|
+
setting :ssl_ca_cert, ENV['KAFKA_SSL_CA']
|
40
|
+
setting :ssl_client_cert, ENV['KAFKA_SSL_CERTIFICATE']
|
41
|
+
setting :ssl_client_cert_key, ENV['KAFKA_SSL_KEY']
|
42
42
|
end
|
43
43
|
|
44
44
|
setting :consumer do
|
45
|
-
setting :session_timeout,
|
46
|
-
setting :offset_commit_interval,
|
47
|
-
setting :offset_commit_threshold,
|
48
|
-
setting :heartbeat_interval,
|
45
|
+
setting :session_timeout, 30
|
46
|
+
setting :offset_commit_interval, 10
|
47
|
+
setting :offset_commit_threshold, 0
|
48
|
+
setting :heartbeat_interval, 10
|
49
49
|
end
|
50
50
|
|
51
51
|
setting :producer do
|
52
|
-
setting :max_queue_size,
|
53
|
-
setting :delivery_threshold,
|
54
|
-
setting :delivery_interval,
|
52
|
+
setting :max_queue_size, 5_000
|
53
|
+
setting :delivery_threshold, 10
|
54
|
+
setting :delivery_interval, 0.05
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
data/lib/messaging/version.rb
CHANGED
data/lib/messaging.rb
CHANGED
@@ -67,6 +67,17 @@ module Messaging
|
|
67
67
|
result
|
68
68
|
end
|
69
69
|
|
70
|
+
# Access the stream categories in the current message store
|
71
|
+
#
|
72
|
+
# @example Creating a new category
|
73
|
+
# Messaging.categories.create('customer')
|
74
|
+
#
|
75
|
+
# @return [Messaging::Adapters::Test::Categories] when using the test adapter
|
76
|
+
# @return [Messaging::Adapters::Postgres::Categories] when using the postgres adapter
|
77
|
+
def self.categories
|
78
|
+
message_store.categories
|
79
|
+
end
|
80
|
+
|
70
81
|
def self.category(name)
|
71
82
|
message_store.category(name)
|
72
83
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: messaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bukowskis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -271,10 +271,8 @@ extensions: []
|
|
271
271
|
extra_rdoc_files: []
|
272
272
|
files:
|
273
273
|
- ".circleci/config.yml"
|
274
|
-
- ".env"
|
275
274
|
- ".gitignore"
|
276
275
|
- ".rspec"
|
277
|
-
- Dockerfile
|
278
276
|
- Gemfile
|
279
277
|
- Gemfile.lock
|
280
278
|
- README.md
|
@@ -283,10 +281,7 @@ files:
|
|
283
281
|
- _data/navigation.yml
|
284
282
|
- _layouts/single.html
|
285
283
|
- bin/console
|
286
|
-
- bin/de
|
287
284
|
- bin/setup
|
288
|
-
- bin/setup_db
|
289
|
-
- docker-compose.yml
|
290
285
|
- docs/adapters.md
|
291
286
|
- docs/consuming.md
|
292
287
|
- docs/installation.md
|
data/Dockerfile
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# ** Common setup for all stages
|
2
|
-
ARG BASE_IMAGE=ruby:2.6.6-buster
|
3
|
-
FROM $BASE_IMAGE
|
4
|
-
|
5
|
-
ARG PG_VERSION=12
|
6
|
-
ENV LANG=C.UTF-8
|
7
|
-
|
8
|
-
# See https://askubuntu.com/questions/972516/debian-frontend-environment-variable/972528#972528
|
9
|
-
ENV DEBIAN_FRONTEND=noninteractive
|
10
|
-
|
11
|
-
RUN apt-get update -q \
|
12
|
-
&& apt-get install -yq --no-install-recommends \
|
13
|
-
build-essential \
|
14
|
-
curl \
|
15
|
-
gnupg \
|
16
|
-
less \
|
17
|
-
postgresql-common \
|
18
|
-
vim \
|
19
|
-
wget
|
20
|
-
|
21
|
-
# Install Postgresql apt repository so we can install PG
|
22
|
-
RUN (yes || true) | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
|
23
|
-
|
24
|
-
# Install more packages after updated apt-repos
|
25
|
-
RUN apt-get update -q \
|
26
|
-
&& apt-get install --no-install-recommends -yq \
|
27
|
-
libpq-dev \
|
28
|
-
postgresql-client-$PG_VERSION
|
29
|
-
|
30
|
-
# Create a directory for the app code
|
31
|
-
RUN mkdir -p /app
|
32
|
-
WORKDIR /app
|
33
|
-
ENV PATH=/app/bin:$PATH
|
34
|
-
|
35
|
-
# Configure bundler
|
36
|
-
ENV BUNDLE_JOBS=4
|
37
|
-
ENV BUNDLE_RETRY=3
|
data/bin/de
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
project_name=${PWD##*/}
|
4
|
-
|
5
|
-
get_container_id () {
|
6
|
-
docker container ls | grep "${project_name}_runner" | awk '{print $1}'
|
7
|
-
}
|
8
|
-
|
9
|
-
container_id=$([[ $(get_container_id) ]] || docker-compose up -d runner && get_container_id)
|
10
|
-
|
11
|
-
docker exec -it $container_id "${@}"
|
data/bin/setup_db
DELETED
data/docker-compose.yml
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
version: '3.4'
|
2
|
-
|
3
|
-
x-shared: &shared
|
4
|
-
build:
|
5
|
-
context: .
|
6
|
-
dockerfile: ./Dockerfile
|
7
|
-
args:
|
8
|
-
RUBY_VERSION: ${RUBY_VERSION}
|
9
|
-
BASE_IMAGE: ruby:${RUBY_VERSION}
|
10
|
-
PG_VERSION: ${PG_VERSION}
|
11
|
-
tmpfs:
|
12
|
-
- /tmp
|
13
|
-
environment:
|
14
|
-
- RAILS_ENV=${RAILS_ENV:-development}
|
15
|
-
- BOOTSNAP_CACHE_DIR=/rails_cache/bootsnap
|
16
|
-
volumes:
|
17
|
-
- .:/app
|
18
|
-
- bundle:/usr/local/bundle
|
19
|
-
networks:
|
20
|
-
- ${NETWORK_NAME:-default}
|
21
|
-
|
22
|
-
services:
|
23
|
-
runner:
|
24
|
-
<<: *shared
|
25
|
-
stdin_open: true
|
26
|
-
tty: true
|
27
|
-
command: /bin/sh
|
28
|
-
|
29
|
-
postgres:
|
30
|
-
image: postgres:${PG_VERSION}
|
31
|
-
volumes:
|
32
|
-
- pg_data:/var/lib/postgresql/data
|
33
|
-
ports:
|
34
|
-
- 5432:5432
|
35
|
-
environment:
|
36
|
-
- POSTGRES_HOST_AUTH_METHOD=trust
|
37
|
-
|
38
|
-
zookeeper:
|
39
|
-
image: zookeeper
|
40
|
-
ports:
|
41
|
-
- "2181:2181"
|
42
|
-
|
43
|
-
kafka:
|
44
|
-
image: niks123123/kafka:2.7.0
|
45
|
-
ports:
|
46
|
-
- "9092:9092"
|
47
|
-
depends_on:
|
48
|
-
- zookeeper
|
49
|
-
environment:
|
50
|
-
KAFKA_ADVERTISED_HOST_NAME: kafka
|
51
|
-
KAFKA_ADVERTISED_PORT: 9092
|
52
|
-
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
53
|
-
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
|
54
|
-
volumes:
|
55
|
-
- /var/run/docker.sock:/var/run/docker.sock
|
56
|
-
|
57
|
-
volumes:
|
58
|
-
bundle:
|
59
|
-
name: bundle_${RUBY_VERSION}
|
60
|
-
pg_data:
|
61
|
-
name: pg_data_${PG_VERSION}
|
62
|
-
|
63
|
-
networks:
|
64
|
-
default:
|
65
|
-
name: messaging_default
|
66
|
-
external:
|
67
|
-
name: ${EXTERNAL_NETWORK}
|
68
|
-
external: true
|