Skip to content

Commit e5932d8

Browse files
Merge pull request #4 from alaluces/master
Created a dockerfile and included the redis_pw argument
2 parents d20f10a + f2c3d7d commit e5932d8

File tree

6 files changed

+51
-7
lines changed

6 files changed

+51
-7
lines changed

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM python:3.7-slim-stretch
2+
RUN apt-get -y update && apt-get -y install build-essential
3+
RUN apt-get -y install gettext-base
4+
RUN mkdir /redis-load-test
5+
COPY ./Scripts /redis-load-test/Scripts
6+
WORKDIR /redis-load-test/Scripts
7+
RUN pip3 install -r requirments.txt
8+
CMD ["/redis-load-test/Scripts/start.sh"]

Scripts/redis.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

Scripts/redis_get_set.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def load_config(filepath):
2727
configs = load_config(filename)
2828

2929
class RedisClient(object):
30-
def __init__(self, host=configs["redis_host"], port=configs["redis_port"]):
31-
self.rc = redis.StrictRedis(host=host, port=port)
30+
def __init__(self, host=configs["redis_host"], port=configs["redis_port"], password=configs["redis_password"]):
31+
self.rc = redis.StrictRedis(host=host, port=port, password=password)
3232

3333
def query(self, key, command='GET'):
3434
"""Function to Test GET operation on Redis"""

Scripts/redis_orig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"redis_host": "$REDIS_HOST",
3+
"redis_port": "$REDIS_PORT",
4+
"redis_password": "$REDIS_PW"
5+
}

Scripts/start.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#! /bin/sh
2+
envsubst < redis_orig.json > redis.json
3+
ls -la
4+
cat redis.json
5+
locust -f redis_get_set.py

redis-load-test.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: redis-load-test
6+
spec:
7+
strategy:
8+
type: Recreate
9+
selector:
10+
matchLabels:
11+
app: redis-load-test
12+
replicas: 1
13+
template:
14+
metadata:
15+
labels:
16+
app: redis-load-test
17+
spec:
18+
containers:
19+
- env:
20+
- name: REDIS_PORT
21+
value: "6379"
22+
- name: REDIS_HOST
23+
value: "localhost"
24+
- name: REDIS_PW
25+
value: "your_redis_auth"
26+
name: redis-load-test
27+
image: arieslaluces/rlt:latest
28+
ports:
29+
- containerPort: 80
30+
31+

0 commit comments

Comments
 (0)