Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

carrot just exits #74

Closed
vidstige opened this issue May 9, 2018 · 3 comments
Closed

carrot just exits #74

vidstige opened this issue May 9, 2018 · 3 comments
Assignees

Comments

@vidstige
Copy link

vidstige commented May 9, 2018

I'm trying to run carrot + django + postgres + rabbitmq in a docker-compose, but carrot just bails out successfully with exit code 0... My docker-compose.yml file looks like this

version: '2'

services:
  rabbit:
    image: 'rabbitmq:3.7-alpine'
    expose:
      - "5672"

  postgres:
    image: 'postgres:9.6'
    volumes:
      - postgres_data:/var/lib/postgresql/data

  django:
    restart: always
    build: ./
    depends_on:
      - postgres
      - rabbit
    expose:
      - "8000"
    ports:
      - "0.0.0.0:8000:8000"

  carrot:
    build: ./
    depends_on:
      - django
      - rabbit
    command:
      bash -c "sleep 8" && python manage.py carrot --traceback

volumes:
  postgres_data:

The container does not seem to produce any output whatsoever. There is no file in /var/log/carrot.log either. Please advice.

I fixed up another simpler django-leek yesterday, but today I saw you had fixed some stuff with the migrations, etc, so I thought I'd give carrot another try as I like the monitor and so on. However, I cannot seem to get it running at all.

@chris104957
Copy link
Owner

Give me a few hours, will get a working docker container up for you

@vidstige
Copy link
Author

vidstige commented May 9, 2018

Sweet, thanks! I picked up the old django-queue project and hotted it up as django-leekso our needs are covered for now, so no stres. :-) But would gladly switch to carrot. 👍

@chris104957 chris104957 self-assigned this May 9, 2018
@chris104957
Copy link
Owner

This turned out to be a bit trickier than I had anticipated. In our setup, we have a central Rabbit server, with a number of standalone dockerized django apps that connect to it, and this is very easy to implement. Actually running RabbitMQ inside the same container as the Django app caused a few more issues. However, I've managed to get a working example up here: django-carrot-docker

Key things to note:

  • The default config for carrot assumes that the RabbitMQ instance runs at localhost, which doesn't work with a dockerized setup. You need to send the hostname argument to the rabbit container (e.g. rabbit), then update your CARROT settings as follows:
DEFAULT_BROKER = 'amqp://guest:guest@rabbit:5672/'

CARROT = {
    'default_broker': DEFAULT_BROKER,
    'queues': [
        {
            'name': 'default',
            'host': DEFAULT_BROKER
        }
    ]
}
  • Running rabbit in its own container causes issues accessing the database - the consumer raisesObjectDoesNotExist exceptions for every message it tries to consume that wasn't already in the queue when the consumer started. The solution to this is to launch django and carrot in the same container, using a bash script.

Anyway, the example config seems to work, and provides an empty app with a dummy task for testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants