-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync from main
- Loading branch information
Showing
5 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
redis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
version: "3" | ||
services: | ||
redis-1: | ||
image: redis | ||
command: ["redis-server","/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis/node-1/data:/data | ||
- ./redis/node-1/conf/redis.conf:/etc/redis/redis.conf | ||
network_mode: "host" | ||
redis-2: | ||
image: redis | ||
command: ["redis-server", "/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis/node-2/data:/data | ||
- ./redis/node-2/conf/redis.conf:/etc/redis/redis.conf | ||
network_mode: "host" | ||
redis-3: | ||
image: redis | ||
command: ["redis-server", "/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis/node-3/data:/data | ||
- ./redis/node-3/conf/redis.conf:/etc/redis/redis.conf | ||
network_mode: "host" | ||
redis-4: | ||
image: redis | ||
command: ["redis-server", "/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis/node-4/data:/data | ||
- ./redis/node-4/conf/redis.conf:/etc/redis/redis.conf | ||
network_mode: "host" | ||
redis-5: | ||
image: redis | ||
command: ["redis-server", "/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis/node-5/data:/data | ||
- ./redis/node-5/conf/redis.conf:/etc/redis/redis.conf | ||
network_mode: "host" | ||
redis-6: | ||
image: redis | ||
command: ["redis-server", "/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis/node-6/data:/data | ||
- ./redis/node-6/conf/redis.conf:/etc/redis/redis.conf | ||
network_mode: "host" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
PROJECT_NAME=grad-support | ||
# set up redis | ||
REDIS_MASTER_NODE_NAME=redis-1-1 | ||
# first clean up, remove artifacts | ||
if [ -d redis ]; then | ||
rm -r redis | ||
fi | ||
# create dirs for cluster | ||
mkdir redis; | ||
for i in $(seq 0 5); | ||
do | ||
mkdir -p redis/node-$((i+1))/{conf,data}; | ||
echo "port 700$i | ||
cluster-require-full-coverage no | ||
cluster-migration-barrier 1 | ||
protected-mode no | ||
cluster-enabled yes | ||
cluster-config-file nodes.conf | ||
cluster-node-timeout 5000 | ||
appendonly yes | ||
requirepass secret | ||
masterauth secret" > redis/node-$((i+1))/conf/redis.conf | ||
done | ||
# fire up docker | ||
docker compose --project-name "$PROJECT_NAME" up -d | ||
CONTAINER_ID=$(docker ps --all --filter name="$PROJECT_NAME-$REDIS_MASTER_NODE_NAME" --format="{{.ID}}" | head -n 1) | ||
CONTAINER_STATUS=$(docker inspect --format "{{json .State.Status }}" "$CONTAINER_ID") | ||
until [ "$CONTAINER_STATUS" = '"running"' ] | ||
do | ||
echo "Waiting for container to start..." | ||
sleep 1 | ||
done | ||
echo "Container up, initiating cluster..." | ||
docker exec "$CONTAINER_ID" redis-cli -a secret --cluster create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 --cluster-replicas 1 --cluster-yes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Local development support tools for GRAD | ||
Most GRAD apis rely on the support of services like nats and redis in order to function correctly. This directory contains scripts that provision dockerized support for developers local environments. | ||
### Prerequisites | ||
In order to use the scripts in this directory, it will require: | ||
|
||
### Windows | ||
|
||
**Install Ubuntu 24.xx.xx using WSL2**. Information can be found [here](https://learn.microsoft.com/en-us/windows/wsl/install) | ||
|
||
After Ubuntu install, a few things to make life easier, set up your linux environment | ||
1. ensure bash is your default shell\ | ||
`chsh -s /bin/bash` | ||
2. install docker compose\ | ||
`sudo apt install docker-compose` | ||
3. enable docker without sudo\ | ||
`sudo groupadd docker`\ | ||
`sudo usermod -aG docker $USER` | ||
|
||
**Install Docker Desktop version > v4.32.0** | ||
Ensure the following features are enabled:\ | ||
Go to *Settings / Resources / WSL integrations* and ensure your WSL2 Ubuntu 24.xx.xx integration is selected\ | ||
Go to *Settings / Features in development / Enable host networking* | ||
|
||
### Running the setup | ||
1. Ensure docker desktop is running | ||
2. Open your WSL linux distro and navigate to this directory (remember your windows drives can be found under /mnt) | ||
3. Run the init-local-dev.sh script:\ `sudo ./init-local-dev.sh` | ||
|
||
The script will provision the necessary volume structure and set up the necessary docker containers etc. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters