arkaan 0.10.7 → 0.10.8
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/arkaan/utils/micro_service.rb +15 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0294c1f449b9ad2dace99ca7319a2cc6f9b54577'
|
4
|
+
data.tar.gz: d0b6545ac34de59f7ab5c6cdf577b88af9c649d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e5e04ada9207c4b1baf87db6e334d31945aace473d292c6b3de6af7fffbd2b857fb034aa6e2d186cb59ee3383e0e5c14989a8887efa96cedb306fcea00c01c1
|
7
|
+
data.tar.gz: cea86ab1de42efd8841e18019c44a929c6e13a8f7b56bf592e43264efdeb6ec913f8fece8a4fc359baf04169a3aab63b776073cf027e36480545c777a038b04f
|
@@ -14,6 +14,9 @@ module Arkaan
|
|
14
14
|
# @!attribute [r] name
|
15
15
|
# @return [String] the name of the service, used later to instantiate it when the mongoid configuration is fully loaded.
|
16
16
|
attr_reader :name
|
17
|
+
# @!attribute [r] instance
|
18
|
+
# @return [Arkaan::Monitoring::Instance] the instance of the service currently deployed.
|
19
|
+
attr_reader :instance
|
17
20
|
|
18
21
|
def initialize
|
19
22
|
@location = false
|
@@ -72,6 +75,15 @@ module Arkaan
|
|
72
75
|
return self
|
73
76
|
end
|
74
77
|
|
78
|
+
# Deactivates the current instance and the associated service if no more instances are available.
|
79
|
+
def deactivate
|
80
|
+
instance.update_attribute(:running, false)
|
81
|
+
service.reload
|
82
|
+
if service.instances.where(running: true).count == 0
|
83
|
+
service.update_attribute(:active, false)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
75
87
|
private
|
76
88
|
|
77
89
|
# Registers the service in the database if it has not been created already.
|
@@ -82,11 +94,11 @@ module Arkaan
|
|
82
94
|
# Register the instance of the currently deployed service in the database.
|
83
95
|
# @return [Arkaan::Monitoring::Instance] the instance of the micro service currently running.
|
84
96
|
def register_instance
|
85
|
-
instance = @service.instances.where(url: ENV['SERVICE_URL']).first
|
97
|
+
@instance = @service.instances.where(url: ENV['SERVICE_URL']).first
|
86
98
|
if instance.nil?
|
87
|
-
instance = Arkaan::Monitoring::Instance.create(service: @service, url: ENV['SERVICE_URL'])
|
99
|
+
@instance = Arkaan::Monitoring::Instance.create(service: @service, url: ENV['SERVICE_URL'])
|
88
100
|
end
|
89
|
-
return instance
|
101
|
+
return @instance
|
90
102
|
end
|
91
103
|
|
92
104
|
# Loads the configuration for Mongoid, the files of the application, and registers the service and the instance in the database.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arkaan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Courtois
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|