Skip to content

Commit 2f906db

Browse files
authored
Merge pull request #333 from EncoreTechnologies/feature/service-scale-out
Process scale out and coordination
2 parents b744ee6 + cb2618e commit 2f906db

File tree

22 files changed

+340
-52
lines changed

22 files changed

+340
-52
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## Development
44

5+
- Added the ability to scale out workflowengine, scheduler, rulesengine, and notifier services
6+
so that they run in an active-active configuration
7+
Contributed by @bishopbm1
8+
- Added the Redis configuration for a Coordination backend
9+
Contributed by @bishopbm1
10+
- Added neccessary erlang package required for RHEL 8 rabbitmq
11+
Contributed by @bishopbm1
12+
513
## 2.1.0 (Mar 6, 2021)
614
Note: This version only supports the 'integrated' LDAP plugin.
715

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ classes for use and configuration.
157157
* `st2::profile::nodejs` - st2 configured NodeJS installation
158158
* `st2::profile::python` - Python installed and configured for st2
159159
* `st2::profile::rabbitmq` - st2 configured RabbitMQ installation
160+
* `st2::profile::redis` - st2 configured Redis installation
160161
* `st2::proflle::server` - st2 server components
161162
* `st2::profile::web` - st2 web components
162163
* `st2::profile::chatops` - st2 chatops components
@@ -318,6 +319,33 @@ Configuration via Hiera:
318319
RESPOND_TO_DM: true
319320
```
320321

322+
#### Scaling out services
323+
324+
This module supports scaling out workflowengine, scheduler, rulesengine, and notifier services
325+
per the [ST2 Documentation](https://docs.stackstorm.com/reference/ha.html).
326+
327+
This would be something that you might consider doing if you have alot of rules running or if you
328+
have alot of workflows running in parrallel and/or you have alot of nested workflows and have a server
329+
that can be higher on CPU and Memory to allow more processes to run at the same time.
330+
331+
Configuration all services:
332+
```ruby
333+
class { 'st2':
334+
python_version => '3.6',
335+
workflowengine_num => 4,
336+
scheduler_num => 2,
337+
rulesengine_num => 1,
338+
notifier_num => 1,
339+
}
340+
```
341+
342+
Or configure individual:
343+
```ruby
344+
class { 'st2::workflowengine':
345+
workflowengine_num => 4,
346+
}
347+
```
348+
321349
### Tasks
322350

323351
This module provides several tasks for interacting with StackStorm. These tasks
@@ -484,6 +512,8 @@ please submit a [Pull Request](https://github.com/StackStorm/puppet-st2/pulls).
484512
* StackStorm <[email protected]>
485513
* James Fryman
486514
* Patrick Hoolboom
515+
* Bradley Bishop
516+
* GitHub - [@nmaludy](https://github.com/bishopbm1)
487517

488518
### Help
489519

build/centos7-puppet6/Puppetfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# │ └── puppetlabs-concat (v6.2.0)
3232
# ├── puppet-nodejs (v7.0.1)
3333
# ├── puppet-python (v4.1.1)
34+
# ├── puppet-redis (v7.0.0)
3435
# ├─┬ puppet-rabbitmq (v10.1.1)
3536
# │ ├── camptocamp-systemd (v2.9.0)
3637
# │ └── puppet-archive (v4.5.0)
@@ -64,3 +65,4 @@ mod 'puppetlabs-inifile'
6465
mod 'puppetlabs-stdlib'
6566
mod 'puppetlabs-yumrepo_core'
6667
mod 'saz-sudo'
68+
mod 'puppet/redis'

build/centos7-puppet7/Puppetfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# │ └── puppetlabs-concat (v6.2.0)
3232
# ├── puppet-nodejs (v7.0.1)
3333
# ├── puppet-python (v4.1.1)
34+
# ├── puppet-redis (v7.0.0)
3435
# ├─┬ puppet-rabbitmq (v10.1.1)
3536
# │ ├── camptocamp-systemd (v2.9.0)
3637
# │ └── puppet-archive (v4.5.0)
@@ -64,3 +65,4 @@ mod 'puppetlabs-inifile'
6465
mod 'puppetlabs-stdlib'
6566
mod 'puppetlabs-yumrepo_core'
6667
mod 'saz-sudo'
68+
mod 'puppet/redis'

build/ubuntu16-puppet6/Puppetfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# │ └── puppetlabs-concat (v6.2.0)
3232
# ├── puppet-nodejs (v7.0.1)
3333
# ├── puppet-python (v4.1.1)
34+
# ├── puppet-redis (v7.0.0)
3435
# ├─┬ puppet-rabbitmq (v10.1.1)
3536
# │ ├── camptocamp-systemd (v2.9.0)
3637
# │ └── puppet-archive (v4.5.0)
@@ -64,3 +65,4 @@ mod 'puppetlabs-inifile'
6465
mod 'puppetlabs-stdlib'
6566
mod 'puppetlabs-yumrepo_core'
6667
mod 'saz-sudo'
68+
mod 'puppet/redis'

build/ubuntu16-puppet7/Puppetfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# │ └── puppetlabs-concat (v6.2.0)
3232
# ├── puppet-nodejs (v7.0.1)
3333
# ├── puppet-python (v4.1.1)
34+
# ├── puppet-redis (v7.0.0)
3435
# ├─┬ puppet-rabbitmq (v10.1.1)
3536
# │ ├── camptocamp-systemd (v2.9.0)
3637
# │ └── puppet-archive (v4.5.0)
@@ -64,3 +65,4 @@ mod 'puppetlabs-inifile'
6465
mod 'puppetlabs-stdlib'
6566
mod 'puppetlabs-yumrepo_core'
6667
mod 'saz-sudo'
68+
mod 'puppet/redis'

build/ubuntu18-puppet6/Puppetfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# │ └── puppetlabs-concat (v6.2.0)
3232
# ├── puppet-nodejs (v7.0.1)
3333
# ├── puppet-python (v4.1.1)
34+
# ├── puppet-redis (v7.0.0)
3435
# ├─┬ puppet-rabbitmq (v10.1.1)
3536
# │ ├── camptocamp-systemd (v2.9.0)
3637
# │ └── puppet-archive (v4.5.0)
@@ -64,3 +65,4 @@ mod 'puppetlabs-inifile'
6465
mod 'puppetlabs-stdlib'
6566
mod 'puppetlabs-yumrepo_core'
6667
mod 'saz-sudo'
68+
mod 'puppet/redis'

build/ubuntu18-puppet7/Puppetfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# │ └── puppetlabs-concat (v6.2.0)
3232
# ├── puppet-nodejs (v7.0.1)
3333
# ├── puppet-python (v4.1.1)
34+
# ├── puppet-redis (v7.0.0)
3435
# ├─┬ puppet-rabbitmq (v10.1.1)
3536
# │ ├── camptocamp-systemd (v2.9.0)
3637
# │ └── puppet-archive (v4.5.0)
@@ -64,3 +65,4 @@ mod 'puppetlabs-inifile'
6465
mod 'puppetlabs-stdlib'
6566
mod 'puppetlabs-yumrepo_core'
6667
mod 'saz-sudo'
68+
mod 'puppet/redis'

files/st2_task_base.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,21 @@ def login(self, args):
3939
elif self.username and self.password:
4040
# auth on the command line with username/password
4141
cmd = ['st2', 'auth', '--only-token', '-p', self.password, self.username]
42-
stdout = subprocess.check_output(cmd)
42+
stdout = self.bytes_to_string(subprocess.check_output(cmd))
4343
self.env['ST2_AUTH_TOKEN'] = stdout.rstrip()
4444
# else
4545
# assume auth token is written in client config for this user.
4646
# don't worry, if there is no auth we'll get an error
4747

48+
def bytes_to_string(self, string):
49+
if isinstance(string, bytes):
50+
string = string.decode("utf-8")
51+
52+
return string
53+
4854
def parse_output(self, stdout):
4955
try:
56+
stdout = self.bytes_to_string(stdout)
5057
# try to parse stdout as JSON and return the parse result
5158
return {'result': json.loads(stdout)}
5259
except ValueError:

manifests/init.pp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,20 @@
212212
# @param nodejs_manage_repo
213213
# Set this to false when you have your own repositories
214214
# for NodeJS (default: true)
215+
# @param redis_bind_ip
216+
# Bind IP of the Redis server. Default is 127.0.0.1
217+
# @param workflowengine_num
218+
# The number of workflowengines to have in an active active state (default: 1)
219+
# @param scheduler_num
220+
# The number of schedulers to have in an active active state (default: 1)
221+
# @param rulesengine_num
222+
# The number of rulesengines to have in an active active state (default: 1)
223+
# @param notifier_num
224+
# The number of notifiers to have in an active active state (default: 1)
225+
# @param erlang_url
226+
# The url for the erlang repositiory to be used for rabbitmq
227+
# @param erlang_key
228+
# The gpg key for the erlang repositiory to be used for rabbitmq
215229
#
216230
#
217231
# @example Basic Usage
@@ -314,6 +328,9 @@
314328
$rabbitmq_port = $::st2::params::rabbitmq_port,
315329
$rabbitmq_bind_ip = $::st2::params::rabbitmq_bind_ip,
316330
$rabbitmq_vhost = $::st2::params::rabbitmq_vhost,
331+
$erlang_url = $::st2::params::erlang_url,
332+
$erlang_key = $::st2::params::erlang_key,
333+
$redis_bind_ip = $::st2::params::redis_bind_ip,
317334
$timersengine_enabled = $::st2::params::timersengine_enabled,
318335
$timersengine_timezone = $::st2::params::timersengine_timezone,
319336
$scheduler_sleep_interval = $::st2::params::scheduler_sleep_interval,
@@ -333,6 +350,10 @@
333350
$chatops_web_url = undef,
334351
$nodejs_version = undef,
335352
$nodejs_manage_repo = true,
353+
$workflowengine_num = $::st2::params::workflowengine_num,
354+
$scheduler_num = $::st2::params::scheduler_num,
355+
$rulesengine_num = $::st2::params::rulesengine_num,
356+
$notifier_num = $::st2::params::notifier_num,
336357
) inherits st2::params {
337358

338359
########################################

0 commit comments

Comments
 (0)