Search code examples
fiwarefiware-scorpio

Scorpio broker - environment variables set in docker-compose-aaio.yml not getting picked up at runtime


I am running Scorpio using the docker-compose file: docker-compose-aaio.yml but I want to use an RDS postgres instance rather than a container instance. I have updated the docker-compose-aaio.yml file as follows:

version: '3'

services:
  zookeeper:
    image: zookeeper
    ports:
      - "2181"
  kafka:
    image: wurstmeister/kafka
    hostname: kafka
    ports:
      - "9092"
    environment:
      KAFKA_ADVERTISED_HOST_NAME: kafka
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_ADVERTISED_PORT: 9092
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    depends_on:
      - zookeeper
    logging:
      driver: none
  scorpio:
    image: scorpiobroker/scorpio:scorpio-aaio_1.0.2
    ports:
      - "9090:9090"
    depends_on:
      - kafka
    environment:
      spring_args: --maxLimit=1000 --reader.datasource.hikari.url=jdbc:postgresql//myrdshost.eu-west-2.rds.amazonaws.com:5432/ngb?ApplicationName=ngb_storagemanager_reader --writer.datasource.hikari.url=jdbc:postgresql//myrdshost.eu-west-2.rds.amazonaws.com:5432/ngb?ApplicationName=ngb_storagemanager_writer

However when I run this with: docker-compose -f docker-compose-aaio.yml up I get this error:

java.net.UnknownHostException: postgres

as though the Scorpio broker is still trying to use the default postgres database urls (i.e trying to use a containerised postgres instance). It's seems like the environment variables I set under spring_args are not getting applied.

I have followed the documentation in Chapters 4 and 5 here: https://scorpio.readthedocs.io/_/downloads/en/latest/pdf/.
Can you see anything I am doing wrong?

Thanks!


Solution

  • there is another config parameter in spring for postgres. spring.datasource.hikari.url This is missing in documentation. I'll update it for the next release. For the full set of changeable options you can have a look in the application.yml https://github.com/ScorpioBroker/ScorpioBroker/blob/development/AllInOneRunner/src/main/resources/application.yml

    Good Luck Benjamin