Skip to content

Commit

Permalink
Set protected mode to no in all images. Add new released version. Add…
Browse files Browse the repository at this point in the history
…ed new invoke task list-releases to help quicker identify new redis releases on github. Added dev-requirements.txt file to easier handle invoke script
  • Loading branch information
Grokzen committed Apr 10, 2023
1 parent b188976 commit d5a8e12
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ env:
# - REDIS_VERSION=3.2.13
# - REDIS_VERSION=4.0.14
# - REDIS_VERSION=5.0.12
- REDIS_VERSION=6.0.17
- REDIS_VERSION=6.2.9
- REDIS_VERSION=7.0.8
- REDIS_VERSION=6.0.18
- REDIS_VERSION=6.2.11
- REDIS_VERSION=7.0.10
script:
docker build --build-arg redis_version=$REDIS_VERSION -t grokzen/redis-cluster .
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,30 +84,31 @@ docker run -e "IP=0.0.0.0" -p 7000-7005:7000-7005 grokzen/redis-cluster:latest

# Usage

This git repo is using `pyinvoke` to pull, build, push docker images. You can use it to build your own images if you like.
This git repo is using `invoke` to pull, build, push docker images. You can use it to build your own images if you like.

The invoke scripts in this repo is written only for python 3.7 and above

Install `pyinvoke` with `pip install invoke`.
Install `invoke` with `pip install invoke`.

This script will run `N num of cpu - 1` parralell tasks based on your version input.

To see available commands run `invoke -l` in the root folder of this repo. Example

```
(tmp-615229a94c330b9) ➜ docker-redis-cluster git:(pyinvoke) ✗ invoke -l
(tmp-615229a94c330b9) ➜ docker-redis-cluster git:(invoke) ✗ invoke -l
"Configured multiprocess pool size: 3
Available tasks:
build
list
pull
push
```

Each command is only taking one required positional argument `version`. Example:

```
(tmp-615229a94c330b9) ➜ docker-redis-cluster git:(pyinvoke) ✗ invoke build 6.0
(tmp-615229a94c330b9) ➜ docker-redis-cluster git:(invoke) ✗ invoke build 7.0
...
```

Expand Down Expand Up @@ -228,10 +229,12 @@ The following tags with pre-built images is available on `docker-hub`.

Latest release in the most recent stable branch will be used as `latest` version.

- latest == 7.0.8
- latest == 7.0.10

Redis 7.0.x version:

- 7.0.10
- 7.0.9
- 7.0.8
- 7.0.7
- 7.0.6
Expand All @@ -244,6 +247,7 @@ Redis 7.0.x version:

Redis 6.2.x versions:

- 6.2.11
- 6.2.10
- 6.2.9
- 6.2.8
Expand All @@ -258,6 +262,7 @@ Redis 6.2.x versions:

Redis 6.0.x versions:

- 6.0.18
- 6.0.17
- 6.0.16
- 6.0.15
Expand Down
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoke>=2.0.0
requests>=2.28.2
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
build:
context: .
args:
redis_version: '7.0.8'
redis_version: '7.0.10'
hostname: server
ports:
- '7000-7050:7000-7050'
Expand Down
1 change: 1 addition & 0 deletions redis-cluster.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
dir /redis-data/${PORT}
protected-mode no
1 change: 1 addition & 0 deletions redis.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ bind ${BIND_ADDRESS}
port ${PORT}
appendonly yes
dir /redis-data/${PORT}
protected-mode no
35 changes: 31 additions & 4 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import multiprocessing
import requests

from multiprocessing import Pool
from invoke import task


latest_version_string = "7.0.8"
latest_version_string = "7.0.10"

# Unpublished versions
version_config_mapping = []
Expand All @@ -13,9 +15,9 @@
version_config_mapping += [f"5.0.{i}" for i in range(0, 13)]

# Published versions
version_config_mapping += [f"6.0.{i}" for i in range(0, 18)]
version_config_mapping += [f"6.2.{i}" for i in range(0, 11)]
version_config_mapping += [f"7.0.{i}" for i in range(0, 9)]
version_config_mapping += [f"6.0.{i}" for i in range(0, 19)]
version_config_mapping += [f"6.2.{i}" for i in range(0, 12)]
version_config_mapping += [f"7.0.{i}" for i in range(0, 11)]


def version_name_to_version(version):
Expand Down Expand Up @@ -130,3 +132,28 @@ def push(c, version, cpu=None):
def list(c):
from pprint import pprint
pprint(version_config_mapping, indent=2)


@task
def list_releases(c):
releases = []

for page in range(1, 5):
data = requests.get("https://api.github.com/repos/redis/redis/releases", params={"page": int(page)})

if data.status_code == 200:
for release in data.json():
r = release["name"]

if "rc" in r or r.startswith("5"):
pass
else:
releases.append(r)
else:
print("Error, stopping")

for released_version in releases:
if released_version in version_config_mapping:
print(f"Release found - {released_version}")
else:
print(f"NOT found - {released_version}")

0 comments on commit d5a8e12

Please sign in to comment.