codeinterview-backend icon indicating copy to clipboard operation
codeinterview-backend copied to clipboard

Error 111 connecting to localhost:6379. Connection refused.

Open lironmo opened this issue 4 years ago • 15 comments

Hi,

cool project!

I am trying to run the project locally and got : Error 111 connecting to localhost:6379. Connection refused.

seems that the Redis is missing from the project - can you please give a full explanation of how to run locally? (I also add some values to the database in order to find the language )

lironmo avatar Jun 16 '21 15:06 lironmo

if it simply needs Redis (without ant configs) - no need to add -

but worth mention at the readme

lironmo avatar Jun 16 '21 15:06 lironmo

Hey, thanks. Yeah, you need redis (or any message queue) running.

You can quickly set one up with docker:

docker run --name my-redis -d -p 6379:6379 redis redis-server --appendonly yes

areebbeigh avatar Jun 16 '21 19:06 areebbeigh

Thank @areebbeigh. I added also the following confs:

CELERY_RESULT_BACKEND = "redis" CELERY_REDIS_HOST = "localhost" CELERY_REDIS_PORT = 6379 CELERY_REDIS_DB = 0

what should I add to: CELERY_BROKER_URL = 'pyamqp://'

it's seems that the sync doesn't works correctly (probably wrong setup)

lironmo avatar Jun 16 '21 20:06 lironmo

Broker url would be "redis://"

areebbeigh avatar Jun 16 '21 20:06 areebbeigh

@areebbeigh - I think that I am doing something wrong: I run the following components: backend + frontend + Redis

with the default configuration (python manga runserver / npm start / redis docker)

lironmo avatar Jun 16 '21 20:06 lironmo

@areebbeigh - I think that I am doing something wrong: I run the following components: backend + frontend + Redis

with the default configuration (python manga runserver / npm start / redis docker)

What isn't working? Is the web app up? Run requests get created in the backend?

You also need to run the codeinterview-sandbox for actual code execution to happen.

areebbeigh avatar Jun 17 '21 06:06 areebbeigh

Hi @areebbeigh, web page - UP I did not start the sandbox - did not know it's related.

so I need to build the docker image at https://github.com/areebbeigh/codeinterview-sandbox and how to run it? (celery -A run worker -l info??)

lironmo avatar Jun 17 '21 11:06 lironmo

ok, now I have a different issue with the sendbox - does the send box need rabbitMQ?

Cannot connect to amqp://guest:**@127.0.0.1:5672//:

lironmo avatar Jun 17 '21 11:06 lironmo

i changed the configuration to redis - the sandbox is up/

CELERY_BROKER_URL = os.environ.get('REDIS_URL')

CELERY_RESULT_BACKEND = os.environ.get('REDIS_URL')

CELERY_BROKER_URL = 'redis://'

CELERY_RESULT_BACKEND = "redis" CELERY_REDIS_HOST = "localhost" CELERY_REDIS_PORT = 6379 CELERY_REDIS_DB = 0

lironmo avatar Jun 17 '21 11:06 lironmo

ok, now I have a different issue with the sendbox - does the send box need rabbitMQ?

Cannot connect to amqp://guest:**@127.0.0.1:5672//:

Yup, you have to point the sandbox workers to the same message queue the web app pushes to. You can use redis for this. amqp:// is rabbitmq

areebbeigh avatar Jun 17 '21 11:06 areebbeigh

I did it! all seems to work fine but still, i have the same problem:

  1. sync is not working
  2. result is missing

the web page is up and running.

maybe I need to connect the backend to the sandbox in some way?

lironmo avatar Jun 17 '21 11:06 lironmo

maybe something is missing in the database?

because I had to add manually the rows for the language.

lironmo avatar Jun 17 '21 11:06 lironmo

it seems that the request sent from the webpage to the backend and dispatch celery task via dispatch_run_task.

but it's seems that the celery sandbox did not act on the task dispatch - checking why now

lironmo avatar Jun 17 '21 11:06 lironmo

I think I found the problem - wsl issue...:

the code that checks if the docker image exists returns a different exception and gets unhandled -- I will build manually and fix it later.

the exception happens in self.image = self.client.images.get( settings.DOCKER_IMAGE_FULL_NAME)

            getting :
          requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

lironmo avatar Jun 17 '21 12:06 lironmo

more issues - docker runtime issue at wsl - remove secure runtime.

now it seems to be stack at the celery when I run it manually.

lironmo avatar Jun 17 '21 12:06 lironmo