Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Not able to connect to redis service #5

Open
sangee2004 opened this issue Oct 18, 2023 · 3 comments
Open

Not able to connect to redis service #5

sangee2004 opened this issue Oct 18, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@sangee2004
Copy link

sangee2004 commented Oct 18, 2023

Steps to reproduce the problem:

  1. Deploy redis app using image ghcr.io/acorn-io/redis:v7.2.1-0
silent-river                    ghcr.io/acorn-io/redis:v7.2.1-0*         d370f07e9b73   39m ago                                                                        OK
  1. Deploy a consume app using example app in - https://github.com/acorn-io/aws/tree/main/elasticache/redis/examples/echo-app

Modified the Acronfile to consume the redis app deployed in step1:

services: redis: {
external: "silent-river"
}
containers: app: {
build: context: "./"
ports: publish: ["5000/http"]
env: {
		REDIS_HOST: "@{service.redis.address}"
		REDIS_PORT: "@{service.redis.port.6379}"
		REDIS_PASSWORD: "@{service.redis.secrets.admin.token}"
	}
}
  1. Once the app is deployed , try to access the endpoint url.

Endpoint url is not rendered.

Note - I am able to consume redis service successfully using the example app provided in https://github.com/acorn-io/redis/tree/main/examples

@sangee2004 sangee2004 added the bug Something isn't working label Oct 18, 2023
@lucj
Copy link
Contributor

lucj commented Oct 19, 2023

Hi @sangee2004,
thanks for reporting this issue.
Could you run a shell in your app container and confirm the env vars are correctly set ?

@sangee2004
Copy link
Author

@lucj I see the REDIS env variables set from the consuming app

%acorn apps
NAME           IMAGE                             COMMIT         CREATED     ENDPOINTS                                          MESSAGE
consumeredis   4487e23d7bc3                      8c4752ec926d   2m51s ago   https://consumeredis-f4f471a4.heh8lh.on-acorn.io   OK
myredis        ghcr.io/acorn-io/redis:v7.2.1-0   d370f07e9b73   10m ago                                                        OK

 % acorn exec consumeredis
/src # env | grep REDIS
REDIS_PORT=6379
REDIS_PASSWORD=cd7h2ac9670439e8
REDIS_HOST=db.myredis-d0316815-ada.svc.cluster.local
/src # exit

 % acorn secrets reveal myredis.admin    
NAME            TYPE      KEY       VALUE
myredis.admin   token     token     cd7h2ac9670439e8

@lucj
Copy link
Contributor

lucj commented Oct 20, 2023

Hum, I think it's more related to flask (I can be wrong though) as when I run a shell in the container, I can connect to the redis service (after installing the redis-cli client):

/src # redis-cli --pass i85b0373210hi7h5 -h "db.myredis-a85ed76a-874.svc.cluster.local"
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
db.myredis-a05ae76a-854.svc.cluster.local:6379>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants