How to run sidekiq in a separate different docker container apart from application. We are using whenever for the sidekiq jobs, but the jobs are getting triggered in all web containers
- How do we setup the web container (rails app) and the sidekiq workers to scale horizontally as well (preferably as separate containers).
- How should we manage database migrations since sidekiq, ui containers use the same image
- I am trying to use the following snippet, is this correct or should it be any different?
version: '3.8' services: foo-db: image: postgres:$POSTGRES_VERSION container_name: foo-db-container restart: unless-stopped env_file: .env volumes: - /var/lib/postgresql/data networks: - $FOO_NETWORK foo-redis: image: redis:$REDIS_VERSION container_name: foo-redis-container init: true sysctls: net.core.somaxconn: 511 env_file: .env volumes: - /var/lib/redis/data networks: - $FOO_NETWORK foo-sidekiq: depends_on: - foo-db - foo-redis build: ./foo-ui command: bundle exec sidekiq env_file: .env volumes: - /var/lib/redis/data networks: - $FOO_NETWORK foo-service: build: foo-service # image: gcr.io/foo/foo-service:latest container_name: foo-service-container ports: - "$FOO_SERVICE_PORT:$FOO_SERVICE_PORT" env_file: .env networks: - $FOO_NETWORK foo-ui: build: ./foo-ui # image: gcr.io/foo/foo-ui:latest container_name: foo-ui-container depends_on: - foo-db - foo-redis - foo-sidekiq - foo-service ports: - "$FOO_UI_PORT:$FOO_UI_PORT" env_file: .env networks: - $FOO_NETWORK networks: foo-network:
foo-sidekiq:
seems to be indented more than it should) – Shutdown