rubypitaya 2.7.4 → 2.7.5
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 +4 -4
- data/lib/rubypitaya/app-template/Gemfile +1 -1
- data/lib/rubypitaya/app-template/Gemfile.lock +2 -2
- data/lib/rubypitaya/app-template/app/app_initializer.rb +7 -0
- data/lib/rubypitaya/app-template/docker-compose.yml +1 -0
- data/lib/rubypitaya/app-template/docker/dev/Dockerfile +1 -1
- data/lib/rubypitaya/app-template/kubernetes/role-rubypitaya.yaml +1 -1
- data/lib/rubypitaya/core/handler_base.rb +2 -1
- data/lib/rubypitaya/core/handler_router.rb +2 -1
- data/lib/rubypitaya/core/initializer_content.rb +3 -2
- data/lib/rubypitaya/core/main.rb +17 -8
- data/lib/rubypitaya/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78c0e17a12d24e8681424de7febeb3c496362c9efb6ddba566e2cb5a94a8e076
|
4
|
+
data.tar.gz: c01c5cdc3bd4adf77d1fae5479418d1f09f693e157b1bb28bc458260841198ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e54976ad166dfef5c686cbd75cabb7c15e2dbb991aa7946b43a120213e26d1fa46b414212d9c1d18a970b17a6689ac89c38c8bedc075670d0ed4ea9a1050253
|
7
|
+
data.tar.gz: d510fcd44c66d24be9b7f07de8184f8fbff14d24308abd7955f9d156a2d056bc7417b47cf9c50da0ad9b17e307f7471949b50883b542118a029376c6f35f36f2
|
@@ -69,7 +69,7 @@ GEM
|
|
69
69
|
rspec-support (~> 3.8.0)
|
70
70
|
rspec-support (3.8.3)
|
71
71
|
ruby2_keywords (0.0.2)
|
72
|
-
rubypitaya (2.7.
|
72
|
+
rubypitaya (2.7.5)
|
73
73
|
activerecord (= 6.0.2)
|
74
74
|
etcdv3 (= 0.10.2)
|
75
75
|
eventmachine (= 1.2.7)
|
@@ -106,7 +106,7 @@ DEPENDENCIES
|
|
106
106
|
listen (= 3.2.1)
|
107
107
|
pry (= 0.12.2)
|
108
108
|
rspec (= 3.8.0)
|
109
|
-
rubypitaya (= 2.7.
|
109
|
+
rubypitaya (= 2.7.5)
|
110
110
|
|
111
111
|
BUNDLED WITH
|
112
112
|
1.17.2
|
@@ -27,6 +27,13 @@ module MyApp
|
|
27
27
|
# - methods:
|
28
28
|
# - [](key)
|
29
29
|
# - get config file by config path
|
30
|
+
# - log
|
31
|
+
# - class: Logger
|
32
|
+
# - link: https://ruby-doc.org/stdlib-2.6.4/libdoc/logger/rdoc/Logger.html
|
33
|
+
# - methods:
|
34
|
+
# - info
|
35
|
+
# - log information
|
36
|
+
|
30
37
|
|
31
38
|
def run(initializer_content)
|
32
39
|
bll = initializer_content.bll
|
@@ -4,10 +4,11 @@ module RubyPitaya
|
|
4
4
|
|
5
5
|
class_attribute :non_authenticated_routes, default: []
|
6
6
|
|
7
|
-
attr_accessor :bll, :redis, :setup, :config, :params, :session, :postman
|
7
|
+
attr_accessor :bll, :log, :redis, :setup, :config, :params, :session, :postman
|
8
8
|
|
9
9
|
def initialize
|
10
10
|
@bll = nil
|
11
|
+
@log = nil
|
11
12
|
@redis = nil
|
12
13
|
@setup = nil
|
13
14
|
@config = nil
|
@@ -53,7 +53,7 @@ module RubyPitaya
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def call(handler_name, action_name, session, postman, redis, setup, config,
|
56
|
-
bll, params)
|
56
|
+
bll, log, params)
|
57
57
|
unless @handler_name_map.include?(handler_name)
|
58
58
|
return {
|
59
59
|
code: StatusCodes::CODE_HANDLER_NOT_FOUND,
|
@@ -71,6 +71,7 @@ module RubyPitaya
|
|
71
71
|
handler = @handler_name_map[handler_name]
|
72
72
|
|
73
73
|
handler.bll = bll
|
74
|
+
handler.log = log
|
74
75
|
handler.redis = redis
|
75
76
|
handler.setup = setup
|
76
77
|
handler.config = config
|
@@ -2,10 +2,11 @@ module RubyPitaya
|
|
2
2
|
|
3
3
|
class InitializerContent
|
4
4
|
|
5
|
-
attr_reader :bll, :redis, :setup, :config
|
5
|
+
attr_reader :bll, :log, :redis, :setup, :config
|
6
6
|
|
7
|
-
def initialize(bll, redis, setup, config)
|
7
|
+
def initialize(bll, log, redis, setup, config)
|
8
8
|
@bll = bll
|
9
|
+
@log = log
|
9
10
|
@redis = redis
|
10
11
|
@setup = setup
|
11
12
|
@config = config
|
data/lib/rubypitaya/core/main.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'socket'
|
2
|
+
require 'logger'
|
2
3
|
require 'securerandom'
|
3
4
|
require 'active_model'
|
4
5
|
|
@@ -32,6 +33,12 @@ module RubyPitaya
|
|
32
33
|
@environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
|
33
34
|
@is_development_environment = @environment_name == 'development'
|
34
35
|
|
36
|
+
@log = Logger.new('/proc/self/fd/1')
|
37
|
+
@log.level = Logger::INFO
|
38
|
+
@log.formatter = proc do |severity, datetime, progname, msg|
|
39
|
+
"#{msg}\n"
|
40
|
+
end
|
41
|
+
|
35
42
|
@application_files_importer = ApplicationFilesImporter.new
|
36
43
|
@application_files_importer.import
|
37
44
|
@application_files_importer.auto_reload if @is_development_environment
|
@@ -72,6 +79,7 @@ module RubyPitaya
|
|
72
79
|
@bll = InstanceHolder.new
|
73
80
|
|
74
81
|
@initializer_content = InitializerContent.new(@bll,
|
82
|
+
@log,
|
75
83
|
@redis_connector.redis,
|
76
84
|
@setup,
|
77
85
|
@config)
|
@@ -88,6 +96,7 @@ module RubyPitaya
|
|
88
96
|
|
89
97
|
def run_http
|
90
98
|
HttpRoutes.set :bll, @bll
|
99
|
+
HttpRoutes.set :log, @log
|
91
100
|
HttpRoutes.set :setup, @setup
|
92
101
|
HttpRoutes.set :config, @config
|
93
102
|
HttpRoutes.set :views, [Path::HTTP_VIEWS_PATH] + Path::Plugins::HTTP_VIEWS_PATHS
|
@@ -107,7 +116,7 @@ module RubyPitaya
|
|
107
116
|
Signal.trap("SIGQUIT") { throw :sig_shutdown }
|
108
117
|
Signal.trap("SIGTERM") { throw :sig_shutdown }
|
109
118
|
|
110
|
-
|
119
|
+
@log.info "Server started!"
|
111
120
|
run_nats_connection
|
112
121
|
end
|
113
122
|
|
@@ -122,7 +131,7 @@ module RubyPitaya
|
|
122
131
|
return if @is_shutting_down
|
123
132
|
@is_shutting_down = true
|
124
133
|
|
125
|
-
|
134
|
+
@log.info "Server shutting down..."
|
126
135
|
|
127
136
|
@etcd_connector.disconnect
|
128
137
|
@database_connector.disconnect
|
@@ -153,22 +162,22 @@ module RubyPitaya
|
|
153
162
|
|
154
163
|
handler_name, action_name = message_route.split('.')[1..-1]
|
155
164
|
|
156
|
-
|
157
|
-
|
165
|
+
@log.info "request -> route: #{message_route}"
|
166
|
+
@log.info " -> data: #{message_data}"
|
158
167
|
|
159
168
|
response = @handler_router.call(handler_name, action_name, @session,
|
160
169
|
@postman, @redis_connector.redis,
|
161
|
-
@setup, @config, @bll, params)
|
170
|
+
@setup, @config, @bll, @log, params)
|
162
171
|
|
163
172
|
delta_time_seconds = Time.now.to_i - start_time_seconds
|
164
173
|
|
165
|
-
|
174
|
+
@log.info "response [#{delta_time_seconds}s] -> #{response.to_json}"
|
166
175
|
|
167
176
|
response
|
168
177
|
end
|
169
178
|
rescue Exception => error
|
170
|
-
|
171
|
-
|
179
|
+
@log.info "ERROR: #{error}"
|
180
|
+
@log.info error.backtrace
|
172
181
|
run_nats_connection
|
173
182
|
end
|
174
183
|
end
|
data/lib/rubypitaya/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubypitaya
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luciano Prestes Cavalcanti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|