legionio 0.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +136 -0
  3. data/.gitignore +15 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +94 -0
  6. data/CHANGELOG.md +37 -0
  7. data/Dockerfile +9 -0
  8. data/Gemfile +3 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +162 -0
  11. data/Rakefile +32 -0
  12. data/bitbucket-pipelines.yml +20 -0
  13. data/docker_deploy.rb +8 -0
  14. data/exe/legion +4 -0
  15. data/exe/legionio +53 -0
  16. data/exe/lex_gen +5 -0
  17. data/legionio.gemspec +64 -0
  18. data/lib/legion.rb +25 -0
  19. data/lib/legion/cli.rb +56 -0
  20. data/lib/legion/cli/chain.rb +35 -0
  21. data/lib/legion/cli/cohort.rb +10 -0
  22. data/lib/legion/cli/function.rb +41 -0
  23. data/lib/legion/cli/lex/actor.rb +31 -0
  24. data/lib/legion/cli/lex/exchange.rb +32 -0
  25. data/lib/legion/cli/lex/message.rb +32 -0
  26. data/lib/legion/cli/lex/queue.rb +45 -0
  27. data/lib/legion/cli/lex/runner.rb +70 -0
  28. data/lib/legion/cli/lex/templates/actor.erb +6 -0
  29. data/lib/legion/cli/lex/templates/actor_spec.erb +0 -0
  30. data/lib/legion/cli/lex/templates/base/bitbucket.yml.erb +69 -0
  31. data/lib/legion/cli/lex/templates/base/gemfile.erb +3 -0
  32. data/lib/legion/cli/lex/templates/base/gemspec.erb +26 -0
  33. data/lib/legion/cli/lex/templates/base/gitignore.erb +11 -0
  34. data/lib/legion/cli/lex/templates/base/lex.erb +9 -0
  35. data/lib/legion/cli/lex/templates/base/lex_spec.erb +5 -0
  36. data/lib/legion/cli/lex/templates/base/lic.erb +21 -0
  37. data/lib/legion/cli/lex/templates/base/rakefile.erb +6 -0
  38. data/lib/legion/cli/lex/templates/base/readme.md.erb +2 -0
  39. data/lib/legion/cli/lex/templates/base/rubocop.yml.erb +15 -0
  40. data/lib/legion/cli/lex/templates/base/spec_helper.rb.erb +11 -0
  41. data/lib/legion/cli/lex/templates/base/version.erb +7 -0
  42. data/lib/legion/cli/lex/templates/exchange.erb +11 -0
  43. data/lib/legion/cli/lex/templates/exchange_spec.erb +0 -0
  44. data/lib/legion/cli/lex/templates/message.erb +23 -0
  45. data/lib/legion/cli/lex/templates/message_spec.erb +0 -0
  46. data/lib/legion/cli/lex/templates/queue.erb +12 -0
  47. data/lib/legion/cli/lex/templates/queue_helper.erb +24 -0
  48. data/lib/legion/cli/lex/templates/queue_spec.erb +11 -0
  49. data/lib/legion/cli/lex/templates/runner.erb +11 -0
  50. data/lib/legion/cli/lex/templates/runner_spec.erb +11 -0
  51. data/lib/legion/cli/relationship.rb +22 -0
  52. data/lib/legion/cli/task.rb +49 -0
  53. data/lib/legion/cli/trigger.rb +88 -0
  54. data/lib/legion/cli/version.rb +5 -0
  55. data/lib/legion/extensions.rb +219 -0
  56. data/lib/legion/extensions/actors/base.rb +47 -0
  57. data/lib/legion/extensions/actors/every.rb +48 -0
  58. data/lib/legion/extensions/actors/loop.rb +32 -0
  59. data/lib/legion/extensions/actors/nothing.rb +15 -0
  60. data/lib/legion/extensions/actors/once.rb +40 -0
  61. data/lib/legion/extensions/actors/poll.rb +87 -0
  62. data/lib/legion/extensions/actors/subscription.rb +139 -0
  63. data/lib/legion/extensions/builders/actors.rb +61 -0
  64. data/lib/legion/extensions/builders/base.rb +36 -0
  65. data/lib/legion/extensions/builders/helpers.rb +24 -0
  66. data/lib/legion/extensions/builders/runners.rb +58 -0
  67. data/lib/legion/extensions/core.rb +131 -0
  68. data/lib/legion/extensions/data.rb +58 -0
  69. data/lib/legion/extensions/data/migrator.rb +28 -0
  70. data/lib/legion/extensions/data/model.rb +8 -0
  71. data/lib/legion/extensions/helpers/base.rb +82 -0
  72. data/lib/legion/extensions/helpers/cache.rb +23 -0
  73. data/lib/legion/extensions/helpers/core.rb +41 -0
  74. data/lib/legion/extensions/helpers/data.rb +23 -0
  75. data/lib/legion/extensions/helpers/lex.rb +48 -0
  76. data/lib/legion/extensions/helpers/logger.rb +44 -0
  77. data/lib/legion/extensions/helpers/task.rb +60 -0
  78. data/lib/legion/extensions/helpers/transport.rb +44 -0
  79. data/lib/legion/extensions/transport.rb +159 -0
  80. data/lib/legion/lex.rb +89 -0
  81. data/lib/legion/process.rb +124 -0
  82. data/lib/legion/runner.rb +55 -0
  83. data/lib/legion/runner/log.rb +10 -0
  84. data/lib/legion/runner/status.rb +69 -0
  85. data/lib/legion/service.rb +130 -0
  86. data/lib/legion/supervision.rb +15 -0
  87. data/lib/legion/version.rb +3 -0
  88. metadata +239 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 975a4241d50fa9fb365969e764bd3c1efd21f4633a08219562091be186c2dbf6
