As the title says, i have 3 containers running in docker, 1 for rails, 1 for a postgres db and 1 for redis. I'm able to enqueue jobs doing Job.perform_async
but for some reason my jobs stay on the enqueued indefinitely. I checked and my Redis container is up and running.
My Job:
class HardJob include Sidekiq::Job def perform(*args) puts 'HardJob' endend
The initializer for sidekiq:
Sidekiq.configure_server do |config| config.redis = { url: (ENV["REDIS_URL"] || 'redis://localhost:6379') }end Sidekiq.configure_client do |config| config.redis = { url: (ENV["REDIS_URL"] || 'redis://localhost:6379') }end
My docker-compose:
version: '3.0'services: web: build: . entrypoint: > bash -c " rm -f tmp/pids/server.pid&& bundle exec rails s -b 0.0.0.0 -p 3000" ports: - 3000:3000 volumes: - .:/src/myapp depends_on: - db - redis links: - "db:db" environment: REDIS_URL: 'redis://redis:6379' db: image: postgres:11 environment: POSTGRES_PASSWORD: 'postgres' volumes: - db_data:/var/lib/postgresql/data ports: - 5432:5432 redis: image: "redis"volumes: db_data: redis: driver: local
And i also set config.active_job.queue_adapter = :sidekiq
in my 3 environments.
Any hint of what could be happening here? Thanks in advance
Update
Seems that running sidekiq -q default
in my rails terminal worked. How can i configure Docker to always run sidekiq?