Skip to content

Commit 23f100c

Browse files
authored
Merge pull request #698 from StackStorm/setup-redis
Add redis to install scripts
2 parents 3edb527 + 90d7991 commit 23f100c

16 files changed

Lines changed: 105 additions & 10 deletions

.circle/docker-compose.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -e
1111
# Source the build environment defintion (details in buildenv.sh)
1212
. ~/.buildenv
1313

14-
# Used for `RABBITMQHOST` `MONGODBHOST`, see docker-compose.override.yml
14+
# Used for `RABBITMQHOST`, `MONGODBHOST`, and `REDISHOST` see docker-compose.override.yml
1515
HOST_IP=$(ifconfig docker0 | grep 'inet addr' | awk -F: '{print $2}' | awk '{print $1}')
1616

1717
set -x
@@ -26,6 +26,7 @@ case "$1" in
2626
-e ST2PKG_RELEASE=${ST2PKG_RELEASE} \
2727
-e RABBITMQHOST=${HOST_IP} \
2828
-e MONGODBHOST=${HOST_IP} \
29+
-e REDISHOST=${HOST_IP} \
2930
-e ST2_CIRCLE_URL=${CIRCLE_BUILD_URL} \
3031
$2 /bin/true
3132
;;
@@ -38,6 +39,7 @@ case "$1" in
3839
-e ST2PKG_RELEASE=${ST2PKG_RELEASE} \
3940
-e RABBITMQHOST=${HOST_IP} \
4041
-e MONGODBHOST=${HOST_IP} \
42+
-e REDISHOST=${HOST_IP} \
4143
-e ST2_PACKAGES="${ST2_PACKAGES}" \
4244
-e ST2_CIRCLE_URL=${CIRCLE_BUILD_URL} \
4345
$2 build
@@ -52,6 +54,7 @@ case "$1" in
5254
-e ST2PKG_RELEASE=${ST2PKG_RELEASE} \
5355
-e RABBITMQHOST=${HOST_IP} \
5456
-e MONGODBHOST=${HOST_IP} \
57+
-e REDISHOST=${HOST_IP} \
5558
-e ST2_PACKAGES="${ST2_PACKAGES}" \
5659
-e ST2_CIRCLE_URL=${CIRCLE_BUILD_URL} \
5760
$2 test

docker-compose.circle.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ bionic:
2424
- bionictest
2525
- rabbitmq
2626
- mongodb
27+
- redis
2728

2829
el8:
2930
image: quay.io/stackstorm/packagingrunner
@@ -39,6 +40,7 @@ el8:
3940
- centos8test
4041
- rabbitmq
4142
- mongodb
43+
- redis
4244

4345
el7:
4446
image: quay.io/stackstorm/packagingrunner

docker-compose.circle2.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ xenial:
1111
- xenialtest
1212
- rabbitmq
1313
- mongodb
14+
- redis
1415

1516
bionic:
1617
image: quay.io/stackstorm/packagingrunner
@@ -26,6 +27,7 @@ bionic:
2627
- bionictest
2728
- rabbitmq
2829
- mongodb
30+
- redis
2931

3032
el8:
3133
image: quay.io/stackstorm/packagingrunner
@@ -40,6 +42,7 @@ el8:
4042
- centos8test
4143
- rabbitmq
4244
- mongodb
45+
- redis
4346

4447
el7:
4548
image: quay.io/stackstorm/packagingrunner
@@ -54,6 +57,7 @@ el7:
5457
- centos7test
5558
- rabbitmq
5659
- mongodb
60+
- redis
5761

5862
## Package build nodes
5963
#

docker-compose.override.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,8 @@ mongodb:
4848
image: mongo:4.0
4949
ports:
5050
- "27017:27017"
51+
52+
redis:
53+
image: redis:latest
54+
ports:
55+
- "6379:6379"

docker-compose.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ xenial:
1111
- xenialtest
1212
- rabbitmq
1313
- mongodb
14+
- redis
1415

1516
bionic:
1617
image: quay.io/stackstorm/packagingrunner
@@ -26,6 +27,7 @@ bionic:
2627
- bionictest
2728
- rabbitmq
2829
- mongodb
30+
- redis
2931

