cloudmunda 0.1.1 → 0.1.4
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/.rubocop.yml +5 -7
- data/.rubocop_todo.yml +39 -0
- data/CHANGELOG.md +10 -2
- data/Gemfile +5 -5
- data/Gemfile.lock +129 -110
- data/README.md +164 -4
- data/Rakefile +3 -3
- data/bin/console +3 -3
- data/diagrams/demo.bpmn +47 -0
- data/exe/cloudmunda +8 -5
- data/lib/cloudmunda/api/access_token.rb +4 -4
- data/lib/cloudmunda/api/client.rb +2 -2
- data/lib/cloudmunda/api/o_auth_resource.rb +1 -5
- data/lib/cloudmunda/api.rb +2 -1
- data/lib/cloudmunda/cli/launcher.rb +2 -1
- data/lib/cloudmunda/cli/processor.rb +8 -7
- data/lib/cloudmunda/cli/supervisor.rb +11 -3
- data/lib/cloudmunda/cli/worker.rb +30 -7
- data/lib/cloudmunda/cli.rb +29 -30
- data/lib/cloudmunda/configuration.rb +8 -5
- data/lib/cloudmunda/graphql/client.rb +2 -1
- data/lib/cloudmunda/graphql.rb +3 -1
- data/lib/cloudmunda/loggable.rb +2 -0
- data/lib/cloudmunda/version.rb +1 -1
- data/lib/cloudmunda/zeebe/client.rb +18 -29
- data/lib/cloudmunda/zeebe.rb +3 -1
- data/lib/cloudmunda.rb +2 -2
- metadata +15 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 936e312ef49af3f00fc9c0d4f97b84ce173a8da8981273791a88977a3bb3cfe8
|
4
|
+
data.tar.gz: c9dc23a1bf6142d0bd0e49d22a9261cfcfb197bcc83b7a2ea7600407ea709579
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e937d7735c28308809b9c57e23fc4c40ceb6030a3ccce06d186d49848473fe42f40ddbaa9654954aabe4ed06e03616f7dc6c2721d05689cec71bce5ed39a2262
|
7
|
+
data.tar.gz: b75a37bc42b05a8c8e947d7243ec4b5d50cd9311d4a42afa16c505f1d04c01f239a0d660a41644ad1c3fda62cd187486628c7f393c3e9e66c61cbc33f3cbd8c7
|
data/.rubocop.yml
CHANGED
@@ -1,13 +1,11 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
1
3
|
AllCops:
|
2
4
|
TargetRubyVersion: 2.6
|
5
|
+
NewCops: enable
|
3
6
|
|
4
|
-
Style/
|
5
|
-
Enabled:
|
6
|
-
EnforcedStyle: double_quotes
|
7
|
-
|
8
|
-
Style/StringLiteralsInInterpolation:
|
9
|
-
Enabled: true
|
10
|
-
EnforcedStyle: double_quotes
|
7
|
+
Style/Documentation:
|
8
|
+
Enabled: false
|
11
9
|
|
12
10
|
Layout/LineLength:
|
13
11
|
Max: 120
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2022-02-25 21:56:34 UTC using RuboCop version 1.23.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 4
|
10
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
11
|
+
Metrics/AbcSize:
|
12
|
+
Max: 52
|
13
|
+
|
14
|
+
# Offense count: 1
|
15
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
16
|
+
# IgnoredMethods: refine
|
17
|
+
Metrics/BlockLength:
|
18
|
+
Max: 43
|
19
|
+
|
20
|
+
# Offense count: 1
|
21
|
+
# Configuration parameters: CountComments, CountAsOne.
|
22
|
+
Metrics/ClassLength:
|
23
|
+
Max: 117
|
24
|
+
|
25
|
+
# Offense count: 5
|
26
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
27
|
+
Metrics/MethodLength:
|
28
|
+
Max: 45
|
29
|
+
|
30
|
+
# Offense count: 8
|
31
|
+
Naming/AccessorMethodName:
|
32
|
+
Exclude:
|
33
|
+
- 'lib/cloudmunda/cli/worker.rb'
|
34
|
+
- 'lib/cloudmunda/zeebe/client.rb'
|
35
|
+
|
36
|
+
# Offense count: 1
|
37
|
+
Style/OpenStructUse:
|
38
|
+
Exclude:
|
39
|
+
- 'lib/cloudmunda/api/o_auth_resource.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.1.4] - 2022-08-09
|
4
|
+
- Rework how we use `runs_in_development` together with `type`. This is a very biased approach. What we do from now on if when in your job definition `runs_in_development` equals to true, we will add `-dev` to the type name.
|
5
|
+
|
6
|
+
## [0.1.3] - 2022-02-25
|
7
|
+
- Fix bug in `Supervisor#start` that would lead to not gracefully shutting down workers.
|
8
|
+
|
9
|
+
## [0.1.2] - 2022-02-25
|
10
|
+
- Add class method `runs_in_development` to Cloudmunda::Worker. This way you can run only specific jobs in development.
|
11
|
+
|
3
12
|
## [0.1.1] - 2021-12-16
|
4
13
|
|
5
14
|
- Camunda Cloud Access Token Creation
|
@@ -8,5 +17,4 @@
|
|
8
17
|
|
9
18
|
## [0.1.0] - 2021-12-16
|
10
19
|
|
11
|
-
- Initial release
|
12
|
-
_
|
20
|
+
- Initial release
|
data/Gemfile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in cloudmunda.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
8
|
+
gem 'rails', '>= 6'
|
9
|
+
gem 'rake', '~> 13.0'
|
10
|
+
gem 'rspec', '~> 3.0'
|
11
|
+
gem 'rubocop', '~> 1.21'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cloudmunda (0.1.
|
4
|
+
cloudmunda (0.1.4)
|
5
5
|
concurrent-ruby (~> 1.0)
|
6
6
|
rest-client (~> 2.0)
|
7
7
|
zeebe-client (~> 0.16)
|
@@ -9,87 +9,95 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actioncable (
|
13
|
-
actionpack (=
|
14
|
-
activesupport (=
|
12
|
+
actioncable (7.0.3.1)
|
13
|
+
actionpack (= 7.0.3.1)
|
14
|
+
activesupport (= 7.0.3.1)
|
15
15
|
nio4r (~> 2.0)
|
16
16
|
websocket-driver (>= 0.6.1)
|
17
|
-
actionmailbox (
|
18
|
-
actionpack (=
|
19
|
-
activejob (=
|
20
|
-
activerecord (=
|
21
|
-
activestorage (=
|
22
|
-
activesupport (=
|
17
|
+
actionmailbox (7.0.3.1)
|
18
|
+
actionpack (= 7.0.3.1)
|
19
|
+
activejob (= 7.0.3.1)
|
20
|
+
activerecord (= 7.0.3.1)
|
21
|
+
activestorage (= 7.0.3.1)
|
22
|
+
activesupport (= 7.0.3.1)
|
23
23
|
mail (>= 2.7.1)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
net-imap
|
25
|
+
net-pop
|
26
|
+
net-smtp
|
27
|
+
actionmailer (7.0.3.1)
|
28
|
+
actionpack (= 7.0.3.1)
|
29
|
+
actionview (= 7.0.3.1)
|
30
|
+
activejob (= 7.0.3.1)
|
31
|
+
activesupport (= 7.0.3.1)
|
29
32
|
mail (~> 2.5, >= 2.5.4)
|
33
|
+
net-imap
|
34
|
+
net-pop
|
35
|
+
net-smtp
|
30
36
|
rails-dom-testing (~> 2.0)
|
31
|
-
actionpack (
|
32
|
-
actionview (=
|
33
|
-
activesupport (=
|
34
|
-
rack (~> 2.0, >= 2.0
|
37
|
+
actionpack (7.0.3.1)
|
38
|
+
actionview (= 7.0.3.1)
|
39
|
+
activesupport (= 7.0.3.1)
|
40
|
+
rack (~> 2.0, >= 2.2.0)
|
35
41
|
rack-test (>= 0.6.3)
|
36
42
|
rails-dom-testing (~> 2.0)
|
37
43
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
38
|
-
actiontext (
|
39
|
-
actionpack (=
|
40
|
-
activerecord (=
|
41
|
-
activestorage (=
|
42
|
-
activesupport (=
|
44
|
+
actiontext (7.0.3.1)
|
45
|
+
actionpack (= 7.0.3.1)
|
46
|
+
activerecord (= 7.0.3.1)
|
47
|
+
activestorage (= 7.0.3.1)
|
48
|
+
activesupport (= 7.0.3.1)
|
49
|
+
globalid (>= 0.6.0)
|
43
50
|
nokogiri (>= 1.8.5)
|
44
|
-
actionview (
|
45
|
-
activesupport (=
|
51
|
+
actionview (7.0.3.1)
|
52
|
+
activesupport (= 7.0.3.1)
|
46
53
|
builder (~> 3.1)
|
47
54
|
erubi (~> 1.4)
|
48
55
|
rails-dom-testing (~> 2.0)
|
49
56
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
50
|
-
activejob (
|
51
|
-
activesupport (=
|
57
|
+
activejob (7.0.3.1)
|
58
|
+
activesupport (= 7.0.3.1)
|
52
59
|
globalid (>= 0.3.6)
|
53
|
-
activemodel (
|
54
|
-
activesupport (=
|
55
|
-
activerecord (
|
56
|
-
activemodel (=
|
57
|
-
activesupport (=
|
58
|
-
activestorage (
|
59
|
-
actionpack (=
|
60
|
-
activejob (=
|
61
|
-
activerecord (=
|
62
|
-
activesupport (=
|
63
|
-
marcel (~> 1.0
|
60
|
+
activemodel (7.0.3.1)
|
61
|
+
activesupport (= 7.0.3.1)
|
62
|
+
activerecord (7.0.3.1)
|
63
|
+
activemodel (= 7.0.3.1)
|
64
|
+
activesupport (= 7.0.3.1)
|
65
|
+
activestorage (7.0.3.1)
|
66
|
+
actionpack (= 7.0.3.1)
|
67
|
+
activejob (= 7.0.3.1)
|
68
|
+
activerecord (= 7.0.3.1)
|
69
|
+
activesupport (= 7.0.3.1)
|
70
|
+
marcel (~> 1.0)
|
64
71
|
mini_mime (>= 1.1.0)
|
65
|
-
activesupport (
|
72
|
+
activesupport (7.0.3.1)
|
66
73
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
67
74
|
i18n (>= 1.6, < 2)
|
68
75
|
minitest (>= 5.1)
|
69
76
|
tzinfo (~> 2.0)
|
70
|
-
zeitwerk (~> 2.3)
|
71
77
|
ast (2.4.2)
|
72
78
|
builder (3.2.4)
|
73
|
-
concurrent-ruby (1.1.
|
79
|
+
concurrent-ruby (1.1.10)
|
74
80
|
crass (1.0.6)
|
75
|
-
diff-lcs (1.
|
81
|
+
diff-lcs (1.5.0)
|
82
|
+
digest (3.1.0)
|
76
83
|
domain_name (0.5.20190701)
|
77
84
|
unf (>= 0.0.5, < 1.0.0)
|
78
|
-
erubi (1.
|
85
|
+
erubi (1.11.0)
|
79
86
|
globalid (1.0.0)
|
80
87
|
activesupport (>= 5.0)
|
81
|
-
google-protobuf (3.
|
82
|
-
googleapis-common-protos-types (1.3.
|
88
|
+
google-protobuf (3.21.4-x86_64-darwin)
|
89
|
+
googleapis-common-protos-types (1.3.2)
|
83
90
|
google-protobuf (~> 3.14)
|
84
|
-
grpc (1.
|
85
|
-
google-protobuf (~> 3.
|
91
|
+
grpc (1.48.0-x86_64-darwin)
|
92
|
+
google-protobuf (~> 3.19)
|
86
93
|
googleapis-common-protos-types (~> 1.0)
|
87
94
|
http-accept (1.7.0)
|
88
|
-
http-cookie (1.0.
|
95
|
+
http-cookie (1.0.5)
|
89
96
|
domain_name (~> 0.5)
|
90
|
-
i18n (1.
|
97
|
+
i18n (1.12.0)
|
91
98
|
concurrent-ruby (~> 1.0)
|
92
|
-
|
99
|
+
json (2.6.2)
|
100
|
+
loofah (2.18.0)
|
93
101
|
crass (~> 1.0.2)
|
94
102
|
nokogiri (>= 1.5.9)
|
95
103
|
mail (2.7.1)
|
@@ -98,103 +106,114 @@ GEM
|
|
98
106
|
method_source (1.0.0)
|
99
107
|
mime-types (3.4.1)
|
100
108
|
mime-types-data (~> 3.2015)
|
101
|
-
mime-types-data (3.
|
109
|
+
mime-types-data (3.2022.0105)
|
102
110
|
mini_mime (1.1.2)
|
103
|
-
minitest (5.
|
111
|
+
minitest (5.16.2)
|
112
|
+
net-imap (0.2.3)
|
113
|
+
digest
|
114
|
+
net-protocol
|
115
|
+
strscan
|
116
|
+
net-pop (0.1.1)
|
117
|
+
digest
|
118
|
+
net-protocol
|
119
|
+
timeout
|
120
|
+
net-protocol (0.1.3)
|
121
|
+
timeout
|
122
|
+
net-smtp (0.3.1)
|
123
|
+
digest
|
124
|
+
net-protocol
|
125
|
+
timeout
|
104
126
|
netrc (0.11.0)
|
105
127
|
nio4r (2.5.8)
|
106
|
-
nokogiri (1.
|
128
|
+
nokogiri (1.13.8-x86_64-darwin)
|
107
129
|
racc (~> 1.4)
|
108
|
-
parallel (1.
|
109
|
-
parser (3.
|
130
|
+
parallel (1.22.1)
|
131
|
+
parser (3.1.2.1)
|
110
132
|
ast (~> 2.4.1)
|
111
133
|
racc (1.6.0)
|
112
|
-
rack (2.2.
|
113
|
-
rack-test (
|
114
|
-
rack (>= 1.
|
115
|
-
rails (
|
116
|
-
actioncable (=
|
117
|
-
actionmailbox (=
|
118
|
-
actionmailer (=
|
119
|
-
actionpack (=
|
120
|
-
actiontext (=
|
121
|
-
actionview (=
|
122
|
-
activejob (=
|
123
|
-
activemodel (=
|
124
|
-
activerecord (=
|
125
|
-
activestorage (=
|
126
|
-
activesupport (=
|
134
|
+
rack (2.2.4)
|
135
|
+
rack-test (2.0.2)
|
136
|
+
rack (>= 1.3)
|
137
|
+
rails (7.0.3.1)
|
138
|
+
actioncable (= 7.0.3.1)
|
139
|
+
actionmailbox (= 7.0.3.1)
|
140
|
+
actionmailer (= 7.0.3.1)
|
141
|
+
actionpack (= 7.0.3.1)
|
142
|
+
actiontext (= 7.0.3.1)
|
143
|
+
actionview (= 7.0.3.1)
|
144
|
+
activejob (= 7.0.3.1)
|
145
|
+
activemodel (= 7.0.3.1)
|
146
|
+
activerecord (= 7.0.3.1)
|
147
|
+
activestorage (= 7.0.3.1)
|
148
|
+
activesupport (= 7.0.3.1)
|
127
149
|
bundler (>= 1.15.0)
|
128
|
-
railties (=
|
129
|
-
sprockets-rails (>= 2.0.0)
|
150
|
+
railties (= 7.0.3.1)
|
130
151
|
rails-dom-testing (2.0.3)
|
131
152
|
activesupport (>= 4.2.0)
|
132
153
|
nokogiri (>= 1.6)
|
133
|
-
rails-html-sanitizer (1.4.
|
154
|
+
rails-html-sanitizer (1.4.3)
|
134
155
|
loofah (~> 2.3)
|
135
|
-
railties (
|
136
|
-
actionpack (=
|
137
|
-
activesupport (=
|
156
|
+
railties (7.0.3.1)
|
157
|
+
actionpack (= 7.0.3.1)
|
158
|
+
activesupport (= 7.0.3.1)
|
138
159
|
method_source
|
139
|
-
rake (>=
|
160
|
+
rake (>= 12.2)
|
140
161
|
thor (~> 1.0)
|
141
|
-
|
162
|
+
zeitwerk (~> 2.5)
|
163
|
+
rainbow (3.1.1)
|
142
164
|
rake (13.0.6)
|
143
|
-
regexp_parser (2.
|
165
|
+
regexp_parser (2.5.0)
|
144
166
|
rest-client (2.1.0)
|
145
167
|
http-accept (>= 1.7.0, < 2.0)
|
146
168
|
http-cookie (>= 1.0.2, < 2.0)
|
147
169
|
mime-types (>= 1.16, < 4.0)
|
148
170
|
netrc (~> 0.8)
|
149
171
|
rexml (3.2.5)
|
150
|
-
rspec (3.
|
151
|
-
rspec-core (~> 3.
|
152
|
-
rspec-expectations (~> 3.
|
153
|
-
rspec-mocks (~> 3.
|
154
|
-
rspec-core (3.
|
155
|
-
rspec-support (~> 3.
|
156
|
-
rspec-expectations (3.
|
172
|
+
rspec (3.11.0)
|
173
|
+
rspec-core (~> 3.11.0)
|
174
|
+
rspec-expectations (~> 3.11.0)
|
175
|
+
rspec-mocks (~> 3.11.0)
|
176
|
+
rspec-core (3.11.0)
|
177
|
+
rspec-support (~> 3.11.0)
|
178
|
+
rspec-expectations (3.11.0)
|
157
179
|
diff-lcs (>= 1.2.0, < 2.0)
|
158
|
-
rspec-support (~> 3.
|
159
|
-
rspec-mocks (3.
|
180
|
+
rspec-support (~> 3.11.0)
|
181
|
+
rspec-mocks (3.11.1)
|
160
182
|
diff-lcs (>= 1.2.0, < 2.0)
|
161
|
-
rspec-support (~> 3.
|
162
|
-
rspec-support (3.
|
163
|
-
rubocop (1.
|
183
|
+
rspec-support (~> 3.11.0)
|
184
|
+
rspec-support (3.11.0)
|
185
|
+
rubocop (1.34.1)
|
186
|
+
json (~> 2.3)
|
164
187
|
parallel (~> 1.10)
|
165
|
-
parser (>= 3.
|
188
|
+
parser (>= 3.1.2.1)
|
166
189
|
rainbow (>= 2.2.2, < 4.0)
|
167
190
|
regexp_parser (>= 1.8, < 3.0)
|
168
|
-
rexml
|
169
|
-
rubocop-ast (>= 1.
|
191
|
+
rexml (>= 3.2.5, < 4.0)
|
192
|
+
rubocop-ast (>= 1.20.0, < 2.0)
|
170
193
|
ruby-progressbar (~> 1.7)
|
171
194
|
unicode-display_width (>= 1.4.0, < 3.0)
|
172
|
-
rubocop-ast (1.
|
173
|
-
parser (>= 3.
|
195
|
+
rubocop-ast (1.21.0)
|
196
|
+
parser (>= 3.1.1.0)
|
174
197
|
ruby-progressbar (1.11.0)
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
actionpack (>= 5.2)
|
180
|
-
activesupport (>= 5.2)
|
181
|
-
sprockets (>= 3.0.0)
|
182
|
-
thor (1.1.0)
|
183
|
-
tzinfo (2.0.4)
|
198
|
+
strscan (3.0.4)
|
199
|
+
thor (1.2.1)
|
200
|
+
timeout (0.3.0)
|
201
|
+
tzinfo (2.0.5)
|
184
202
|
concurrent-ruby (~> 1.0)
|
185
203
|
unf (0.1.4)
|
186
204
|
unf_ext
|
187
|
-
unf_ext (0.0.8)
|
188
|
-
unicode-display_width (2.
|
205
|
+
unf_ext (0.0.8.2)
|
206
|
+
unicode-display_width (2.2.0)
|
189
207
|
websocket-driver (0.7.5)
|
190
208
|
websocket-extensions (>= 0.1.0)
|
191
209
|
websocket-extensions (0.1.5)
|
192
|
-
zeebe-client (0.
|
210
|
+
zeebe-client (0.17.0)
|
193
211
|
grpc (~> 1.32)
|
194
|
-
zeitwerk (2.
|
212
|
+
zeitwerk (2.6.0)
|
195
213
|
|
196
214
|
PLATFORMS
|
197
215
|
x86_64-darwin-20
|
216
|
+
x86_64-darwin-21
|
198
217
|
|
199
218
|
DEPENDENCIES
|
200
219
|
cloudmunda!
|
data/README.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
# Cloudmunda
|
2
2
|
|
3
|
-
|
3
|
+
This Ruby gem makes it easier to connect your Ruby (on Rails) app with Camunda Cloud. 🎉
|
4
4
|
|
5
|
-
|
5
|
+
The following is included:
|
6
|
+
- Ruby workers for Zeebe
|
7
|
+
- API wrapper for Camunda Cloud
|
8
|
+
- graphQL wrapper Usertasks
|
9
|
+
|
10
|
+
To use this library you need:
|
11
|
+
|
12
|
+
* a [Camunda Cloud Account](https://accounts.cloud.camunda.io/signup)
|
13
|
+
* your [Camunda client connection credentials](https://docs.camunda.io/docs/guides/getting-started/setup-client-connection-credentials/)
|
6
14
|
|
7
15
|
## Installation
|
8
16
|
|
@@ -20,18 +28,159 @@ Or install it yourself as:
|
|
20
28
|
|
21
29
|
$ gem install cloudmunda
|
22
30
|
|
23
|
-
|
31
|
+
### Rails applications
|
32
|
+
|
33
|
+
If you're using this gem with a rails application, you could create a `config/initializers/cloudmunda.rb` file and add
|
34
|
+
the following:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
Cloudmunda.configure do |config|
|
38
|
+
config.env = ENV['APP_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
39
|
+
config.logger = Logger.new($stdout)
|
40
|
+
config.timeout = 30
|
41
|
+
config.client_id = ENV['ZEEBE_CLIENT_ID']
|
42
|
+
config.client_secret = ENV['ZEEBE_CLIENT_SECRET']
|
43
|
+
config.zeebe_url = ENV['ZEEBE_URL']
|
44
|
+
config.auth_url = ENV['ZEEBE_AUTHORIZATION_SERVER_URL']
|
45
|
+
config.audience = ENV['ZEEBE_AUDIENCE']
|
46
|
+
config.graphql_url = ENV['GRAPHQL_URL']
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
The values listed above are the default values that you can override.
|
51
|
+
|
52
|
+
## Example Usage
|
53
|
+
|
54
|
+
This section will explain the usage as you were using a Rails application, but steps should be very similar within plain
|
55
|
+
Ruby apps or any other frameworks out there. Feel free to create an issue or PR if additional items are needed.
|
56
|
+
|
57
|
+
The idea of the example is that when a certain webhook comes in, a Slack message is sent. This might look like a bit
|
58
|
+
of overhead to use a business process engine for this, but it's just to show how the library works. Since we're
|
59
|
+
communicating with Slack, you'd need a Slack workspace. You can also change the code in the example to send an email or
|
60
|
+
just write something in the logs.
|
61
|
+
|
62
|
+
You can find all the code [here](https://github.com/lienvdsteen/cloudmunda-demo).
|
63
|
+
|
64
|
+
### Add Slack and Cloudmunda gem
|
65
|
+
In your Gemfile add this line
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
gem 'cloudmunda'
|
69
|
+
gem 'slack-ruby-client' # this is just for our example
|
70
|
+
```
|
71
|
+
|
72
|
+
Then run
|
73
|
+
|
74
|
+
```shell
|
75
|
+
bundle install
|
76
|
+
```
|
77
|
+
|
78
|
+
As said above, create a initializer file so that whenever you are interacting with them gem you have the right settings set:
|
79
|
+
|
80
|
+
```shell
|
81
|
+
touch config/initializers/cloudmunda.rb
|
82
|
+
touch config/initializers/slack.rb # again, this is just for our example
|
83
|
+
```
|
84
|
+
|
85
|
+
Then open the `cloudmunda.rb` file and copy the following in it:
|
24
86
|
|
25
87
|
```ruby
|
26
88
|
Cloudmunda.configure do |config|
|
27
89
|
config.env = ENV['APP_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
28
|
-
config.
|
90
|
+
config.logger = Logger.new($stdout)
|
29
91
|
config.timeout = 30
|
92
|
+
config.client_id = ENV['ZEEBE_CLIENT_ID']
|
93
|
+
config.client_secret = ENV['ZEEBE_CLIENT_SECRET']
|
30
94
|
config.zeebe_url = ENV['ZEEBE_URL']
|
31
95
|
config.auth_url = ENV['ZEEBE_AUTHORIZATION_SERVER_URL']
|
96
|
+
config.audience = ENV['ZEEBE_AUDIENCE']
|
97
|
+
config.graphql_url = ENV['GRAPHQL_URL']
|
98
|
+
end
|
99
|
+
```
|
100
|
+
|
101
|
+
Then open the `slack.rb` file and copy the following
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
Slack.configure do |config|
|
105
|
+
config.token = ENV['SLACK_OAUTH_TOKEN']
|
106
|
+
end
|
107
|
+
```
|
108
|
+
|
109
|
+
Note: this assumes you're using ENV variables, you can of course edit this to use something like `Settings.key` or
|
110
|
+
how you prefer it. Just make sure not to publish your secrets.
|
111
|
+
|
112
|
+
### Deploy the diagram to your Camunda Cloud cluster
|
113
|
+
You can either import the [bpmn model example](/diagrams/demo.bpmn) as a diagram in your Camunda Cloud and
|
114
|
+
use the UI to deploy or you can start a console (`rails console`) and deploy the diagram with the gem.
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
Cloudmunda.client.deploy_process(processes: [name: "demo", definition: File.read('diagrams/demo.bpmn')])
|
118
|
+
```
|
119
|
+
|
120
|
+
### Create a worker
|
121
|
+
|
122
|
+
In `app/jobs` create a new file `demo_worker_job.rb` and copy paste the following:
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
class DemoWorkerJob
|
126
|
+
include ::Cloudmunda::Worker
|
127
|
+
|
128
|
+
type 'webhook-slack-announce'
|
129
|
+
max_jobs_to_activate 20
|
130
|
+
poll_interval 1
|
131
|
+
timeout 45
|
132
|
+
|
133
|
+
attr_reader :variables
|
134
|
+
|
135
|
+
def process(job)
|
136
|
+
slack_client.chat_postMessage(channel: '#general', text: 'a message', as_user: true)
|
137
|
+
end
|
138
|
+
|
139
|
+
private
|
140
|
+
|
141
|
+
def slack_client
|
142
|
+
@slack_client ||= ::Slack::Web::Client.new
|
143
|
+
end
|
32
144
|
end
|
33
145
|
```
|
34
146
|
|
147
|
+
### Setup the "webhook"
|
148
|
+
Add the following to your `routes.rb` file `get 'webhook/received', to: 'webhook#received'` and then create a file
|
149
|
+
`webhooks_controller.rb` in the controllers directory and copy paste the following:
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
class WebhookController < ApplicationController
|
153
|
+
def received
|
154
|
+
Cloudmunda.client.create_process_instance(
|
155
|
+
bpmnProcessId: 'cloudmunda-demo',
|
156
|
+
version: 1,
|
157
|
+
variables: {text: "hello"}.to_json
|
158
|
+
)
|
159
|
+
|
160
|
+
head :ok
|
161
|
+
end
|
162
|
+
end
|
163
|
+
```
|
164
|
+
|
165
|
+
#### Run everything
|
166
|
+
|
167
|
+
Now everything should be able to execute. Lets start your rails server and then in another terminal tab run the following:
|
168
|
+
|
169
|
+
````ruby
|
170
|
+
bundle exec cloudmunda \
|
171
|
+
--require .
|
172
|
+
--client-id $ZEEBE_CLIENT_ID \
|
173
|
+
--client-secret $ZEEBE_CLIENT_SECRET \
|
174
|
+
--zeebe-url $ZEEBE_URL \
|
175
|
+
--zeebe-auth-url $ZEEBE_AUTHORIZATION_SERVER_URL \
|
176
|
+
--audience $ZEEBE_AUDIENCE
|
177
|
+
````
|
178
|
+
|
179
|
+
Then navigate to `localhost:3000/webhook/received`, what will happen is the following:
|
180
|
+
1. It goes to the `received` endpoint in the `WebhookController`
|
181
|
+
2. Here a new process instance is created on Camunda Cloud
|
182
|
+
3. This will then trigger the next step in the diagram, which is the service task
|
183
|
+
4. Through the grpc protocol our worker is linked with this service task and will be executed.
|
35
184
|
|
36
185
|
## Development
|
37
186
|
|
@@ -42,6 +191,11 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
42
191
|
## Contributing
|
43
192
|
|
44
193
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cloudmunda. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/cloudmunda/blob/main/CODE_OF_CONDUCT.md).
|
194
|
+
Looking for:
|
195
|
+
- unit testing: currently nothing is tested
|
196
|
+
- additional API endpoints
|
197
|
+
- additional graphQL endpoints
|
198
|
+
- general improvements
|
45
199
|
|
46
200
|
## License
|
47
201
|
|
@@ -50,3 +204,9 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
50
204
|
## Code of Conduct
|
51
205
|
|
52
206
|
Everyone interacting in the Cloudmunda project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/cloudmunda/blob/main/CODE_OF_CONDUCT.md).
|
207
|
+
|
208
|
+
## Credits
|
209
|
+
|
210
|
+
This gem is build on top of what [@gottfrois](https://github.com/gottfrois/) had build in his [beez](https://github.com/gottfrois/beez)
|
211
|
+
gem. Everything in this gem related to the Ruby workers is a taken from that gem. 👏 Cloudmunda would **not** be
|
212
|
+
possible without this.
|
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
7
|
|
8
|
-
require
|
8
|
+
require 'rubocop/rake_task'
|
9
9
|
|
10
10
|
RuboCop::RakeTask.new
|
11
11
|
|
data/bin/console
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'cloudmunda'
|
6
6
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -11,5 +11,5 @@ require "cloudmunda"
|
|
11
11
|
# require "pry"
|
12
12
|
# Pry.start
|
13
13
|
|
14
|
-
require
|
14
|
+
require 'irb'
|
15
15
|
IRB.start(__FILE__)
|