Skip to content

Commit

Permalink
redis cluster for github action
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnudxb committed May 24, 2020
1 parent 466beb8 commit b676a62
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 17 deletions.
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Zhulik

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
# redis-cluster
Github action for running a redis cluster for your workflow
# Redis Cluster GitHub Action

This [GitHub Action](https://github.com/features/actions) sets up Redis cluster with 3 master and 3 slave in a single container for your testing purpose.

The image used is from https://github.com/vishnudxb/docker-redis-cluster

# Usage

See [action.yml](action.yml)

Basic:
```yaml
steps:
- uses: vishnudxb/redis-cluster@1.0.0
with:
master1-port: '5000'
master2-port: '5001'
master3-port: '5002'
slave1-port: '5003'
slave2-port: '5003'
slave3-port: '5004'
```
# License
The scripts and documentation in this project are released under the [MIT License](LICENSE)
34 changes: 23 additions & 11 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
# action.yml
name: 'Hello World'
description: 'Greet someone and record the time'
name: 'Redis Cluster with Master-Slave'
description: 'Setup Redis cluster with 3 master and 3 slave in a single container'
author: 'Vishnu Nair'
branding:
icon: 'database'
color: 'red'
inputs:
who-to-greet: # id of input
description: 'Who to greet'
master1-port:
description: 'Port number for master1'
required: true
master2-port:
description: 'Port number for master2'
required: true
master3-port:
description: 'Port number for master3'
required: true
slave1-port:
description: 'Port number for slave1'
required: true
slave2-port:
description: 'Port number for slave2'
required: true
slave3-port:
description: 'Port number for slave3'
required: true
default: 'World'
outputs:
time: # id of output
description: 'The time we greeted you'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.who-to-greet }}
8 changes: 4 additions & 4 deletions entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh -l
#!/bin/sh

echo "Hello $1"
time=$(date)
echo "::set-output name=time::$time"
docker_run="docker run -d -p $INPUT_MASTER1_PORT:6379 -p $INPUT_MASTER2_PORT:6380 -p $INPUT_MASTER3_PORT:6381 -p $INPUT_SLAVE1_PORT:6382 -p $INPUT_SLAVE2_PORT:6383 -p $INPUT_SLAVE3_PORT:6384 --name redis-cluster vishnunair/docker-redis-cluster:latest"

sh -c "$docker_run"

0 comments on commit b676a62

Please sign in to comment.