abp icon indicating copy to clipboard operation
abp copied to clipboard

Remove Redis config on startup template

Open buaziz opened this issue 6 years ago • 16 comments

host folder in startup template assumes redis configuration which results in below error on launching HostAPI and Identity Server projects individually.

image

https://github.com/abpframework/abp/blob/9bfaede7a1e1d2ab2886e5c4cc278103480967d0/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.json#L9-L11

Error text:

2020-08-11 12:46:44.129 +03:00 [WRN] It was not possible to connect to the redis server(s). UnableToConnect on 127.0.0.1:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 2s ago, last-write: 2s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 62s ago, v: 2.0.593.37019
StackExchange.Redis.RedisConnectionException: It was not possible to connect to the redis server(s). UnableToConnect on 127.0.0.1:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 2s ago, last-write: 2s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 62s ago, v: 2.0.593.37019
   at StackExchange.Redis.ConnectionMultiplexer.ConnectImplAsync(Object configuration, TextWriter log) in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 825
   at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.ConnectAsync(CancellationToken token)
   at Volo.Abp.Caching.StackExchangeRedis.AbpRedisCache.SetManyAsync(IEnumerable`1 items, DistributedCacheEntryOptions options, CancellationToken token)
   at Volo.Abp.Caching.DistributedCache`2.SetManyAsync(IEnumerable`1 items, DistributedCacheEntryOptions options, Nullable`1 hideErrors, CancellationToken token)

buaziz avatar Aug 11 '20 09:08 buaziz

https://github.com/abpframework/abp/blob/9bfaede7a1e1d2ab2886e5c4cc278103480967d0/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs#L44

HttpApi.Host project used redis for distributed caching. Should not be removed.

realLiangshiwei avatar Aug 11 '20 10:08 realLiangshiwei

so I guess it should be documented to install redis, and launching this project will load for 60 seconds until it times out.

buaziz avatar Aug 11 '20 10:08 buaziz

Which document?

realLiangshiwei avatar Aug 11 '20 10:08 realLiangshiwei

https://docs.abp.io/en/abp/latest/Startup-Templates/Module#separated-deployment-databases-scenario

buaziz avatar Aug 11 '20 10:08 buaziz

https://docs.abp.io/en/abp/latest/Startup-Templates/Application#httpapi-host-project

buaziz avatar Aug 11 '20 10:08 buaziz

OK. I will update the document. Thanks.

realLiangshiwei avatar Aug 11 '20 10:08 realLiangshiwei

For others to know how to install redis on Windows.

To install Redis on your local machine:

buaziz avatar Aug 14 '20 07:08 buaziz

I don't think it is necessary. Developers should know how to configure the development environment(like install redis.)

realLiangshiwei avatar Aug 14 '20 07:08 realLiangshiwei

Maybe in addition to documenting Redis as a pre requirement, also add redis to the module template docker files? So by default this (all?) requirements are met when starting the docker containers for development.

JSvanDonk avatar Aug 25 '20 07:08 JSvanDonk

Why do we have to have Redis on development environment? tempkey.rsa works well and offers the least resistance to get started. Redis isn't native on Windows so you have to use it through Windows Subsystem for Linux or use old versions or Redis etc. which makes it very messy when it used to work out-of-the-box before.

Can we enable it for production only instead?

Edit:

Okay, @realLiangshiwei would you be able to update the docs to include a link to memurai for Windows users? Maybe this is an alternative to switching it off on dev.

Also, how long has the startup template had redis included? My project was created back in abp v0.21 and this seems to have slipped through until now! 🤦

olicooper avatar Sep 02 '20 16:09 olicooper

Can not be used for production only, there will be inconsistent cache problems.

And I don't think installing Redis is a problem, developers should know this knowledge

realLiangshiwei avatar Sep 03 '20 02:09 realLiangshiwei

use this

https://www.memurai.com/get-memurai

buaziz avatar Sep 03 '20 10:09 buaziz

so crazy that without a redis, you can even not make a bookstore. - -!

yeahe83 avatar Sep 04 '20 08:09 yeahe83

so crazy that without a redis, you can even not make a bookstore. - -!

No, you can do. Just don't use a tiered solution for MVC (or don't use separate IDS for angular). In this way you will have a single server side application and you don't need to a distributed cache in development.

If you want to separate them, there will be two server applications and somehow they should use a shared cache. This is why the such a tiered startup template requires redis. Otherwise, you will have inconsistent caches between applications. It is just that simple. What's the problem here?

hikalkan avatar Sep 06 '20 17:09 hikalkan

so crazy that without a redis, you can even not make a bookstore. - -!

No, you can do. Just don't use a tiered solution for MVC (or don't use separate IDS for angular). In this way you will have a single server side application and you don't need to a distributed cache in development.

If you want to separate them, there will be two server applications and somehow they should use a shared cache. This is why the such a tiered startup template requires redis. Otherwise, you will have inconsistent caches between applications. It is just that simple. What's the problem here?

haha, i just say redis now is more than why it is created.

yeahe83 avatar Oct 27 '20 07:10 yeahe83

For the "windows fan" looking for the redis.msi installer: https://github.com/microsoftarchive/redis/releases

Everything works 100% after installing Redis. Thank you @buaziz / @hikalkan

DenverSearle avatar Nov 18 '20 17:11 DenverSearle