3032
el8:
3133
image: quay.io/stackstorm/packagingrunner
@@ -41,7 +43,7 @@ el8:
4143
- centos8test
4244
- rabbitmq
4345
- mongodb
44-
46+
- redis
4547

4648
el7:
4749
image: quay.io/stackstorm/packagingrunner
@@ -56,6 +58,7 @@ el7:
5658
- centos7test
5759
- rabbitmq
5860
- mongodb
61+
- redis
5962

6063
## Package build nodes
6164
#

rake/build/environment.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
# Default hostnames of dependat services (the value can take an address also)
5959
envpass :rabbitmqhost, 'rabbitmq', proc: convert_to_ipaddr
6060
envpass :mongodbhost, 'mongodb', proc: convert_to_ipaddr
61+
envpass :redishost, 'redis', proc: convert_to_ipaddr
6162

6263
# upload_sources - a list of directories which should be propogated
6364
# to remote nodes.

rake/spec/default/60-st2_all-services-ok_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
it { is_expected.to be_reachable.with :port => 27017, :timeout => 1 }
1616
end
1717

18+
describe 'redis' do
19+
subject { host(spec[:redishost]) }
20+
it { is_expected.to be_reachable.with :port => 6379, :timeout => 1 }
21+
end
22+
1823
end
1924

2025
describe 'start st2 components and services' do

rake/spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class ST2Spec
3131
package_list: pipeopts.packages,
3232
rabbitmqhost: pipeopts.rabbitmqhost,
3333
mongodbhost: pipeopts.mongodbhost,
34+
redishost: pipeopts.redishost,
3435
loglines_to_show: 100,
3536
logdest_pattern: {
3637
st2actionrunner: 'st2actionrunner.{pid}'

scripts/generate_st2_config.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ set -e
88
# --- Go!
99
MONGOHOST="${MONGODBHOST:-mongodb}"
1010
RABBITMQHOST="${RABBITMQHOST:-rabbitmq}"
11+
REDISHOST="${REDISHOST:-redis}"
1112

1213
CONF=/etc/st2/st2.conf
1314
AMQP="amqp://guest:guest@$RABBITMQHOST:5672/"
@@ -20,6 +21,7 @@ EHD
2021
# Don't join into one cmd with previous, otherwise it becomes
2122
# non-interactive waiting ^D.
2223
MONGO=$(echo "$MONGO" | sed -r 's/^\s+//')
24+
REDIS="redis://${REDISHOST}:6379"
2325

2426
# Specify rabbitmq host
2527
sed -i "/\[messaging\]/,/\[.*\]\|url/ {n; s#url.*=.*#url = $AMQP#}" $CONF
@@ -28,4 +30,7 @@ sed -i "/\[auth\]/,/\[.*\]\|enable/ {n; s#enable.*=.*#enable = False#}" $CONF
2830
# Create database section, st2.conf ships without it
2931
(grep "\[database\]" $CONF &>/dev/null) || echo "$MONGO" >> /etc/st2/st2.conf
3032

33+
# Specify redis host
34+
sed -i "/\[coordination\]/,/\[.*\]\|url/ {n; s#url.*=.*#url = $REDIS#}" $CONF
35+
3136
echo "Resulting $CONF >>>" "$(cat $CONF)"

scripts/includes/common.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ check_st2_host_dependencies() {
8383
# CHECK 1: Determine which, if any, of the required ports are used by an existing process.
8484

8585
# Abort the installation early if the following ports are being used by an existing process.
86-
# nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), and st2 (9100-9102).
86+
# nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), redis (6379)
87+
# and st2 (9100-9102).
8788

88-
declare -a ports=("80" "443" "4369" "5672" "9100" "9101" "9102" "25672" "27017")
89+
declare -a ports=("80" "443" "4369" "5672" "6379" "9100" "9101" "9102" "25672" "27017")
8990
declare -a used=()
9091

9192
for i in "${ports[@]}"

0 commit comments

Comments
 (0)