rubypitaya 1.7.0 → 1.8.2
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/Makefile +4 -0
- data/lib/rubypitaya/app-template/Rakefile +22 -0
- data/lib/rubypitaya/app-template/app/constants/status_codes.rb +18 -11
- data/lib/rubypitaya/app-template/docker-compose.yml +2 -2
- data/lib/rubypitaya/app-template/kubernetes/deployment-rubypitaya.yaml +1 -1
- data/lib/rubypitaya/app-template/kubernetes/statefulset-postgres.yaml +4 -2
- data/lib/rubypitaya/core/config.rb +1 -1
- data/lib/rubypitaya/core/database_config.rb +2 -0
- data/lib/rubypitaya/core/main.rb +1 -0
- data/lib/rubypitaya/core/redis_connector.rb +7 -8
- data/lib/rubypitaya/core/status_codes.rb +18 -0
- data/lib/rubypitaya/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98578f08422524b11b61a8501ece0db64a473dc3d421292dc4f96736c2b97227
|
4
|
+
data.tar.gz: ad35ec4d5ed83954a9fa0bca5c95d6fee579863b5826a63115c0f98b988bc4ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18dc452f364538e9c9fd8c8fdd0b57b74c140fd7501fb6492f3bc954051803bb35e31c5f5f29a232438634eae9868aec710efc45133aeb3d3bd00203ed6d8223
|
7
|
+
data.tar.gz: 7dee2039fc3efa7db3a25b439edace0cbd60cf12d84f13e0170c946f6a3bca5105fe92d16ac22c6b8092b4412faa389d8e1cce7812bfbdf75956b0b0c0ca8eb0
|
@@ -62,7 +62,7 @@ GEM
|
|
62
62
|
diff-lcs (>= 1.2.0, < 2.0)
|
63
63
|
rspec-support (~> 3.8.0)
|
64
64
|
rspec-support (3.8.3)
|
65
|
-
rubypitaya (1.
|
65
|
+
rubypitaya (1.8.2)
|
66
66
|
activerecord (= 6.0.2)
|
67
67
|
etcdv3 (= 0.10.2)
|
68
68
|
eventmachine (= 1.2.7)
|
@@ -85,7 +85,7 @@ DEPENDENCIES
|
|
85
85
|
pry (= 0.12.2)
|
86
86
|
rake (= 10.0)
|
87
87
|
rspec (= 3.8.0)
|
88
|
-
rubypitaya (= 1.
|
88
|
+
rubypitaya (= 1.8.2)
|
89
89
|
|
90
90
|
BUNDLED WITH
|
91
91
|
1.17.2
|
@@ -30,6 +30,10 @@ db-create:
|
|
30
30
|
db-migrate:
|
31
31
|
@docker-compose run --service-ports --rm rubypitaya bundle exec rake db:migrate
|
32
32
|
|
33
|
+
## Rollback migrations STEP=1
|
34
|
+
db-rollback:
|
35
|
+
@docker-compose run --service-ports --rm -e STEP="$(STEP)" rubypitaya bundle exec rake db:rollback
|
36
|
+
|
33
37
|
## Drop database
|
34
38
|
db-drop:
|
35
39
|
@docker-compose run --service-ports --rm rubypitaya bundle exec rake db:drop
|
@@ -33,6 +33,28 @@ namespace :db do
|
|
33
33
|
puts 'Database migrated.'
|
34
34
|
end
|
35
35
|
|
36
|
+
desc 'Rollback migrations'
|
37
|
+
task :rollback do
|
38
|
+
environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
|
39
|
+
database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
|
40
|
+
connection_data = database_config.connection_data
|
41
|
+
|
42
|
+
step = ENV["STEP"] ? ENV["STEP"].to_i : 1
|
43
|
+
|
44
|
+
if step == 0
|
45
|
+
puts ''
|
46
|
+
puts 'Error: No rollback to STEP=0'
|
47
|
+
puts ''
|
48
|
+
return
|
49
|
+
end
|
50
|
+
|
51
|
+
ActiveRecord::Base.establish_connection(connection_data)
|
52
|
+
ActiveRecord::Base.connection.migration_context.rollback(step)
|
53
|
+
ActiveRecord::Base.connection.close
|
54
|
+
|
55
|
+
puts 'Rollback done.'
|
56
|
+
end
|
57
|
+
|
36
58
|
desc 'Drop the database'
|
37
59
|
task :drop do
|
38
60
|
environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
|
@@ -1,15 +1,22 @@
|
|
1
1
|
class StatusCodes
|
2
|
-
# Success codes
|
3
|
-
CODE_OK = 'RP-200'
|
4
2
|
|
5
|
-
|
6
|
-
CODE_UNKNOWN = 'RP-000'
|
7
|
-
CODE_HANDLER_NOT_FOUNDED = 'RP-001'
|
8
|
-
CODE_ACTION_NOT_FOUNDED = 'RP-002'
|
9
|
-
CODE_NOT_AUTHENTICATED = 'RP-003'
|
10
|
-
CODE_AUTHENTICATION_ERROR = 'RP-004'
|
3
|
+
CODE_OK = RubyPitaya::StatusCodes::CODE_OK
|
11
4
|
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
################
|
6
|
+
## Existent Codes
|
7
|
+
################
|
8
|
+
## Success codes
|
9
|
+
#
|
10
|
+
# RubyPitaya::StatusCodes::CODE_OK = 'RP-200'
|
11
|
+
#
|
12
|
+
#
|
13
|
+
## Error codes
|
14
|
+
# RubyPitaya::StatusCodes::CODE_UNKNOWN = 'RP-000'
|
15
|
+
# RubyPitaya::StatusCodes::CODE_HANDLER_NOT_FOUNDED = 'RP-001'
|
16
|
+
# RubyPitaya::StatusCodes::CODE_ACTION_NOT_FOUNDED = 'RP-002'
|
17
|
+
# RubyPitaya::StatusCodes::CODE_NOT_AUTHENTICATED = 'RP-003'
|
18
|
+
# RubyPitaya::StatusCodes::CODE_AUTHENTICATION_ERROR = 'RP-004'
|
19
|
+
#
|
20
|
+
# RubyPitaya::StatusCodes::Connector::CODE_UNKNOWN = 'PIT-000'
|
21
|
+
################
|
15
22
|
end
|
@@ -22,7 +22,7 @@ services:
|
|
22
22
|
- 'postgres:/var/lib/postgresql/data'
|
23
23
|
environment:
|
24
24
|
POSTGRES_USER: 'postgres'
|
25
|
-
|
25
|
+
POSTGRES_PASSWORD: 'postgres'
|
26
26
|
ports:
|
27
27
|
- '9100:5432'
|
28
28
|
|
@@ -67,7 +67,7 @@ services:
|
|
67
67
|
REDIS_URL: 'redis://redis:6379'
|
68
68
|
DATABASE_HOST: 'db'
|
69
69
|
DATABASE_USER: 'postgres'
|
70
|
-
DATABASE_PASSWORD: ''
|
70
|
+
DATABASE_PASSWORD: 'postgres'
|
71
71
|
DATABASE_NAME: 'ruby_pitaya'
|
72
72
|
|
73
73
|
volumes:
|
@@ -19,8 +19,10 @@ spec:
|
|
19
19
|
- name: postgres
|
20
20
|
image: postgres:9.6.17
|
21
21
|
env:
|
22
|
-
- name:
|
23
|
-
value: "
|
22
|
+
- name: POSTGRES_USER
|
23
|
+
value: "postgres"
|
24
|
+
- name: POSTGRES_PASSWORD
|
25
|
+
value: "postgres"
|
24
26
|
- name: PGDATA
|
25
27
|
value: "/var/lib/postgresql/data/pgdata"
|
26
28
|
ports:
|
@@ -25,6 +25,7 @@ module RubyPitaya
|
|
25
25
|
'pool': config['pool'],
|
26
26
|
'host': config['host'],
|
27
27
|
'user': config['user'],
|
28
|
+
'password': config['password'],
|
28
29
|
'database': config['database'],
|
29
30
|
}
|
30
31
|
end
|
@@ -36,6 +37,7 @@ module RubyPitaya
|
|
36
37
|
'pool': config['pool'],
|
37
38
|
'host': config['host'],
|
38
39
|
'user': config['user'],
|
40
|
+
'password': config['password'],
|
39
41
|
}
|
40
42
|
end
|
41
43
|
|
data/lib/rubypitaya/core/main.rb
CHANGED
@@ -8,6 +8,7 @@ require 'rubypitaya/core/session'
|
|
8
8
|
require 'rubypitaya/core/postman'
|
9
9
|
require 'rubypitaya/core/parameters'
|
10
10
|
require 'rubypitaya/core/routes_base'
|
11
|
+
require 'rubypitaya/core/status_codes'
|
11
12
|
require 'rubypitaya/core/handler_router'
|
12
13
|
require 'rubypitaya/core/etcd_connector'
|
13
14
|
require 'rubypitaya/core/nats_connector'
|
@@ -12,15 +12,14 @@ module RubyPitaya
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def connect
|
15
|
-
@redis = Redis.new(
|
15
|
+
@redis = Redis.new(
|
16
|
+
url: @redis_address,
|
17
|
+
:reconnect_attempts => 10,
|
18
|
+
:reconnect_delay => 1.5,
|
19
|
+
:reconnect_delay_max => 2.0,
|
20
|
+
)
|
16
21
|
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_connection
|
21
|
-
@redis.set('tmp', 'value')
|
22
|
-
@redis.get('tmp')
|
23
|
-
@redis.del('tmp')
|
22
|
+
@redis.ping
|
24
23
|
end
|
25
24
|
end
|
26
25
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RubyPitaya
|
2
|
+
|
3
|
+
class StatusCodes
|
4
|
+
# Success codes
|
5
|
+
CODE_OK = 'RP-200'
|
6
|
+
|
7
|
+
# Error codes
|
8
|
+
CODE_UNKNOWN = 'RP-000'
|
9
|
+
CODE_HANDLER_NOT_FOUNDED = 'RP-001'
|
10
|
+
CODE_ACTION_NOT_FOUNDED = 'RP-002'
|
11
|
+
CODE_NOT_AUTHENTICATED = 'RP-003'
|
12
|
+
CODE_AUTHENTICATION_ERROR = 'RP-004'
|
13
|
+
|
14
|
+
class Connector
|
15
|
+
CODE_UNKNOWN = 'PIT-000'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
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: 1.
|
4
|
+
version: 1.8.2
|
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-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -201,7 +201,6 @@ files:
|
|
201
201
|
- "./lib/rubypitaya/app-template/app/handlers/player_handler.rb"
|
202
202
|
- "./lib/rubypitaya/app-template/app/models/player.rb"
|
203
203
|
- "./lib/rubypitaya/app-template/app/models/user.rb"
|
204
|
-
- "./lib/rubypitaya/app-template/apptemplate-0.1.0.gem"
|
205
204
|
- "./lib/rubypitaya/app-template/bin/console"
|
206
205
|
- "./lib/rubypitaya/app-template/config/database.yml"
|
207
206
|
- "./lib/rubypitaya/app-template/config/routes.rb"
|
@@ -245,6 +244,7 @@ files:
|
|
245
244
|
- "./lib/rubypitaya/core/redis_connector.rb"
|
246
245
|
- "./lib/rubypitaya/core/routes_base.rb"
|
247
246
|
- "./lib/rubypitaya/core/session.rb"
|
247
|
+
- "./lib/rubypitaya/core/status_codes.rb"
|
248
248
|
- "./lib/rubypitaya/version.rb"
|
249
249
|
- bin/rubypitaya
|
250
250
|
homepage: https://gitlab.com/LucianoPC/ruby-pitaya
|