{"id":22726031,"url":"https://github.com/superwalnut/redis-cluster-dotnet-core-template","last_synced_at":"2025-09-23T21:56:39.950Z","repository":{"id":40851508,"uuid":"284235336","full_name":"superwalnut/redis-cluster-dotnet-core-template","owner":"superwalnut","description":"This is a template project for a .net core 3.1 API web service with Redis cluster distributed caching in Docker","archived":false,"fork":false,"pushed_at":"2022-12-08T12:33:51.000Z","size":84,"stargazers_count":4,"open_issues_count":3,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-13T20:46:20.374Z","etag":null,"topics":["docker","dotnet-core","netcore3","redis-cluster","redis-dotnet"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/superwalnut.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-01T10:09:06.000Z","updated_at":"2025-03-04T09:49:39.000Z","dependencies_parsed_at":"2022-09-14T14:50:41.241Z","dependency_job_id":null,"html_url":"https://github.com/superwalnut/redis-cluster-dotnet-core-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superwalnut%2Fredis-cluster-dotnet-core-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superwalnut%2Fredis-cluster-dotnet-core-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superwalnut%2Fredis-cluster-dotnet-core-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superwalnut%2Fredis-cluster-dotnet-core-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/superwalnut","download_url":"https://codeload.github.com/superwalnut/redis-cluster-dotnet-core-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248782275,"owners_count":21160716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","dotnet-core","netcore3","redis-cluster","redis-dotnet"],"created_at":"2024-12-10T16:15:32.503Z","updated_at":"2025-09-23T21:56:34.928Z","avatar_url":"https://github.com/superwalnut.png","language":"C#","funding_links":["https://ko-fi.com/Z8Z61I9HB"],"categories":[],"sub_categories":[],"readme":"# Project Template - Redis Cluster + .Net Core 3.1 API + Docker\n\n\u003e This is a project template that saves your time create redis cluster in docker with a dotnet core app to consume from scratch. All you need to do is using docker-compose up and you already have 1 master + 3 slaves redis cluster.\n\nRead full medium article https://medium.com/@mrkevin.wang/create-redis-cluster-docker-net-core-3-1-api-for-distributed-caching-ff0ba1673231\n\n**Pre-request**\n\n- Redis [Bitnami Redis](https://github.com/bitnami/bitnami-docker-redis)\n- Docker\n- .Net Core 3.1 ([.Net Core 3.1 sdk - docker](https://hub.docker.com/_/microsoft-dotnet-core-sdk))\n- [ServiceStack.Redis](https://github.com/ServiceStack/ServiceStack.Redis)\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Support](#support)\n- [License](#license)\n\n---\n\n## Features\n\n\u003e This is a development project template, it is NOT production ready. It only kickstarting your project so that you don't need to build from scratch.\n\n- Pre-built and configured redis cluster in docker\n- Pre-built a sample web API in .net core 3.1\n- The sample web API is built with DockerFile and runs in docker\n- Easy to scale redis with n-masters \u0026 n-slaves in docker\n- Built in generic cache client using ServiceStack.Redis\n\n---\n\n## Installation\n\n- Using `dotnet new -i \u003cpackage\u003e` to install the project template from nuget [Superwalnut.RedisClusterTemplate](https://www.nuget.org/packages/Superwalnut.RedisClusterTemplate)\n\n```shell\n$ dotnet new -i Superwalnut.RedisClusterTemplate\n```\n\nYou should see 'Redis .Net Core Template' in your template list by `dotnet new -l`\n\n![Redis .net core Template Screenshot](images/dotnet-new-l.png)\n\n- Using `dotnet new redis-dotnet-core -n \u003cyour-project-name\u003e` to create a project with your own project name using this template\n\n```shell\n$ dotnet new redis-dotnet-core -n RedisDemo -o RedisDemo\n```\n\nThis creates a project in folder `RedisDemo`\n\n![Redis Demo](images/redis-demo.png)\n\n---\n\n### Usage\n\n- Default - 1 master + 1 slave + 1 api\n\n\u003e Go to the \u003cproject-folder\u003e/docker, you will see `docker-compose.yml` file, this is where you can run\n\n```shell\n$ docker-compose up --build\n```\n\n- Swarm Mode - 1 master + 3 slaves + 1 api\n\n\u003e Run `docker-compose` with compatibility mode, it will apply preset `deploy` to run docker swarm mode \n\n```json\n    deploy:\n      replicas: 3\n```\n\n```shell\n$ docker-compose --compatibility up --build\n```\n\n- Advanced - n-Master + n-Slaves + api\n\n\u003e To run n number of masters and slaves, you will need to configure a couple of things in `docker-compose.yml`\n\nConfigure connection strings in api container, add n-number of master and n-number of slaves connection strings\n\n```json\n    - Redis__0=docker_redis-master_1:6379\n    - Redis__1=docker_redis-replica_1:6379\n    - Redis__2=docker_redis-replica_2:6379\n    - Redis__3=docker_redis-replica_3:6379\n```\n\nAdd or configure `deploy` section to the number you wanted\n\n```json\n    deploy:\n    replicas: 3\n```\n\n---\n\n## Documentation\n\n- TODO\n\n---\n\n## Support\n\nReach out to me at one of the following places!\n\n- [Follow me @ Github](https://github.com/superwalnut)\n\n- [Twitter](https://twitter.com/superwalnuts)\n\n- [![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Z8Z61I9HB)\n\n---\n\n## License\n\n[![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://badges.mit-license.org)\n\n- **[MIT license](http://opensource.org/licenses/mit-license.php)**\n\n-------\n\n## Reference\n\n- docker stop all\n\nocker stop $(docker ps -a -q)\ndocker rm $(docker ps -a -q)\n\n- run command\ndocker-compose up --detach --scale redis-master=1 --scale redis-replica=3\n\ndocker-compose --compatibility up --build -p redis\n\n- pack the project template\ndotnet pack\n\ndotnet build -c Release\n\n- install template\n\ndotnet new -i \u003cpackage\u003e\n\n- create project\n\ndotnet new redis-dotnet-core -n MyProject --force\n\n- stop docker \ndocker ps -q | xargs -L1 docker stop\n\n- start docker\nopen --background -a Docker\n\n\n- generate dev-cert ssl\ndotnet dev-certs https --clean\n\ndotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p password\n\ndotnet dev-certs https --trust","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperwalnut%2Fredis-cluster-dotnet-core-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuperwalnut%2Fredis-cluster-dotnet-core-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperwalnut%2Fredis-cluster-dotnet-core-template/lists"}