Skip to content

Commit

Permalink
Merge pull request #931 from gofiber/rueidis
Browse files Browse the repository at this point in the history
Add support for rueidis storage driver
  • Loading branch information
ReneWerner87 authored Aug 23, 2023
2 parents 861ed0d + bceeafc commit eb9a811
Show file tree
Hide file tree
Showing 13 changed files with 961 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ updates:
directory: "/couchbase/" # Location of package manifests
labels:
- "🤖 Dependencies"
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "/coherence/" # Location of package manifests
labels:
Expand Down Expand Up @@ -120,8 +122,15 @@ updates:
- "🤖 Dependencies"
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "/mssql/" # Location of package manifests
labels:
- "🤖 Dependencies"
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "/rueidis/" # Location of package manifests
labels:
- "🤖 Dependencies"
schedule:
interval: "daily"
50 changes: 50 additions & 0 deletions .github/release-drafter-rueidis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name-template: 'Rueidis - v$RESOLVED_VERSION'
tag-template: 'rueidis/v$RESOLVED_VERSION'
tag-prefix: rueidis/v
include-paths:
- rueidis
categories:
- title: '❗ Breaking Changes'
labels:
- '❗ BreakingChange'
- title: '🚀 New'
labels:
- '✏️ Feature'
- title: '🧹 Updates'
labels:
- '🧹 Updates'
- '🤖 Dependencies'
- title: '🐛 Fixes'
labels:
- '☢️ Bug'
- title: '📚 Documentation'
labels:
- '📒 Documentation'
change-template: '- $TITLE (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
exclude-contributors:
- dependabot
- dependabot[bot]
version-resolver:
major:
labels:
- 'major'
- '❗ BreakingChange'
minor:
labels:
- 'minor'
- '✏️ Feature'
patch:
labels:
- 'patch'
- '📒 Documentation'
- '☢️ Bug'
- '🤖 Dependencies'
- '🧹 Updates'
default: patch
template: |
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...rueidis/v$RESOLVED_VERSION
Thank you $CONTRIBUTORS for making this update possible.
58 changes: 58 additions & 0 deletions .github/scripts/gen-test-certs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

# Generate some test certificates which are used by the regression test suite:
#
# ./tls/ca.{crt,key} Self signed CA certificate.
# ./tls/redis.{crt,key} A certificate with no key usage/policy restrictions.
# ./tls/client.{crt,key} A certificate restricted for SSL client usage.
# ./tls/server.{crt,key} A certificate restricted for SSL server usage.

generate_cert() {
local name=$1
local cn="$2"
local opts="$3"

local keyfile=./tls/${name}.key
local certfile=./tls/${name}.crt

[ -f $keyfile ] || openssl genrsa -out $keyfile 2048
openssl req \
-new -sha256 \
-subj "/O=Redis Test/CN=$cn" \
-key $keyfile | \
openssl x509 \
-req -sha256 \
-CA ./tls/ca.crt \
-CAkey ./tls/ca.key \
-CAserial ./tls/ca.txt \
-CAcreateserial \
-days 365 \
$opts \
-out $certfile
}

mkdir -p ./tls
[ -f ./tls/ca.key ] || openssl genrsa -out ./tls/ca.key 4096
openssl req \
-x509 -new -nodes -sha256 \
-key ./tls/ca.key \
-days 3650 \
-subj '/O=Redis Test/CN=Certificate Authority' \
-out ./tls/ca.crt

cat > ./tls/openssl.cnf <<_END_
[ server_cert ]
keyUsage = digitalSignature, keyEncipherment
nsCertType = server
[ client_cert ]
keyUsage = digitalSignature, keyEncipherment
nsCertType = client
_END_

generate_cert server "Server-only" "-extfile ./tls/openssl.cnf -extensions server_cert"
generate_cert client "Client-only" "-extfile ./tls/openssl.cnf -extensions client_cert"
generate_cert redis "Generic-cert"

