-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerize #1365
Dockerize #1365
Changes from 7 commits
7e28b23
afb4594
08e99c6
e7f9e3f
bd1d793
58ca166
c31ea12
a1e5a76
e0460b2
b5c2f2e
61ece12
6e31155
c5c9e81
af3771b
b4b1d97
867b28d
e01cc2f
e4954ba
27c4af4
266e206
639a8dc
a10751d
73b694d
59bb043
7dfcd3b
8fb3f97
b2ef59b
df50cf6
aef6d4b
55326ca
273c8fe
a5508b1
0fe33ba
694f405
462fd34
26b611e
fd32878
8c7a816
54a8656
1f5b2a6
c8dc6a6
07abda7
6feed6e
adebdc3
61af925
344f589
f67ab19
5c32b23
11ef996
4cf1d83
5ab3a8d
841d5ce
8c7d2da
59b460a
07dd8e3
d582494
e5c7bfd
cbf7b27
2bff161
fe89d31
d878df7
7da4b55
884c3d3
07c2675
4c6cd16
4565195
a4ccbe4
f24b7f2
458ded5
1f988d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ vagrant/.vagrant | |
.eggs | ||
.idea | ||
.coverage | ||
env | ||
venv |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.PHONY: base | ||
|
||
build: | ||
docker build -t redis-py-base docker/base | ||
docker-compose down | ||
docker-compose build | ||
|
||
dev: | ||
docker-compose up -d | ||
|
||
test: dev | ||
find . -name "*.pyc" -exec rm -f {} \; | ||
docker-compose run test tox -- --redis-url="redis://master:6379/9" --redis-master-host=master |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: "3.8" | ||
|
||
services: | ||
master: | ||
build: docker/master | ||
ports: | ||
- "6379:6379" | ||
|
||
slave: | ||
build: docker/slave | ||
ports: | ||
- "6380:6380" | ||
|
||
sentinel_1: | ||
build: docker/sentinel_1 | ||
ports: | ||
- "26379:26379" | ||
|
||
sentinel_2: | ||
build: docker/sentinel_2 | ||
ports: | ||
- "26380:26380" | ||
|
||
sentinel_3: | ||
build: docker/sentinel_3 | ||
ports: | ||
- "26381:26381" | ||
|
||
test: | ||
image: fkrull/multi-python:latest | ||
working_dir: /redis-py | ||
volumes: | ||
- .:/redis-py |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FROM redis:6.0.5-buster |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM redis-py-base:latest | ||
|
||
COPY redis.conf /etc/conf/redis/redis.conf | ||
|
||
EXPOSE 6379 | ||
|
||
CMD redis-server |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pidfile /var/run/redis-master.pid | ||
bind * | ||
port 6379 | ||
daemonize yes | ||
unixsocket /tmp/redis_master.sock | ||
unixsocketperm 777 | ||
dbfilename master.rdb | ||
dir /var/lib/redis/backups | ||
logfile /var/log/redis-master |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM redis-py-base:latest | ||
|
||
COPY redis.conf /etc/conf/redis/redis.conf | ||
|
||
EXPOSE 26379 | ||
|
||
CMD redis-server |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pidfile /var/run/sentinel-1.pid | ||
port 26379 | ||
daemonize yes | ||
logfile /var/log/redis-sentinel-1 | ||
|
||
# short timeout for sentinel tests | ||
sentinel down-after-milliseconds mymaster 500 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM redis-py-base:latest | ||
|
||
COPY redis.conf /etc/conf/redis/redis.conf | ||
|
||
EXPOSE 26380 | ||
|
||
CMD redis-server |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pidfile /var/run/sentinel-2.pid | ||
port 26380 | ||
daemonize yes | ||
logfile /var/log/redis-sentinel-2 | ||
|
||
# short timeout for sentinel tests | ||
sentinel down-after-milliseconds mymaster 500 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM redis-py-base:latest | ||
|
||
COPY redis.conf /etc/conf/redis/redis.conf | ||
|
||
EXPOSE 26381 | ||
|
||
CMD redis-server |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pidfile /var/run/sentinel-3.pid | ||
port 26381 | ||
daemonize yes | ||
logfile /var/log/redis-sentinel-3 | ||
|
||
# short timeout for sentinel tests | ||
sentinel down-after-milliseconds mymaster 500 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM redis-py-base:latest | ||
|
||
COPY redis.conf /etc/conf/redis/redis.conf | ||
|
||
EXPOSE 6380 | ||
|
||
CMD redis-server |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pidfile /var/run/redis-slave.pid | ||
bind * | ||
port 6380 | ||
daemonize yes | ||
unixsocket /tmp/redis-slave.sock | ||
unixsocketperm 777 | ||
dbfilename slave.rdb | ||
dir /var/lib/redis/backups | ||
logfile /var/log/redis-slave | ||
|
||
slaveof 127.0.0.1 6379 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,14 +14,21 @@ | |
|
||
|
||
REDIS_INFO = {} | ||
default_redis_url = "redis://localhost:6379/9" | ||
DEFAULT_REDIS_URL = "redis://localhost:6379/9" | ||
DEFAULT_REDIS_MASTER_HOST = "localhost" | ||
|
||
|
||
|
||
def pytest_addoption(parser): | ||
parser.addoption('--redis-url', default=default_redis_url, | ||
parser.addoption('--redis-url', default=DEFAULT_REDIS_URL, | ||
action="store", | ||
help="Redis connection string," | ||
" defaults to `%(default)s`") | ||
parser.addoption('--redis-master-host', default=DEFAULT_REDIS_MASTER_HOST, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there ever a reason where Assuming there isn't a valid reason, we should infer the master hostname from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not. Fixed! |
||
action="store", | ||
help="Redis master hostname," | ||
" defaults to `%(default)s`") | ||
|
||
|
||
|
||
def _get_info(redis_url): | ||
|
@@ -156,6 +163,11 @@ def mock_cluster_resp_slaves(request, **kwargs): | |
return _gen_cluster_mock_resp(r, response) | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It shouldn't, no - updated! |
||
def master_host(request): | ||
yield request.config.getoption("--redis-master-host") | ||
|
||
|
||
def wait_for_command(client, monitor, command): | ||
# issue a command with a key name that's local to this process. | ||
# if we find a command with our key before the command we're waiting | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this line is really necessary.