4
- data.tar.gz: 1abdd099d6ca58f013d9c04e4b8e662aa9d58d73c83580308029326190ab9acd
3
+ metadata.gz: 7990b0c192a08c1fd8569cc2a08718c695814136f39c8df08e2b7b4753bfd216
4
+ data.tar.gz: 3f2bd0e6d8b7108d5ad17a069927bd7d6e5b4e1ba2dc6746ffac3582f11b9cdc
5
5
  SHA512:
6
- metadata.gz: 8103b343813c674ead056c47d778023011c62b74b2878a15ed9e58b1c74cbf93f7565b4fe89dfab4ae27c4dcf35ab99a4e7ff6f628bfbf8a6902669cdb2ea026
7
- data.tar.gz: 2c8be72aebd8831bb88881a4de35fca123d67d6247181811a85dd9340c7cdf6743f9e7cb10f528307d250b3ed312193036f486f5905147b7eda11643c61935be
6
+ metadata.gz: '05488db705432fec76ee9c07cc5655871e37abfbe02db5319fd2fb9ca60ad637c4d16eb44572f4f8cbac38b54ffbee75c49d3ccfadd7b4c9357996779a21f4fa'
7
+ data.tar.gz: 80fc575ff7e64dc60c60510aebb158c0e0cae2608158f1722e15e64718da43111efc760e4dc8891fc014c42dede039b66bcb99e3ef8ff0b0a80c735d79172f5c
@@ -0,0 +1,136 @@
1
+ version: 2.1 # use CircleCI 2.0
2
+ jobs:
3
+ "rubocop":
4
+ docker:
5
+ - image: circleci/ruby:2.5-node
6
+ steps:
7
+ - checkout
8
+ - run: gem install rubocop rubocop-rspec rubocop-rake
9
+ - run:
10
+ name: Run Rubocop
11
+ command: rubocop
12
+ - store_test_results:
13
+ path: test_results
14
+ "ruby-three":
15
+ docker:
16
+ - image: circleci/ruby:3-node
17
+ - image: mysql:5.7
18
+ environment:
19
+ MYSQL_DATABASE: 'legion'
20
+ MYSQL_ROOT_PASSWORD: 'legion'
21
+ MYSQL_USER: 'legion'
22
+ MYSQL_PASSWORD: 'legion'
23
+ - image: rabbitmq:3.7
24
+ steps:
25
+ - checkout
26
+ - run:
27
+ name: bundle update
28
+ command: gem update bundler
29
+ - run:
30
+ name: Bundle Install
31
+ command: bundle install
32
+ - run:
33
+ name: Run RSpec
34
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
35
+ when: always
36
+ - store_test_results:
37
+ path: test-results
38
+ "ruby-two-seven":
39
+ docker:
40
+ - image: circleci/ruby:2.7-node
41
+ - image: mysql:5.7
42
+ environment:
43
+ MYSQL_DATABASE: 'legion'
44
+ MYSQL_ROOT_PASSWORD: 'legion'
45
+ MYSQL_USER: 'legion'
46
+ MYSQL_PASSWORD: 'legion'
47
+ - image: rabbitmq:3.7
48
+ steps:
49
+ - checkout
50
+ - run:
51
+ name: bundle update
52
+ command: gem update bundler
53
+ - run:
54
+ name: Bundle Install
55
+ command: bundle install
56
+ - run:
57
+ name: Run RSpec
58
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
59
+ when: always
60
+ - store_test_results:
61
+ path: test-results
62
+ "ruby-two-five":
63
+ docker:
64
+ - image: circleci/ruby:2.5-node
65
+ - image: mysql:5.7
66
+ environment:
67
+ MYSQL_DATABASE: 'legion'
68
+ MYSQL_ROOT_PASSWORD: 'legion'
69
+ MYSQL_USER: 'legion'
70
+ MYSQL_PASSWORD: 'legion'
71
+ - image: rabbitmq:3.7
72
+ steps:
73
+ - checkout
74
+ - run:
75
+ name: bundle update
76
+ command: gem update bundler
77
+ - run:
78
+ name: Bundle Install
79
+ command: bundle install
80
+ - run:
81
+ name: Run RSpec
82
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
83
+ when: always
84
+ - store_test_results:
85
+ path: test-results
86
+ "ruby-two-six":
87
+ docker:
88
+ - image: circleci/ruby:2.6-node
89
+ - image: mysql:5.7
90
+ environment:
91
+ MYSQL_DATABASE: 'legion'
92
+ MYSQL_ROOT_PASSWORD: 'legion'
93
+ MYSQL_USER: 'legion'
94
+ MYSQL_PASSWORD: 'legion'
95
+ - image: rabbitmq:3.7
96
+ steps:
97
+ - checkout
98
+ - run:
99
+ name: bundle update
100
+ command: gem update bundler
101
+ - run:
102
+ name: Bundle Install
103
+ command: bundle install
104
+ - run:
105
+ name: Run RSpec
106
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
107
+ when: always
108
+ - store_test_results:
109
+ path: test-results
110
+
111
+ workflows:
112
+ version: 2
113
+ cop_rake_deploy:
114
+ jobs:
115
+ - rubocop
116
+ - ruby-two-seven:
117
+ requires:
118
+ - ruby-two-five
119
+ filters:
120
+ branches:
121
+ only: /\bdevelop\b|\bmaster\b/
122
+ - ruby-two-five:
123
+ requires:
124
+ - rubocop
125
+ - ruby-two-six:
126
+ requires:
127
+ - ruby-two-five
128
+ filters:
129
+ branches:
130
+ only: /\bdevelop\b|\bmaster\b/
131
+ - ruby-three:
132
+ requires:
133
+ - ruby-two-five
134
+ filters:
135
+ branches:
136
+ only: /\bdevelop\b|\bmaster\b/
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /legion/.idea/
11
+ /.idea/
12
+ *.key
13
+ # rspec failure tracking
14
+ .rspec_status
15
+ legionio.key
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,94 @@
1
+ require:
2
+ - rubocop-rspec
3
+
4
+ RSpec/FilePath:
5
+ Enabled: false
6
+ Layout/LineLength:
7
+ Max: 160
8
+ IgnoredPatterns:
9
+ - .unknown
10
+ - .fatal
11
+ - .error
12
+ - .warn
13
+ - .info
14
+ - .debug
15
+ - .trace
16
+ Metrics:
17
+ IgnorePatterns:
18
+ - .unknown
19
+ - .fatal
20
+ - .error
21
+ - .warn
22
+ - .info
23
+ - .debug
24
+ - .trace
25
+ Metrics/MethodLength:
26
+ Max: 50
27
+ IgnoredMethods:
28
+ - .unknown
29
+ - .fatal
30
+ - .error
31
+ - .warn
32
+ - .info
33
+ - .debug
34
+ - .trace
35
+ Metrics/ClassLength:
36
+ Max: 1500
37
+ Metrics/ModuleLength:
38
+ Max: 1500
39
+ Metrics/BlockLength:
40
+ Max: 40
41
+ IgnoredMethods:
42
+ - .unknown
43
+ - .fatal
44
+ - .error
45
+ - .warn
46
+ - .info
47
+ - .debug
48
+ - .trace
49
+ Metrics/AbcSize:
50
+ Max: 50
51
+ IgnoredMethods:
52
+ - .unknown
53
+ - .fatal
54
+ - .error
55
+ - .warn
56
+ - .info
57
+ - .debug
58
+ - .trace
59
+ Metrics/CyclomaticComplexity:
60
+ Max: 15
61
+ IgnoredMethods:
62
+ - .unknown
63
+ - .fatal
64
+ - .error
65
+ - .warn
66
+ - .info
67
+ - .debug
68
+ - .trace
69
+ Metrics/PerceivedComplexity:
70
+ Max: 17
71
+ IgnoredMethods:
72
+ - .unknown
73
+ - .fatal
74
+ - .error
75
+ - .warn
76
+ - .info
77
+ - .debug
78
+ - .trace
79
+ Layout/SpaceAroundEqualsInParameterDefault:
80
+ EnforcedStyle: space
81
+ Style/SymbolArray:
82
+ Enabled: true
83
+ Layout/HashAlignment:
84
+ EnforcedHashRocketStyle: table
85
+ EnforcedColonStyle: table
86
+ Style/Documentation:
87
+ Enabled: false
88
+ AllCops:
89
+ TargetRubyVersion: 2.5
90
+ NewCops: enable
91
+ Style/FrozenStringLiteralComment:
92
+ Enabled: false
93
+ Naming/FileName:
94
+ Enabled: false
@@ -0,0 +1,37 @@
1
+ # Legion Changelog
2
+
3
+ ## v0.4.0
4
+ * Moving all legion-cli code to inside the legion gem instead of a seperate gem
5
+ * Removing bundled Legion::Data gem from LegionIO(must be installed with gem install legion-data)
6
+ * Removing JRuby support
7
+ * Removing the following gems from gemspec, hashdiff, legion-data, mysql2, sequel, bunny, bundler, codecov
8
+ * Skipping auto install if using bundler. It only works with the binary
9
+ * Adding new docker_deploy.rb script to automatically push a new docker tag with a deployment
10
+ * Adding multiple version dependencies to previously open ended gems
11
+ * Updating Dockerfile to have `--no-document --no-prerelease` flags
12
+ * Updating README
13
+ * Enabling rubocop-rspec
14
+ * Adding support to specify a LEX version to automatically install
15
+ * Updating `legion-transport` gem min version to 1.1.8
16
+
17
+ ## v0.3.6
18
+ * Updating executables to use Legion::CLI
19
+ * Updating bitbucket-pipelines
20
+ * Changing base legion command to legionio and updating Dockerfile
21
+ * Blocking truffleruby from using Legion:Data as it's slow for unknown reasons
22
+ * Changing task update reverting to RMQ message to level debug
23
+
24
+ ## v0.3.0
25
+ * Updating dependencies based on if we are using `JRUBY` or not
26
+ * Cleaning up some files and rubocop errors
27
+ * Adding new settings option for a lex definition with functionality to add it to the override settings stack
28
+ * Fixing supervision filename
29
+ * Cleaning up `Legion::Service`
30
+ * Cleaning up rogue comments
31
+ * Updating exe/legion to match bin/legion
32
+
33
+ ## v0.1.1
34
+ Testing
35
+
36
+ ## v0.1.0
37
+ Initial Release
@@ -0,0 +1,9 @@
1
+ FROM ruby:2.7-alpine
2
+ LABEL maintainer="Matthew Iverson <matthewdiverson@gmail.com>"
3
+
4
+ RUN mkdir /etc/legionio
5
+ RUN apk update && apk add build-base postgresql-dev mysql-client mariadb-dev tzdata gcc git
6
+
7
+ COPY . ./
8
+ RUN gem install legionio legion-data tzinfo-data tzinfo --no-document --no-prerelease
9
+ CMD legionio
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 BuildTools
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,162 @@
1
+ # LegionIO
2
+
3
+ LegionIO is a framework for automated and connecting things. You can see all the docs inside confluence
4
+ https://legionio.atlassian.net/wiki/spaces/LEGION/overview
5
+ https://legionio.atlassian.net/wiki/spaces/LEX/pages/7864551/Extensions
6
+
7
+ ### What does it do?
8
+ LegionIO is an async job engine designed for scheduling tasks and creating relationships between things that wouldn't
9
+ otherwise be connected. Relationships do not have to be a single path. Both of these would work
10
+ * `foo → bar → cat → dog`
11
+ ```
12
+ a → b → c
13
+ b → e → z
14
+ e → g
15
+ ```
16
+ In the second scenario, when a runs, it causes b to run which then causes both c and e to run in parallel
17
+
18
+ It supports both conditions and transformation. The idea of a transformation is you can't connect two indepedent services
19
+ and expect them to know how to talk to each other.
20
+
21
+ ### Running
22
+ Run `gem install legionio` to install legion. If you want to use database features, you will need to
23
+ run `gem install legion-data` also.
24
+
25
+ After installing gem you can use the commands `legionio` to start legion, `legion` to access things
26
+ and `lex_gen` to generate a new legion extension
27
+
28
+ ### Example Legion Extensions(LEX)
29
+ * [lex-http](https://bitbucket.org/legion-io/lex-http/src/master/) - Gives legion the ability to make http requests, [docs](https://legionio.atlassian.net/wiki/spaces/LEX/pages/12910593/Lex+Http)
30
+ * [lex-influxdb](https://bitbucket.org/legion-io/lex-influxdb/src/master/) - Write, read, and manage influxdb nodes, [docs](https://legionio.atlassian.net/wiki/spaces/LEX/pages/614891774/Lex+Influxdb)
31
+ * [lex-log](https://bitbucket.org/legion-io/lex-log/src/master/) - Send log items to either stdout or a file with lex-log, [docs](https://legionio.atlassian.net/wiki/spaces/LEX/pages/614858995/Lex+Log)
32
+ * [lex-memcache](https://bitbucket.org/legion-io/lex-memcached/src/master/) - run memcached commands like set, add, append, delete, flush, reset_stats against memcached servers, [docs](https://legionio.atlassian.net/wiki/spaces/LEX/pages/614858753/Lex+Memcached)
33
+ * [lex-pihole](https://bitbucket.org/legion-io/lex-pihole/src/master/) - Allows Legion to interact with [Pi-Hole](https://pi-hole.net/). Can do things like get status, add/remove domains from the list, etc
34
+ * [lex-ping](https://bitbucket.org/legion-io/lex-ping/src/master/) - You can ping things?, [docs](https://legionio.atlassian.net/wiki/spaces/LEX/pages/631373895/Lex+Ping)
35
+ * [lex-pushover](https://bitbucket.org/legion-io/lex-pushover/src/master/) - Connects Legion to [Pushover](https://pushover.net/), [docs]()
36
+ * [lex-redis](https://bitbucket.org/legion-io/lex-redis/src/master/) - similiar to lex-memcached but for redis
37
+ * [lex-sleepiq](https://bitbucket.org/legion-io/lex-sleepiq/src/master/) - Control your SleepIQ bed with Legion!
38
+ * [lex-ssh](https://bitbucket.org/legion-io/lex-ssh/src/master/) - Send commands to a server via SSH in an async fashion, [docs](https://legionio.atlassian.net/wiki/spaces/LEX/pages/614891551/Lex+SSH)
39
+
40
+ Bitbucket repos for extensions that are active or being worked on
41
+ [lex list](https://bitbucket.org/legion-io/workspace/projects/LEX)
42
+ A nice list in the wiki to view all the extensions, their docs and status
43
+ [Legion Extensions](https://legionio.atlassian.net/wiki/spaces/LEX/pages/7864551/Extensions)
44
+
45
+ ### Scheduling Tasks
46
+ 1) Ensure you have the Legion::Data gem installed and configured
47
+ 2) Make sure to have `lex-scheduler` extension installed so that it generates the schedules table in the database
48
+ 3) From there you can add a function to be run at a given cron syntax or interval
49
+ 4) Setting the interval column will make the job run X seconds after the last time it is completed and will ignore the cron colum
50
+ 5) Setting the cron column will ensure the job runs at the given times regardless of when it was run last, only works if interval is null
51
+ 6) Cron supports both `*/5 * * * *` style and verbose like `every minute` and `every day at noon`
52
+
53
+
54
+ ### Creating Relationships
55
+ To be populated
56
+
57
+ ### Conditions
58
+ You can create complex conditional statements to ensure that when a triggers b, b only runs if certain conditions
59
+ are met. Example conditional statement
60
+ ```json
61
+ {
62
+ "all": [{
63
+ "fact": "pet.type",
64
+ "value": "dog",
65
+ "operator": "equal"
66
+ },{
67
+ "fact":"pet.hungry",
68
+ "operator":"is_true"
69
+ }]
70
+ }
71
+
72
+ ```
73
+ You can nest conditions in an unlimited fashion to create and/or scenarios to meet your needs
74
+ ```json
75
+ {
76
+ "all": [
77
+ "any":[
78
+ {"fact":"pet.type", "value":"dog","operator":"equal"},
79
+ {"fact":"pet.type", "value":"cat","operator":"equal"}
80
+ ],
81
+ {
82
+ "fact": "pet.hungry",
83
+ "operator": "is_true"
84
+ },{
85
+ "fact":"pet.overweight",
86
+ "operator":"is_false"
87
+ }]
88
+ }
89
+ ```
90
+ *Conditions are supported by the `lex-conditioner` extension and are not required to be run inside the legion framework*
91
+ You can read the docs with more examples in the [wiki](https://legionio.atlassian.net/wiki/spaces/LEX/pages/614957181/Lex+Conditioner)
92
+
93
+
94
+ ### Transformations
95
+ Transformations are a critical piece of interconnecting two independent items. Without it, service B doesn't know what
96
+ to do with the result from service A
97
+ `lex-conditioner` uses a combination of the [tilt](https://rubygems.org/gems/tilt) gem and erb style syntax.
98
+ ##### Examples
99
+ Creating a new pagerduty incident
100
+ ```json
101
+ {"message":"New PagerDuty incident assigned to <%= assignee %> with a priority of <%= severity %>","from":"PagerDuty"}
102
+ ```
103
+ Example transformation to make the `lex-log` extension output a message
104
+ ```json
105
+ {"message":"transform2","level":"fatal"}
106
+ ```
107
+ You can also call Legion services to get the data you need, example sending a pushover message
108
+ ```json
109
+ {"message":"This is my pushover body", "title": "this is my title", "token":"<%= Legion::Settings['lex']['pushover']['token'] %>" }
110
+ ```
111
+ Or if you wanted to make a real time call via `Legion::Crypt` to get a [Hashicorp Vault](https://www.vaultproject.io/) value
112
+ ```json
113
+ {"message":"this is another body", "title":"vault token example", "token":"<%= Legion::Crypt.read('pushover/token') %> "}
114
+ ```
115
+ *Transformations are supported by the `lex-transformation` extension and are not "technically" required to be run inside the legion framework*
116
+ You can read the docs with more examples in the [wiki](https://legionio.atlassian.net/wiki/spaces/LEX/pages/612270222/Lex+Transformer)
117
+
118
+ ## FAQ
119
+ ### Does it scale?
120
+ Yes. Actually quite well. The framework uses RabbitMQ to ensure jobs are scheduled and run in a FIFO order. As you add
121
+ more works, it just subscribes to the queues the workers can support and does more work. It is really geared towards a
122
+ docker/K8 type of environment however it can be run locally, on a VM, etc.
123
+
124
+ As of right now, it has been tested to around 100 workers running in docker without any performance issues. You will
125
+ likely see performance issues on the DB or RabbitMQ side before Legion has issues.
126
+
127
+ Another benefit is that you can run multiple LEXs in one worker or you could have dedicated workers that only run a single LEX.
128
+ In example if you have to make a ton of ssh connections via `lex-ssh`, maybe you want to run 10 pods with no other extensions in them
129
+ but then run a pod with `lex-pagerduty`, `lex-log` and `lex-http` to send out notifications after each ssh task is completed
130
+
131
+ ### High Availability
132
+ Because you can run this thing with multiple processes and it will distribute the work, it is naturally HA oriented.
133
+ if a worker goes down for some reason, another one should pick it up(assuming another work has that LEX enabled). There
134
+ are no hidden features, pay walls, etc to get HA. Just run more instances of LegionIO
135
+
136
+ ### Price and License
137
+ LegionIO is completely free. It was build using free time. There are no features held back, no private repos.
138
+ Everything is under an MIT license to keep it as open as possible. With that, the devs can't always help with support,
139
+ well because it's free.
140
+
141
+ ### Who is it geared for?
142
+ Anyone? Everyone? It could be used in a homelab to automate updating VMs. It could be used by someone to take ESPHome
143
+ sensor data and pipe it to influxdb. At least that is what @Esity does. It could also be used by a company or enterprise looking
144
+ to replace other tools.
145
+
146
+ ### But it is written in ruby
147
+ Yep.
148
+
149
+ ### Similiar projects
150
+ There are multiple projects that are similiar. Some things like IFTTT are great(but is it?) but then again, cost money.
151
+ * [Node-Red](https://nodered.org/) - No HA but has some good features and a great drag and drop interface
152
+ * [n8n.io](https://n8n.io/) - Working on HA but [not there yet](https://github.com/n8n-io/n8n/pull/1294)
153
+ * [StackStorm](https://stackstorm.com/) - Written in Python, has potential but I feel they are removing features to convince you to pay for it
154
+ * [Jenkins](https://www.jenkins.io/) - It's jenkins. I don't need to say anything else
155
+ * [Huginn]() - Another IFTTT style app written in ruby. Not sure on this one but it doesn't have HA from what I can tell [github issue](https://github.com/huginn/huginn/issues/2198)
156
+
157
+ ### Other fun facts
158
+ * Supports Hashicorp vault for storing secrets/settings/etc
159
+ * Can enable global message encryption so that all messages going through RMQ are encrypted with aes-256-cbc
160
+ * Each worker generates a private/public key that can be used for internode communication, it also will generate a cluster secret
161
+ for all nodes to have so they can share data accross the entire cluster. The cluster secret by default is stored only in memory and
162
+ and is generated when the first worker starts