OasisLMF/OasisEvaluation

Port conflict issue while deploying celery DB and server db

kprasadpn opened this issue · 4 comments

Hi,
While deploying we are getting port conflict issue, since we were used 3306 port for both server. Can we use different port?

Hello, can you add the exact error message you're seeing?

Each DB is in a separate docker container so the same port numbers shouldn't cause a clash.

CONTAINER ID   IMAGE       COMMAND                  STATUS          PORTS                 NAMES                                                                                                                                                                                                                                
3fd6615555cb   mysql:8.0   "docker-entrypoint.s…"   Up 36 minutes   3306/tcp, 33060/tcp   platform_oasis_server-db_1
66ce175df9a4   mysql       "docker-entrypoint.s…"   Up 36 minutes   3306/tcp, 33060/tcp   platform_oasis_celery-db_1

Hi @sambles ,
We are deploying the application in nomad environment and that too in a single node . So in this case we are getting port conflict issue .
So my question is can we use diffrent port or there have any port dependency .

Hello @kprasadpn there are no strict port requirements, it just so happens that 3306 is the default for the mysql image.

The following will work you're using a mysql version > v8.0 (I haven't tested it on older versions):

  1. Edit the compose file and add --port=<some_port_num> to each of the mysql image commands
.. 
  server-db:
    restart: always
    image: mysql:8.0
    command: [--default-authentication-plugin=mysql_native_password, --port=4001]
    environment:
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_USER=oasis
      - MYSQL_PASSWORD=oasis
      - MYSQL_DATABASE=oasis
    volumes:
      - ${OASIS_DOCKER_DB_DATA_DIR:-./db-data}/server:/var/lib/mysql/:rw
  celery-db:
    restart: always
    image: mysql
    command: [--default-authentication-plugin=mysql_native_password, --port=5001]
    environment:
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_USER=celery
      - MYSQL_PASSWORD=password
      - MYSQL_DATABASE=celery
    volumes:                                                                                                                                                   
      - ${OASIS_DOCKER_DB_DATA_DIR:-./db-data}/celery:/var/lib/mysql/:rw
..
  1. Edit the connected containers environment vars OASIS_CELERY_DB_PORT and OASIS_SERVER_DB_PORT to match the new port numbers.
   environment:
     - OASIS_DEBUG=1
         ...
     - OASIS_SERVER_DB_PORT=4001
     - OASIS_CELERY_DB_PORT=5001

Hi @kprasadpn - I assume this is fixed now and ok to close off?