Skip to content

Commit cb2618e

Browse files
committed
Moved process -> service. Fixed changelog. Fixed comments. Added changes to the readme
1 parent 1d0e78d commit cb2618e

9 files changed

+112
-91
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Development
44

5-
- Added the ability to scale out workflowengine, scheduler, rulesengine, and notifier processes
5+
- Added the ability to scale out workflowengine, scheduler, rulesengine, and notifier services
66
so that they run in an active-active configuration
77
Contributed by @bishopbm1
88
- Added the Redis configuration for a Coordination backend

README.md

+30
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

manifests/notifier.pp

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
tag => 'st2::config',
3737
}
3838

39-
st2::process { 'st2notifier':
40-
process_name => 'st2notifier',
41-
process_num => $notifier_num,
42-
process_services => $notifier_services,
39+
st2::service { 'st2notifier':
40+
service_name => 'st2notifier',
41+
service_num => $notifier_num,
42+
existing_services => $notifier_services,
4343
}
4444
}

manifests/process.pp

-71
This file was deleted.

manifests/rulesengine.pp

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
tag => 'st2::config',
3737
}
3838

39-
st2::process { 'st2rulesengine':
40-
process_name => 'st2rulesengine',
41-
process_num => $rulesengine_num,
42-
process_services => $rulesengine_services,
39+
st2::service { 'st2rulesengine':
40+
service_name => 'st2rulesengine',
41+
service_num => $rulesengine_num,
42+
existing_services => $rulesengine_services,
4343
}
4444
}

manifests/scheduler.pp

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@
5454
tag => 'st2::config',
5555
}
5656

57-
st2::process { 'st2scheduler':
58-
process_name => 'st2scheduler',
59-
process_num => $scheduler_num,
60-
process_services => $scheduler_services,
57+
st2::service { 'st2scheduler':
58+
service_name => 'st2scheduler',
59+
service_num => $scheduler_num,
60+
existing_services => $scheduler_services,
6161
}
6262
}
6363
}

manifests/service.pp

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# @summary Creates additional service for components that can be scaled out
2+
#
3+
# @param service_name
4+
# The service name that we are attempting to scale
5+
# @param service_num
6+
# The number of servicees that should be scaled out
7+
# @param existing_services
8+
# The service to make sure are enabled and running. All new service
9+
# are automatically added to this.
10+
#
11+
# @example build st2workflowengine service
12+
# st2::service { 'st2workflowengine':
13+
# service_name => 'st2workflowengine-rsa',
14+
# service_num => '2',
15+
# existing_services => ['st2workflowengine'],
16+
# }
17+
#
18+
define st2::service(
19+
$service_name,
20+
$service_num,
21+
$existing_services,
22+
) {
23+
if ($service_num > 1) {
24+
$additional_service = range('2', $service_num).reduce([]) |$memo, $number| {
25+
$new_service_name = "${service_name}${number}"
26+
case $facts['os']['family'] {
27+
'RedHat': {
28+
$file_path = '/usr/lib/systemd/system/'
29+
}
30+
'Debian': {
31+
$file_path = '/lib/systemd/system/'
32+
}
33+
default: {
34+
fail("Unsupported managed repository for osfamily: ${facts['os']['family']}, operatingsystem: ${facts['os']['name']}")
35+
}
36+
}
37+
38+
systemd::unit_file { "${new_service_name}.service":
39+
path => $file_path,
40+
source => "${file_path}${service_name}.service",
41+
owner => 'root',
42+
group => 'root',
43+
mode => '0644',
44+
}
45+
46+
$memo + [$new_service_name]
47+
}
48+
49+
$_existing_services = $existing_services + $additional_service
50+
51+
} else {
52+
$_existing_services = $existing_services
53+
}
54+
55+
########################################
56+
## Service
57+
service { $_existing_services:
58+
ensure => 'running',
59+
enable => true,
60+
tag => 'st2::service',
61+
}
62+
}

manifests/workflowengine.pp

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
tag => 'st2::config',
4040
}
4141

42-
st2::process { 'st2workflowengine':
43-
process_name => 'st2workflowengine',
44-
process_num => $workflowengine_num,
45-
process_services => $workflowengine_services,
42+
st2::service { 'st2workflowengine':
43+
service_name => 'st2workflowengine',
44+
service_num => $workflowengine_num,
45+
existing_services => $workflowengine_services,
4646
}
4747
}
4848
}

metadata.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
{
3636
"name": "puppet/python",
37-
"version_requirement": ">= 5.0.0"
37+
"version_requirement": ">= 5.0.0 < 7.0.0"
3838
},
3939
{
4040
"name": "puppetlabs/inifile",
@@ -70,11 +70,11 @@
7070
},
7171
{
7272
"name": "puppet/redis",
73-
"version_requirement": ">= 7.0.0"
73+
"version_requirement": ">= 7.0.0 < 8.0.0"
7474
},
7575
{
7676
"name": "camptocamp/systemd",
77-
"version_requirement": ">= 3.0.0"
77+
"version_requirement": ">= 3.0.0 < 4.0.0"
7878
}
7979
],
8080
"operatingsystem_support": [

0 commit comments

Comments
 (0)