# List generated certs
ls -la ./tls
echo "$PWD"
8 changes: 6 additions & 2 deletions .github/workflows/gosec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ jobs:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '^1.18.x'
go-version: '^1.19.x'
check-latest: true
cache: false
- name: Install Gosec
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
- name: Run Gosec (root)
working-directory: .
run: |
gosec -exclude-dir=arangodb -exclude-dir=badger -exclude-dir=couchbase -exclude-dir=dynamodb -exclude-dir=etcd -exclude-dir=memcache -exclude-dir=memory -exclude-dir=mongodb -exclude-dir=mysql -exclude-dir=postgres -exclude-dir=redis -exclude-dir=ristretto -exclude-dir=sqlite3 -exclude-dir=s3 -exclude-dir=bbolt -exclude-dir=azureblob -exclude-dir=mssql -exclude-dir=pebble -exclude-dir=coherence ./....
gosec -exclude-dir=arangodb -exclude-dir=badger -exclude-dir=couchbase -exclude-dir=dynamodb -exclude-dir=etcd -exclude-dir=memcache -exclude-dir=memory -exclude-dir=mongodb -exclude-dir=mysql -exclude-dir=postgres -exclude-dir=redis -exclude-dir=ristretto -exclude-dir=sqlite3 -exclude-dir=s3 -exclude-dir=bbolt -exclude-dir=azureblob -exclude-dir=mssql -exclude-dir=pebble -exclude-dir=rueidis -exclude-dir=coherence ./....
# -----
- name: Run Gosec (arangodb)
working-directory: ./arangodb
Expand Down Expand Up @@ -116,3 +116,7 @@ jobs:
working-directory: ./pebble
run: gosec ./...
# -----
- name: Run Gosec (rueidis)
working-directory: ./rueidis
run: gosec ./...
# -----
19 changes: 19 additions & 0 deletions .github/workflows/release-drafter-rueidis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Release Drafter Rueidis
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
- main
paths:
- 'rueidis/**'
jobs:
draft_release_rueidis:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter-rueidis.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61 changes: 61 additions & 0 deletions .github/workflows/test-rueidis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
on:
push:
branches:
- master
- main
paths:
- 'rueidis/**'
pull_request:
paths:
- 'rueidis/**'
name: "Tests Rueidis"
jobs:
Tests:
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- 1.20.x
- 1.21.x
redis:
- '6.x'
- '7.x'
steps:
- name: Fetch Repository
uses: actions/checkout@v3

- name: Generate TLS certs
run: ./.github/scripts/gen-test-certs.sh

- name: Setup Redis
uses: shogo82148/actions-setup-redis@v1
with:
redis-version: ${{ matrix.redis }}
auto-start: 'false'
redis-port: '6379'
redis-tls-port: '6380'

- name: Run Redis
run: |
redis-server --tls-port 6380 --port 6379 \
--tls-cert-file /home/runner/work/storage/storage/tls/redis.crt \
--tls-key-file /home/runner/work/storage/storage/tls/redis.key \
--tls-ca-cert-file /home/runner/work/storage/storage/tls/ca.crt &
- name: Setup Redis Cluster
uses: vishnudxb/redis-cluster@1.0.8
with:
master1-port: 7000
master2-port: 7001
master3-port: 7002
slave1-port: 7003
slave2-port: 7004
slave3-port: 7005

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '${{ matrix.go-version }}'

- name: Run Test
run: cd ./rueidis && go test ./... -v -race
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type Storage interface {
- [Pebble](./pebble/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+Pebble%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-pebble.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
- [Postgres](./postgres/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+Postgres%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-postgres.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
- [Redis](./redis/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+Redis%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-redis.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
- [Rueidis](./rueidis/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+rueidis%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-rueidis.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
- [S3](./s3/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+S3%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-s3.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>
- [SQLite3](./sqlite3/README.md) <a href="https://github.com/gofiber/storage/actions?query=workflow%3A%22Tests+Sqlite3%22"> <img src="https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-sqlite3.yml?branch=main&label=%F0%9F%A7%AA%20&style=flat&color=75C46B" /> </a>

Loading

0 comments on commit eb9a811

Please sign in to comment.