lex-node 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +69 -0
- data/.github/workflows/rubocop.yml +28 -0
- data/.rubocop.yml +1 -0
- data/Dockerfile +9 -0
- data/Gemfile +8 -2
- data/{LICENSE.txt → LICENSE} +0 -0
- data/docker_deploy.rb +13 -0
- data/lex-node.gemspec +6 -13
- data/lib/legion/extensions/node/actors/beat.rb +1 -1
- data/lib/legion/extensions/node/actors/vault.rb +27 -0
- data/lib/legion/extensions/node/actors/vault_token_request.rb +27 -0
- data/lib/legion/extensions/node/data_test/migrations/001_nodes_table.rb +26 -0
- data/lib/legion/extensions/node/data_test/migrations/002_node_history_table.rb +26 -0
- data/lib/legion/extensions/node/data_test/migrations/003_legion_version_colume.rb +8 -0
- data/lib/legion/extensions/node/data_test/migrations/004_node_extensions.rb +23 -0
- data/lib/legion/extensions/node/runners/beat.rb +2 -2
- data/lib/legion/extensions/node/runners/crypt.rb +1 -1
- data/lib/legion/extensions/node/runners/node.rb +6 -1
- data/lib/legion/extensions/node/runners/vault.rb +40 -0
- data/lib/legion/extensions/node/transport/exchanges/node.rb +3 -0
- data/lib/legion/extensions/node/transport/messages/beat.rb +2 -2
- data/lib/legion/extensions/node/transport/messages/push_vault_token.rb +32 -0
- data/lib/legion/extensions/node/transport/messages/request_vault_token.rb +28 -0
- data/lib/legion/extensions/node/transport/queues/vault.rb +7 -0
- data/lib/legion/extensions/node/version.rb +1 -1
- metadata +27 -103
- data/.circleci/config.yml +0 -82
- data/Gemfile.lock +0 -128
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/bitbucket-pipelines.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7a24355435f4062840c1a3a93f98da788c51103665bde303fa3c2ad1649889a
|
4
|
+
data.tar.gz: 152bb8170bf5c0176f45e268db29dd257d43839c9c7ea44f06f1da3d9a875bf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14ee4014b1699b58d51e866b30080247815d776c063cbee5764a1a1ee392d2d3a0cd2e34e41d573c9d804d74b5e67342f8641107eba2e6df840703a57f24e15e
|
7
|
+
data.tar.gz: 215ed3d105bbfa0af16ed2b3bc897019d54dd544f5368643e2256aa7649619c3d2e2da0ac0be2ba3f2813ea801a59400022d966dc7d8fa6645c51d01496eadd2
|
@@ -0,0 +1,69 @@
|
|
1
|
+
name: RSpec
|
2
|
+
on: [push, pull_request]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
rspec:
|
6
|
+
strategy:
|
7
|
+
fail-fast: false
|
8
|
+
matrix:
|
9
|
+
os: [ubuntu-latest]
|
10
|
+
ruby: [2.7]
|
11
|
+
runs-on: ${{ matrix.os }}
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: ${{ matrix.ruby }}
|
17
|
+
bundler-cache: true
|
18
|
+
- name: RSpec run
|
19
|
+
run: |
|
20
|
+
bash -c "
|
21
|
+
bundle exec rspec
|
22
|
+
[[ $? -ne 2 ]]
|
23
|
+
"
|
24
|
+
rspec-mri:
|
25
|
+
needs: rspec
|
26
|
+
strategy:
|
27
|
+
fail-fast: false
|
28
|
+
matrix:
|
29
|
+
os: [ ubuntu-latest ]
|
30
|
+
ruby: [2.5, 2.6, '3.0', head]
|
31
|
+
runs-on: ${{ matrix.os }}
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v2
|
34
|
+
- uses: ruby/setup-ruby@v1
|
35
|
+
with:
|
36
|
+
ruby-version: ${{ matrix.ruby }}
|
37
|
+
bundler-cache: true
|
38
|
+
- run: bundle exec rspec
|
39
|
+
rspec-jruby:
|
40
|
+
needs: rspec
|
41
|
+
strategy:
|
42
|
+
fail-fast: false
|
43
|
+
matrix:
|
44
|
+
os: [ ubuntu-latest ]
|
45
|
+
ruby: [ jruby, jruby-head]
|
46
|
+
runs-on: ${{ matrix.os }}
|
47
|
+
steps:
|
48
|
+
- uses: actions/checkout@v2
|
49
|
+
- uses: ruby/setup-ruby@v1
|
50
|
+
with:
|
51
|
+
ruby-version: ${{ matrix.ruby }}
|
52
|
+
bundler-cache: true
|
53
|
+
- run: JRUBY_OPTS="--debug" bundle exec rspec
|
54
|
+
rspec-truffleruby:
|
55
|
+
needs: rspec
|
56
|
+
strategy:
|
57
|
+
fail-fast: false
|
58
|
+
matrix:
|
59
|
+
os: [ ubuntu-latest ]
|
60
|
+
ruby: [truffleruby]
|
61
|
+
runs-on: ${{ matrix.os }}
|
62
|
+
steps:
|
63
|
+
- uses: actions/checkout@v2
|
64
|
+
- uses: ruby/setup-ruby@v1
|
65
|
+
with:
|
66
|
+
ruby-version: ${{ matrix.ruby }}
|
67
|
+
bundler-cache: true
|
68
|
+
- run: bundle exec rspec
|
69
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Rubocop
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
rubocop:
|
5
|
+
strategy:
|
6
|
+
fail-fast: false
|
7
|
+
matrix:
|
8
|
+
os: [ubuntu-latest]
|
9
|
+
ruby: [2.7]
|
10
|
+
runs-on: ${{ matrix.os }}
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- uses: ruby/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: ${{ matrix.ruby }}
|
16
|
+
bundler-cache: true
|
17
|
+
- name: Install Rubocop
|
18
|
+
run: gem install rubocop code-scanning-rubocop
|
19
|
+
- name: Rubocop run --no-doc
|
20
|
+
run: |
|
21
|
+
bash -c "
|
22
|
+
rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
|
23
|
+
[[ $? -ne 2 ]]
|
24
|
+
"
|
25
|
+
- name: Upload Sarif output
|
26
|
+
uses: github/codeql-action/upload-sarif@v1
|
27
|
+
with:
|
28
|
+
sarif_file: rubocop.sarif
|
data/.rubocop.yml
CHANGED
data/Dockerfile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
FROM legionio/legion:latest
|
2
|
+
LABEL maintainer="Matthew Iverson <matthewdiverson@gmail.com>"
|
3
|
+
|
4
|
+
RUN mkdir /etc/legionio
|
5
|
+
RUN apk update && apk add build-base tzdata gcc git
|
6
|
+
|
7
|
+
COPY . ./
|
8
|
+
RUN gem install lex-elastic_app_search --no-document --no-prerelease
|
9
|
+
CMD ruby --jit $(which legionio)
|
data/Gemfile
CHANGED
data/{LICENSE.txt → LICENSE}
RENAMED
File without changes
|
data/docker_deploy.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
name = 'node'
|
4
|
+
require "./lib/legion/extensions/#{name}/version"
|
5
|
+
version = Legion::Extensions::Node::VERSION
|
6
|
+
|
7
|
+
puts "Building docker image for Legion v#{version}"
|
8
|
+
system("docker build --tag legionio/lex-#{name}:v#{version} .")
|
9
|
+
puts 'Pushing to hub.docker.com'
|
10
|
+
system("docker push legionio/lex-#{name}:v#{version}")
|
11
|
+
system("docker tag legionio/lex-#{name}:v#{version} legionio/lex-#{name}:latest")
|
12
|
+
system("docker push legionio/lex-#{name}:latest")
|
13
|
+
puts 'completed'
|
data/lex-node.gemspec
CHANGED
@@ -7,26 +7,19 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.email = ['matthewdiverson@gmail.com']
|
8
8
|
|
9
9
|
spec.summary = 'Does Legion Node things'
|
10
|
-
spec.description = 'This lex is responsible for sending heartbeats,
|
11
|
-
spec.homepage = 'https://
|
10
|
+
spec.description = 'This lex is responsible for sending heartbeats, allowing for dynamic config, cluster secret, etc'
|
11
|
+
spec.homepage = 'https://github.com/LegionIO/lex-node'
|
12
12
|
spec.license = 'MIT'
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
14
14
|
|
15
15
|
spec.metadata['homepage_uri'] = spec.homepage
|
16
|
-
spec.metadata['source_code_uri'] = 'https://
|
17
|
-
spec.metadata['documentation_uri'] = 'https://
|
18
|
-
spec.metadata['changelog_uri'] = 'https://
|
19
|
-
spec.metadata['bug_tracker_uri'] = 'https://
|
16
|
+
spec.metadata['source_code_uri'] = 'https://github.com/LegionIO/lex-node'
|
17
|
+
spec.metadata['documentation_uri'] = 'https://github.com/LegionIO/lex-node'
|
18
|
+
spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-node'
|
19
|
+
spec.metadata['bug_tracker_uri'] = 'https://github.com/LegionIO/lex-node/issues'
|
20
20
|
|
21
21
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
22
22
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
23
|
end
|
24
24
|
spec.require_paths = ['lib']
|
25
|
-
|
26
|
-
spec.add_development_dependency 'legionio'
|
27
|
-
spec.add_development_dependency 'rake'
|
28
|
-
spec.add_development_dependency 'rspec'
|
29
|
-
spec.add_development_dependency 'rspec_junit_formatter'
|
30
|
-
spec.add_development_dependency 'rubocop'
|
31
|
-
spec.add_development_dependency 'simplecov', '< 0.18.0'
|
32
25
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Legion::Extensions::Node::Actor
|
2
|
+
class Vault < Legion::Extensions::Actors::Subscription
|
3
|
+
# def delay_start
|
4
|
+
# 2
|
5
|
+
# end
|
6
|
+
|
7
|
+
def runner_class
|
8
|
+
Legion::Extensions::Node::Runners::Vault
|
9
|
+
end
|
10
|
+
|
11
|
+
def disabled?
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
15
|
+
def use_runner?
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
def check_subtask?
|
20
|
+
false
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate_task?
|
24
|
+
false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Legion::Extensions::Node::Actor
|
2
|
+
class VaultTokenRequest < Legion::Extensions::Actors::Once
|
3
|
+
def runner_function
|
4
|
+
'request_token'
|
5
|
+
end
|
6
|
+
|
7
|
+
def runner_class
|
8
|
+
Legion::Extensions::Node::Runners::Vault
|
9
|
+
end
|
10
|
+
|
11
|
+
def use_runner?
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
15
|
+
def check_subtask?
|
16
|
+
false
|
17
|
+
end
|
18
|
+
|
19
|
+
def generate_task?
|
20
|
+
false
|
21
|
+
end
|
22
|
+
|
23
|
+
def delay
|
24
|
+
0
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
run "CREATE TABLE `nodes` (
|
4
|
+
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
5
|
+
`name` varchar(128) NOT NULL DEFAULT '',
|
6
|
+
`datacenter_id` int(11) unsigned DEFAULT NULL,
|
7
|
+
`environment_id` int(11) unsigned DEFAULT NULL,
|
8
|
+
`status` varchar(255) NOT NULL DEFAULT 'unknown',
|
9
|
+
`active` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
10
|
+
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
11
|
+
`updated` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
12
|
+
PRIMARY KEY (`id`),
|
13
|
+
UNIQUE KEY `name` (`name`),
|
14
|
+
KEY `active` (`active`),
|
15
|
+
KEY `status` (`status`),
|
16
|
+
KEY `node_datacenter_id` (`datacenter_id`),
|
17
|
+
KEY `node_environment_id` (`environment_id`),
|
18
|
+
CONSTRAINT `node_datacenter_id` FOREIGN KEY (`datacenter_id`) REFERENCES `datacenters` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
19
|
+
CONSTRAINT `node_environment_id` FOREIGN KEY (`environment_id`) REFERENCES `environments` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
20
|
+
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;"
|
21
|
+
end
|
22
|
+
|
23
|
+
down do
|
24
|
+
drop_table :nodes
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
run "
|
4
|
+
create table node_history
|
5
|
+
(
|
6
|
+
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
7
|
+
node_id int(11) unsigned not null,
|
8
|
+
previous_staus varchar(255) null,
|
9
|
+
status varchar(255) default active not null,
|
10
|
+
`modified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
11
|
+
`record_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
12
|
+
modified_by varchar(255) default 'node' not null,
|
13
|
+
PRIMARY KEY (`id`),
|
14
|
+
KEY `node_id` (`node_id`),
|
15
|
+
KEY `status` (`status`),
|
16
|
+
KEY `status` (`previous_status`),
|
17
|
+
CONSTRAINT `node_id` FOREIGN KEY (`nodes`) REFERENCES `nodes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
18
|
+
);
|
19
|
+
"
|
20
|
+
end
|
21
|
+
|
22
|
+
down do
|
23
|
+
drop_table :node_history
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
run "
|
4
|
+
create table node_extensions
|
5
|
+
(
|
6
|
+
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
7
|
+
node_id int(11) unsigned not null,
|
8
|
+
extension_id int(11) unsigned not null,
|
9
|
+
`record_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
10
|
+
PRIMARY KEY (`id`),
|
11
|
+
KEY `node_id` (`node_id`),
|
12
|
+
KEY `version` (`version`),
|
13
|
+
CONSTRAINT `node_id` FOREIGN KEY (`nodes`) REFERENCES `nodes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
14
|
+
CONSTRAINT `extension_id` FOREIGN KEY (`extensions`) REFERENCES `extensions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
15
|
+
);
|
16
|
+
"
|
17
|
+
end
|
18
|
+
|
19
|
+
down do
|
20
|
+
drop_table :node_extensions
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -2,10 +2,10 @@ module Legion::Extensions::Node::Runners
|
|
2
2
|
module Beat
|
3
3
|
include Legion::Extensions::Helpers::Transport
|
4
4
|
|
5
|
-
def beat(status: '
|
5
|
+
def beat(status: 'active', **opts)
|
6
6
|
log.debug 'sending hearbeat'
|
7
7
|
messages::Beat.new(status: status).publish
|
8
|
-
{ success: true, status: status, **opts }
|
8
|
+
{ success: true, status: status, version: Legion::VERSION || nil, **opts }
|
9
9
|
end
|
10
10
|
|
11
11
|
include Legion::Extensions::Helpers::Lex
|
@@ -24,7 +24,7 @@ module Legion::Extensions::Node::Runners
|
|
24
24
|
def request_public_keys(**_opts)
|
25
25
|
log.debug 'request_public_keys'
|
26
26
|
message_hash = { function: 'push_public_key' }
|
27
|
-
Legion::Extensions::Node::Transport::Messages::RequestPublicKeys.new(message_hash).publish
|
27
|
+
Legion::Extensions::Node::Transport::Messages::RequestPublicKeys.new(**message_hash).publish
|
28
28
|
{}
|
29
29
|
end
|
30
30
|
|
@@ -21,7 +21,7 @@ module Legion::Extensions::Node::Runners
|
|
21
21
|
message_hash = { function: 'update_public_key',
|
22
22
|
public_key: Legion::Crypt.public_key.to_s,
|
23
23
|
**Legion::Settings[:client] }
|
24
|
-
Legion::Extensions::Node::Transport::Messages::PublicKey.new(message_hash).publish
|
24
|
+
Legion::Extensions::Node::Transport::Messages::PublicKey.new(**message_hash).publish
|
25
25
|
{}
|
26
26
|
end
|
27
27
|
|
@@ -51,6 +51,11 @@ module Legion::Extensions::Node::Runners
|
|
51
51
|
{}
|
52
52
|
end
|
53
53
|
|
54
|
+
def receive_vault_token(message:, routing_key:, public_key:, **)
|
55
|
+
Legion::Extensions::Node::Runners::Vault.receive_vault_token(message: message, routing_key: routing_key,
|
56
|
+
public_key: public_key)
|
57
|
+
end
|
58
|
+
|
54
59
|
include Legion::Extensions::Helpers::Lex
|
55
60
|
end
|
56
61
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Legion::Extensions::Node::Runners
|
2
|
+
module Vault
|
3
|
+
def request_token(**)
|
4
|
+
return {} if Legion::Settings[:crypt][:vault][:connected]
|
5
|
+
return {} unless Legion::Settings[:crypt][:vault][:enabled]
|
6
|
+
|
7
|
+
request_vault_token
|
8
|
+
end
|
9
|
+
|
10
|
+
def request_vault_token(**)
|
11
|
+
Legion::Extensions::Node::Transport::Messages::RequestVaultToken.new.publish
|
12
|
+
{}
|
13
|
+
end
|
14
|
+
|
15
|
+
def receive_vault_token(message:, **opts) # rubocop:disable Metrics/AbcSize
|
16
|
+
return if Legion::Settings[:crypt][:vault][:connected]
|
17
|
+
|
18
|
+
Legion::Settings[:crypt][:vault][:token] = Legion::Crypt.decrypt_from_keypair(message: message)
|
19
|
+
%i[protocol address port].each do |setting|
|
20
|
+
next unless opts.key? setting
|
21
|
+
next unless Legion::Settings[:crypt][:vault][setting].nil?
|
22
|
+
|
23
|
+
Legion::Settings[:crypt][:vault][setting] = opts[setting]
|
24
|
+
end
|
25
|
+
Legion::Crypt.connect_vault
|
26
|
+
{}
|
27
|
+
end
|
28
|
+
|
29
|
+
def push_vault_token(public_key:, node_name:, **)
|
30
|
+
return {} unless Legion::Settings[:crypt][:vault][:token]
|
31
|
+
|
32
|
+
encrypted = Legion::Crypt.encrypt_from_keypair(message: Legion::Settings[:crypt][:vault][:token],
|
33
|
+
pub_key: public_key)
|
34
|
+
Legion::Extensions::Node::Transport::Messages::PushVaultToken.new(token: encrypted, queue_name: node_name).publish
|
35
|
+
{}
|
36
|
+
end
|
37
|
+
|
38
|
+
include Legion::Extensions::Helpers::Lex
|
39
|
+
end
|
40
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Legion::Extensions::Node::Transport::Messages
|
2
2
|
class Beat < Legion::Transport::Message
|
3
3
|
def routing_key
|
4
|
-
'
|
4
|
+
'status'
|
5
5
|
end
|
6
6
|
|
7
7
|
def type
|
@@ -17,7 +17,7 @@ module Legion::Extensions::Node::Transport::Messages
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def message
|
20
|
-
hash = {
|
20
|
+
hash = { name: Legion::Settings[:client][:hostname], pid: Process.pid, timestamp: Time.now }
|
21
21
|
hash[:status] = @options[:status].nil? ? 'healthy' : @options[:status]
|
22
22
|
hash
|
23
23
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Legion::Extensions::Node::Transport::Messages
|
2
|
+
class PushVaultToken < Legion::Transport::Message
|
3
|
+
def routing_key
|
4
|
+
"node.#{@options[:queue_name]}"
|
5
|
+
end
|
6
|
+
|
7
|
+
def exchange
|
8
|
+
Legion::Transport::Exchanges::Node
|
9
|
+
end
|
10
|
+
|
11
|
+
def message
|
12
|
+
{
|
13
|
+
function: 'receive_vault_token',
|
14
|
+
runner_class: 'Legion::Extensions::Node::Runners::Vault',
|
15
|
+
message: @options[:token],
|
16
|
+
public_key: Base64.encode64(Legion::Crypt.public_key)
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def type
|
21
|
+
'task'
|
22
|
+
end
|
23
|
+
|
24
|
+
def encrypt?
|
25
|
+
false
|
26
|
+
end
|
27
|
+
|
28
|
+
def validate
|
29
|
+
@valid = true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Legion::Extensions::Node::Transport::Messages
|
2
|
+
class RequestVaultToken < Legion::Transport::Message
|
3
|
+
def routing_key
|
4
|
+
'vault'
|
5
|
+
end
|
6
|
+
|
7
|
+
def message
|
8
|
+
{
|
9
|
+
function: 'push_vault_token',
|
10
|
+
node_name: Legion::Settings[:client][:name],
|
11
|
+
runner_class: 'Legion::Extensions::Node::Runners::Vault',
|
12
|
+
public_key: Legion::Crypt.public_key
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
def type
|
17
|
+
'task'
|
18
|
+
end
|
19
|
+
|
20
|
+
def encrypt?
|
21
|
+
false
|
22
|
+
end
|
23
|
+
|
24
|
+
def validate
|
25
|
+
@valid = true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,148 +1,72 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lex-node
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esity
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec_junit_formatter
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: simplecov
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "<"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.18.0
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "<"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.18.0
|
97
|
-
description: This lex is responsible for sending heartbeats, and allowing for dynamic
|
98
|
-
confgs
|
11
|
+
date: 2021-06-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: This lex is responsible for sending heartbeats, allowing for dynamic
|
14
|
+
config, cluster secret, etc
|
99
15
|
email:
|
100
16
|
- matthewdiverson@gmail.com
|
101
17
|
executables: []
|
102
18
|
extensions: []
|
103
19
|
extra_rdoc_files: []
|
104
20
|
files:
|
105
|
-
- ".
|
21
|
+
- ".github/workflows/rspec.yml"
|
22
|
+
- ".github/workflows/rubocop.yml"
|
106
23
|
- ".gitignore"
|
107
24
|
- ".rspec"
|
108
25
|
- ".rubocop.yml"
|
26
|
+
- Dockerfile
|
109
27
|
- Gemfile
|
110
|
-
-
|
111
|
-
- LICENSE.txt
|
28
|
+
- LICENSE
|
112
29
|
- README.md
|
113
|
-
-
|
114
|
-
- bin/console
|
115
|
-
- bin/setup
|
116
|
-
- bitbucket-pipelines.yml
|
30
|
+
- docker_deploy.rb
|
117
31
|
- lex-node.gemspec
|
118
32
|
- lib/legion/extensions/node.rb
|
119
33
|
- lib/legion/extensions/node/actors/beat.rb
|
120
34
|
- lib/legion/extensions/node/actors/crypt.rb
|
121
35
|
- lib/legion/extensions/node/actors/push_key.rb
|
36
|
+
- lib/legion/extensions/node/actors/vault.rb
|
37
|
+
- lib/legion/extensions/node/actors/vault_token_request.rb
|
38
|
+
- lib/legion/extensions/node/data_test/migrations/001_nodes_table.rb
|
39
|
+
- lib/legion/extensions/node/data_test/migrations/002_node_history_table.rb
|
40
|
+
- lib/legion/extensions/node/data_test/migrations/003_legion_version_colume.rb
|
41
|
+
- lib/legion/extensions/node/data_test/migrations/004_node_extensions.rb
|
122
42
|
- lib/legion/extensions/node/runners/beat.rb
|
123
43
|
- lib/legion/extensions/node/runners/crypt.rb
|
124
44
|
- lib/legion/extensions/node/runners/node.rb
|
45
|
+
- lib/legion/extensions/node/runners/vault.rb
|
125
46
|
- lib/legion/extensions/node/transport.rb
|
126
47
|
- lib/legion/extensions/node/transport/exchanges/node.rb
|
127
48
|
- lib/legion/extensions/node/transport/messages/beat.rb
|
128
49
|
- lib/legion/extensions/node/transport/messages/public_key.rb
|
129
50
|
- lib/legion/extensions/node/transport/messages/push_cluster_secret.rb
|
51
|
+
- lib/legion/extensions/node/transport/messages/push_vault_token.rb
|
130
52
|
- lib/legion/extensions/node/transport/messages/request_cluster_secret.rb
|
131
53
|
- lib/legion/extensions/node/transport/messages/request_public_keys.rb
|
54
|
+
- lib/legion/extensions/node/transport/messages/request_vault_token.rb
|
132
55
|
- lib/legion/extensions/node/transport/queues/crypt.rb
|
133
56
|
- lib/legion/extensions/node/transport/queues/health.rb
|
134
57
|
- lib/legion/extensions/node/transport/queues/node.rb
|
58
|
+
- lib/legion/extensions/node/transport/queues/vault.rb
|
135
59
|
- lib/legion/extensions/node/version.rb
|
136
60
|
- sonar-project.properties
|
137
|
-
homepage: https://
|
61
|
+
homepage: https://github.com/LegionIO/lex-node
|
138
62
|
licenses:
|
139
63
|
- MIT
|
140
64
|
metadata:
|
141
|
-
homepage_uri: https://
|
142
|
-
source_code_uri: https://
|
143
|
-
documentation_uri: https://
|
144
|
-
changelog_uri: https://
|
145
|
-
bug_tracker_uri: https://
|
65
|
+
homepage_uri: https://github.com/LegionIO/lex-node
|
66
|
+
source_code_uri: https://github.com/LegionIO/lex-node
|
67
|
+
documentation_uri: https://github.com/LegionIO/lex-node
|
68
|
+
changelog_uri: https://github.com/LegionIO/lex-node
|
69
|
+
bug_tracker_uri: https://github.com/LegionIO/lex-node/issues
|
146
70
|
post_install_message:
|
147
71
|
rdoc_options: []
|
148
72
|
require_paths:
|
@@ -158,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
82
|
- !ruby/object:Gem::Version
|
159
83
|
version: '0'
|
160
84
|
requirements: []
|
161
|
-
rubygems_version: 3.1.
|
85
|
+
rubygems_version: 3.1.6
|
162
86
|
signing_key:
|
163
87
|
specification_version: 4
|
164
88
|
summary: Does Legion Node things
|
data/.circleci/config.yml
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
version: 2.1
|
2
|
-
orbs:
|
3
|
-
ruby: circleci/ruby@0.2.1
|
4
|
-
sonarcloud: sonarsource/sonarcloud@1.0.1
|
5
|
-
|
6
|
-
jobs:
|
7
|
-
"rubocop":
|
8
|
-
docker:
|
9
|
-
- image: circleci/ruby:2.7-node
|
10
|
-
steps:
|
11
|
-
- checkout
|
12
|
-
- ruby/load-cache
|
13
|
-
- ruby/install-deps
|
14
|
-
- run:
|
15
|
-
name: Run Rubocop
|
16
|
-
command: bundle exec rubocop
|
17
|
-
- ruby/save-cache
|
18
|
-
"ruby-two-five":
|
19
|
-
docker:
|
20
|
-
- image: circleci/ruby:2.5
|
21
|
-
steps:
|
22
|
-
- checkout
|
23
|
-
- ruby/load-cache
|
24
|
-
- run:
|
25
|
-
name: update bundler
|
26
|
-
command: gem update bundler
|
27
|
-
- ruby/install-deps
|
28
|
-
- ruby/run-tests
|
29
|
-
- ruby/save-cache
|
30
|
-
"ruby-two-six":
|
31
|
-
docker:
|
32
|
-
- image: circleci/ruby:2.6
|
33
|
-
steps:
|
34
|
-
- checkout
|
35
|
-
- ruby/load-cache
|
36
|
-
- run:
|
37
|
-
name: update bundler
|
38
|
-
command: gem update bundler
|
39
|
-
- ruby/install-deps
|
40
|
-
- ruby/run-tests
|
41
|
-
- ruby/save-cache
|
42
|
-
"ruby-two-seven":
|
43
|
-
docker:
|
44
|
-
- image: circleci/ruby:2.7
|
45
|
-
steps:
|
46
|
-
- checkout
|
47
|
-
- ruby/load-cache
|
48
|
-
- ruby/install-deps
|
49
|
-
- ruby/run-tests
|
50
|
-
- ruby/save-cache
|
51
|
-
"sonarcloud":
|
52
|
-
docker:
|
53
|
-
- image: circleci/ruby:2.7
|
54
|
-
steps:
|
55
|
-
- checkout
|
56
|
-
- ruby/load-cache
|
57
|
-
- ruby/install-deps
|
58
|
-
- ruby/run-tests
|
59
|
-
- run:
|
60
|
-
name: Run Rubocop
|
61
|
-
command: bundle exec rubocop --format=json --out=rubocop-result.json
|
62
|
-
- sonarcloud/scan
|
63
|
-
- ruby/save-cache
|
64
|
-
|
65
|
-
workflows:
|
66
|
-
version: 2
|
67
|
-
rubocop-rspec:
|
68
|
-
jobs:
|
69
|
-
- rubocop
|
70
|
-
- ruby-two-five:
|
71
|
-
requires:
|
72
|
-
- rubocop
|
73
|
-
- ruby-two-six:
|
74
|
-
requires:
|
75
|
-
- ruby-two-five
|
76
|
-
- ruby-two-seven:
|
77
|
-
requires:
|
78
|
-
- ruby-two-five
|
79
|
-
- sonarcloud:
|
80
|
-
requires:
|
81
|
-
- ruby-two-seven
|
82
|
-
- ruby-two-six
|
data/Gemfile.lock
DELETED
@@ -1,128 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
lex-node (0.1.3)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
amq-protocol (2.3.2)
|
10
|
-
ast (2.4.1)
|
11
|
-
aws-eventstream (1.1.0)
|
12
|
-
aws-sigv4 (1.2.2)
|
13
|
-
aws-eventstream (~> 1, >= 1.0.2)
|
14
|
-
bunny (2.17.0)
|
15
|
-
amq-protocol (~> 2.3, >= 2.3.1)
|
16
|
-
concurrent-ruby (1.1.7)
|
17
|
-
concurrent-ruby-ext (1.1.7)
|
18
|
-
concurrent-ruby (= 1.1.7)
|
19
|
-
connection_pool (2.2.3)
|
20
|
-
daemons (1.3.1)
|
21
|
-
dalli (2.7.11)
|
22
|
-
diff-lcs (1.4.4)
|
23
|
-
docile (1.3.2)
|
24
|
-
hashdiff (1.0.1)
|
25
|
-
json (2.3.1)
|
26
|
-
json_pure (2.3.1)
|
27
|
-
legion-cache (1.0.0)
|
28
|
-
connection_pool
|
29
|
-
dalli
|
30
|
-
redis
|
31
|
-
legion-crypt (0.2.1)
|
32
|
-
vault
|
33
|
-
legion-data (1.1.4)
|
34
|
-
legion-logging
|
35
|
-
legion-settings
|
36
|
-
mysql2
|
37
|
-
sequel
|
38
|
-
legion-exceptions (1.1.2)
|
39
|
-
legion-json (1.1.2)
|
40
|
-
json_pure
|
41
|
-
multi_json
|
42
|
-
legion-logging (1.1.3)
|
43
|
-
rainbow (~> 3)
|
44
|
-
legion-settings (1.1.2)
|
45
|
-
legion-json
|
46
|
-
legion-logging
|
47
|
-
legion-transport (1.1.5)
|
48
|
-
bunny
|
49
|
-
concurrent-ruby
|
50
|
-
legion-json
|
51
|
-
legionio (0.3.4)
|
52
|
-
bunny
|
53
|
-
concurrent-ruby
|
54
|
-
concurrent-ruby-ext
|
55
|
-
daemons
|
56
|
-
hashdiff
|
57
|
-
legion-cache
|
58
|
-
legion-crypt
|
59
|
-
legion-data
|
60
|
-
legion-exceptions
|
61
|
-
legion-json
|
62
|
-
legion-logging
|
63
|
-
legion-settings
|
64
|
-
legion-transport
|
65
|
-
lex-node
|
66
|
-
oj
|
67
|
-
multi_json (1.15.0)
|
68
|
-
mysql2 (0.5.3)
|
69
|
-
oj (3.10.15)
|
70
|
-
parallel (1.19.2)
|
71
|
-
parser (2.7.2.0)
|
72
|
-
ast (~> 2.4.1)
|
73
|
-
rainbow (3.0.0)
|
74
|
-
rake (13.0.1)
|
75
|
-
redis (4.2.2)
|
76
|
-
regexp_parser (1.8.2)
|
77
|
-
rexml (3.2.4)
|
78
|
-
rspec (3.9.0)
|
79
|
-
rspec-core (~> 3.9.0)
|
80
|
-
rspec-expectations (~> 3.9.0)
|
81
|
-
rspec-mocks (~> 3.9.0)
|
82
|
-
rspec-core (3.9.3)
|
83
|
-
rspec-support (~> 3.9.3)
|
84
|
-
rspec-expectations (3.9.3)
|
85
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
-
rspec-support (~> 3.9.0)
|
87
|
-
rspec-mocks (3.9.1)
|
88
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
89
|
-
rspec-support (~> 3.9.0)
|
90
|
-
rspec-support (3.9.4)
|
91
|
-
rspec_junit_formatter (0.4.1)
|
92
|
-
rspec-core (>= 2, < 4, != 2.12.0)
|
93
|
-
rubocop (1.0.0)
|
94
|
-
parallel (~> 1.10)
|
95
|
-
parser (>= 2.7.1.5)
|
96
|
-
rainbow (>= 2.2.2, < 4.0)
|
97
|
-
regexp_parser (>= 1.8)
|
98
|
-
rexml
|
99
|
-
rubocop-ast (>= 0.6.0)
|
100
|
-
ruby-progressbar (~> 1.7)
|
101
|
-
unicode-display_width (>= 1.4.0, < 2.0)
|
102
|
-
rubocop-ast (1.0.1)
|
103
|
-
parser (>= 2.7.1.5)
|
104
|
-
ruby-progressbar (1.10.1)
|
105
|
-
sequel (5.37.0)
|
106
|
-
simplecov (0.17.1)
|
107
|
-
docile (~> 1.1)
|
108
|
-
json (>= 1.8, < 3)
|
109
|
-
simplecov-html (~> 0.10.0)
|
110
|
-
simplecov-html (0.10.2)
|
111
|
-
unicode-display_width (1.7.0)
|
112
|
-
vault (0.15.0)
|
113
|
-
aws-sigv4
|
114
|
-
|
115
|
-
PLATFORMS
|
116
|
-
ruby
|
117
|
-
|
118
|
-
DEPENDENCIES
|
119
|
-
legionio
|
120
|
-
lex-node!
|
121
|
-
rake
|
122
|
-
rspec
|
123
|
-
rspec_junit_formatter
|
124
|
-
rubocop
|
125
|
-
simplecov (< 0.18.0)
|
126
|
-
|
127
|
-
BUNDLED WITH
|
128
|
-
2.1.4
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'legion/extensions/node'
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require 'irb'
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/bitbucket-pipelines.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
image: ruby:2.7.0
|
2
|
-
|
3
|
-
pipelines:
|
4
|
-
tags:
|
5
|
-
"v*":
|
6
|
-
- step:
|
7
|
-
name: Push to RubyGems
|
8
|
-
deployment: RubyGems
|
9
|
-
script:
|
10
|
-
- gem install bundler gem-release rake rspec
|
11
|
-
- bundle install
|
12
|
-
- rake build
|
13
|
-
- mkdir .gem
|
14
|
-
- (umask 077 ; echo $gem_creds | base64 --decode > .gem/credentials)
|
15
|
-
- gem release
|
16
|
-
artifacts:
|
17
|
-
- pkg/**
|