DtcQueueBundle icon indicating copy to clipboard operation
DtcQueueBundle copied to clipboard

Connecting to docker container name as host issues

Open imbue opened this issue 7 years ago • 1 comments

Versions

"mmucklo/queue-bundle": "^4.10",
"php-amqplib/php-amqplib": "^2.8"

Is there a way to currently use a (docker) container host name as.. host? Due to the requirement of providing a port, I'm getting issues with this particular thing.

Imagine having a Docker container

services:
  rabbitmq:
    image: rabbitmq:3.7-alpine
    restart: on-failure

The following would result into a port requirement error

dtc_queue:
    manager:
        job: rabbit_mq
    rabbit_mq:
        # host: localhost
        # port: 4369
        host: rabbitmq
        user: guest
        password: guest
        vhost: "/"
        ssl: false

Is there a workaround for this? Maybe I'm simply missing something

imbue avatar Jan 02 '19 09:01 imbue

@imbue hi there. I have some configuration. Change job: (orm or rabbitmq) only

dtc_queue:
  record_timings: true
  # For full configuration options see:
  #   https://github.com/mmucklo/DtcQueueBundle/blob/master/Resources/doc/full-configuration.md
  manager:
    # This parameter is required and should typically be set to one of:
    #   [odm|orm|beanstalkd|rabbit_mq|redis]
    job: orm
  timings:
    # Set this to true to record job timing history in a separate table
    #  (note: for beanstalkd|rabbit_mq|redis, job_timing or run needs to
    #   be set to one of orm|odm under the manager section)
    record: false
  priority:
    max: 255
    direction: desc
  admin:
    # chartjs is used to render the job timings graph in the admin section
    chartjs: 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.bundle.min.js'
  rabbit_mq:
    host: medtrainer_cron_broker
    port: 5672
    user: user
    password: password
    vhost: "/"
    ssl: false
    queue_args:
      queue: dtc_queue
      passive: false
      durable: true
      exclusive: false
      auto_delete: false
version: '2'
services:
  web:
    image: apachephp:7.1
    networks:
      lmscore_base_net:
        ipv4_address: 172.18.2.3
      symf_net:
        ipv4_address: 172.18.21.09
    extra_hosts:
      - "cron.local.com:127.0.0.1"
      - "core.local.com:172.18.2.5"
    expose:
    - "9000"
    ports:
    - "8081:80"
    volumes:
    - ./src:/var/www/html
    - ~/.ssh:/home/magento2/.ssh
    - ./apache_vhost:/etc/apache2/sites-available/
    - ./swapfiles:/swapfiles
    environment:
      PHP_XDEBUG_ENABLED: 1
      XDEBUG_CONFIG: remote_host=172.18.21.1
      PHP_IDE_CONFIG: "serverName=Symfony"
    links:
    - mysql
    - broker
    container_name: ${PROJECT_NAME}_web
  mysql:
    image: mysql:5.7
    external_links:
      - medtrainer_core_web:medtrainer_core_web
    networks:
      symf_net:
        ipv4_address: 172.18.21.11
    volumes:
    - ./database/data:/var/lib/mysql
    ports:
      - 3309:3306
    environment:
      - MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
      - MYSQL_DATABASE=${DB_NAME}
    container_name: ${PROJECT_NAME}_db
  broker:
    image: rabbitmq:3-management
    networks:
      symf_net:
        ipv4_address: 172.18.21.10
    ports:
      - 15672:15672
    #volumes:
    #  - ./database/data:/var/lib/mysql
    environment:
      - RABBITMQ_DEFAULT_USER=user
      - RABBITMQ_DEFAULT_PASS=password
    container_name: ${PROJECT_NAME}_broker
networks:
  lmscore_base_net:
    external: true
  symf_net:
    driver: bridge
    driver_opts:
      com.docker.network.enable_ipv6: "false"
    ipam:
      driver: default
      config:
        - subnet: 172.18.21.0/24
          gateway: 172.18.21.1

rrcfesc avatar Jan 12 '19 00:01 rrcfesc