legionio 0.3.3 → 0.4.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.
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 +43 -0
  7. data/Dockerfile +9 -0
  8. data/Gemfile +3 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +161 -0
  11. data/Rakefile +32 -0
  12. data/bitbucket-pipelines.yml +19 -0
  13. data/docker_deploy.rb +10 -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 +243 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71d660a2d59b07d0e6ec0df18f1d86044fd2b2b223d7e0ac7b0990f37268f821
4
- data.tar.gz: 9db4e23dda3c7d36f96a70b1c666ef17e5fb8407592337bea02153c4e6372171
3
+ metadata.gz: 18444dfd34951349f85c06d265065ce86f5f23177075cfc089f6dad047e1b4e4
4
+ data.tar.gz: 45a621fe5581c323132c6f71d170b0a666bae5c3d87dd68034ad2b08136a3128
5
5
  SHA512:
6
- metadata.gz: 270fe9deafa5c72c94afb6181b37073207681fdf1d0dda2d1c331581af81faec90c230cbc565c62742a47931292b9dfcdffbdc86a03299dc72439a5104b567bb
7
- data.tar.gz: a5ccfdd6c7cf75491f0a3bd1507201a2dcbd57b242a243ee0151db637d20fca16a2dffe7dc77e4d456edc71fed4455f498023e9fb16834acd6bb2e8a49bf170e
6
+ metadata.gz: a3a3c790ce08fb2e918644108b9db447e422b08f6a6111d05e9430d1163df8383799dd1d24eff44bec66a960de9ea5384fe5a24a1e74308edb9e04d9f973a854
7
+ data.tar.gz: 13b5e61f5ebf03de343d8aaca383f46c28ea6d7f4f05dbd30ae74929a1fe5d7ced50b273de70d059c594c1bc0110f91de26b60c2992f79a6aad18102c6094a4d
@@ -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,43 @@
1
+ # Legion Changelog
2
+
3
+ ## v0.4.2
4
+ * Upgrading dockerfile to use ruby 3
5
+ * Fixing issue with `Kernel.const_defined?` for TruffleRuby
6
+ * Updating legion-transport requirement to 1.1.9
7
+ * Updating the Dockerfile to use JIT flag
8
+
9
+ ## v0.4.0
10
+ * Moving all legion-cli code to inside the legion gem instead of a seperate gem
11
+ * Removing bundled Legion::Data gem from LegionIO(must be installed with gem install legion-data)
12
+ * Removing JRuby support
13
+ * Removing the following gems from gemspec, hashdiff, legion-data, mysql2, sequel, bunny, bundler, codecov
14
+ * Skipping auto install if using bundler. It only works with the binary
15
+ * Adding new docker_deploy.rb script to automatically push a new docker tag with a deployment
16
+ * Adding multiple version dependencies to previously open ended gems
17
+ * Updating Dockerfile to have `--no-document --no-prerelease` flags
18
+ * Updating README
19
+ * Enabling rubocop-rspec
20
+ * Adding support to specify a LEX version to automatically install
21
+ * Updating `legion-transport` gem min version to 1.1.8
22
+
23
+ ## v0.3.6
24
+ * Updating executables to use Legion::CLI
25
+ * Updating bitbucket-pipelines
26
+ * Changing base legion command to legionio and updating Dockerfile
27
+ * Blocking truffleruby from using Legion:Data as it's slow for unknown reasons
28
+ * Changing task update reverting to RMQ message to level debug
29
+
30
+ ## v0.3.0
31
+ * Updating dependencies based on if we are using `JRUBY` or not
32
+ * Cleaning up some files and rubocop errors
33
+ * Adding new settings option for a lex definition with functionality to add it to the override settings stack
34
+ * Fixing supervision filename
35
+ * Cleaning up `Legion::Service`
36
+ * Cleaning up rogue comments
37
+ * Updating exe/legion to match bin/legion
38
+
39
+ ## v0.1.1
40
+ Testing
41
+
42
+ ## v0.1.0
43
+ Initial Release
@@ -0,0 +1,9 @@
1
+ FROM ruby:3-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 tzinfo-data tzinfo --no-document --no-prerelease
9
+ CMD ruby --jit $(which 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,161 @@
1
+ # LegionIO
2
+
3
+ LegionIO is a framework for automating 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
+ ### Creating Relationships
54
+ *To be populated*
55
+
56
+ ### Conditions
57
+ You can create complex conditional statements to ensure that when a triggers b, b only runs if certain conditions
58
+ are met. Example conditional statement
59
+ ```json
60
+ {
61
+ "all": [{
62
+ "fact": "pet.type",
63
+ "value": "dog",
64
+ "operator": "equal"
65
+ },{
66
+ "fact":"pet.hungry",
67
+ "operator":"is_true"
68
+ }]
69
+ }
70
+
71
+ ```
72
+ You can nest conditions in an unlimited fashion to create and/or scenarios to meet your needs
73
+ ```json
74
+ {
75
+ "all": [
76
+ "any":[
77
+ {"fact":"pet.type", "value":"dog","operator":"equal"},
78
+ {"fact":"pet.type", "value":"cat","operator":"equal"}
79
+ ],
80
+ {
81
+ "fact": "pet.hungry",
82
+ "operator": "is_true"
83
+ },{
84
+ "fact":"pet.overweight",
85
+ "operator":"is_false"
86
+ }]
87
+ }
88
+ ```
89
+ *Conditions are supported by the `lex-conditioner` extension and are not required to be run inside the legion framework*
90
+ You can read the docs with more examples in the [wiki](https://legionio.atlassian.net/wiki/spaces/LEX/pages/614957181/Lex+Conditioner)
91
+
92
+
93
+ ### Transformations
94
+ Transformations are a critical piece of interconnecting two independent items. Without it, service B doesn't know what
95
+ to do with the result from service A
96
+ `lex-conditioner` uses a combination of the [tilt](https://rubygems.org/gems/tilt) gem and erb style syntax.
97
+ ##### Examples
98
+ Creating a new pagerduty incident
99
+ ```json
100
+ {"message":"New PagerDuty incident assigned to <%= assignee %> with a priority of <%= severity %>","from":"PagerDuty"}
101
+ ```
102
+ Example transformation to make the `lex-log` extension output a message
103
+ ```json
104
+ {"message":"transform2","level":"fatal"}
105
+ ```
106
+ You can also call Legion services to get the data you need, example sending a pushover message
107
+ ```json
108
+ {"message":"This is my pushover body", "title": "this is my title", "token":"<%= Legion::Settings['lex']['pushover']['token'] %>" }
109
+ ```
110
+ Or if you wanted to make a real time call via `Legion::Crypt` to get a [Hashicorp Vault](https://www.vaultproject.io/) value
111
+ ```json
112
+ {"message":"this is another body", "title":"vault token example", "token":"<%= Legion::Crypt.read('pushover/token') %> "}
113
+ ```
114
+ *Transformations are supported by the `lex-transformation` extension and are not "technically" required to be run inside the legion framework*
115
+ You can read the docs with more examples in the [wiki](https://legionio.atlassian.net/wiki/spaces/LEX/pages/612270222/Lex+Transformer)
116
+
117
+ ## FAQ
118
+ ### Does it scale?
119
+ Yes. Actually quite well. The framework uses RabbitMQ to ensure jobs are scheduled and run in a FIFO order. As you add
120
+ more works, it just subscribes to the queues the workers can support and does more work. It is really geared towards a
121
+ docker/K8 type of environment however it can be run locally, on a VM, etc.
122
+
123
+ As of right now, it has been tested to around 100 workers running in docker without any performance issues. You will
124
+ likely see performance issues on the DB or RabbitMQ side before Legion has issues.
125
+
126
+ Another benefit is that you can run multiple LEXs in one worker or you could have dedicated workers that only run a single LEX.
127
+ 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
128
+ but then run a pod with `lex-pagerduty`, `lex-log` and `lex-http` to send out notifications after each ssh task is completed
129
+
130
+ ### High Availability
131
+ Because you can run this thing with multiple processes and it will distribute the work, it is naturally HA oriented.
132
+ if a worker goes down for some reason, another one should pick it up(assuming another work has that LEX enabled). There
133
+ are no hidden features, pay walls, etc to get HA. Just run more instances of LegionIO
134
+
135
+ ### Price and License
136
+ LegionIO is completely free. It was build using free time. There are no features held back, no private repos.
137
+ Everything is under an MIT license to keep it as open as possible. With that, the devs can't always help with support,
138
+ well because it's free.
139
+
140
+ ### Who is it geared for?
141
+ Anyone? Everyone? It could be used in a homelab to automate updating VMs. It could be used by someone to take ESPHome
142
+ 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
143
+ to replace other tools.
144
+
145
+ ### But it is written in ruby
146
+ Yep.
147
+
148
+ ### Similiar projects
149
+ There are multiple projects that are similiar. Some things like IFTTT are great(but is it?) but then again, cost money.
150
+ * [Node-Red](https://nodered.org/) - No HA but has some good features and a great drag and drop interface
151
+ * [n8n.io](https://n8n.io/) - Working on HA but [not there yet](https://github.com/n8n-io/n8n/pull/1294)
152
+ * [StackStorm](https://stackstorm.com/) - Written in Python, has potential but I feel they are removing features to convince you to pay for it
153
+ * [Jenkins](https://www.jenkins.io/) - It's jenkins. I don't need to say anything else
154
+ * [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)
155
+
156
+ ### Other fun facts
157
+ * Supports Hashicorp vault for storing secrets/settings/etc
158
+ * Can enable global message encryption so that all messages going through RMQ are encrypted with aes-256-cbc
159
+ * Each worker generates a private/public key that can be used for internode communication, it also will generate a cluster secret
160
+ 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
161
+ and is generated when the first worker starts