Using TYK_PMP_PUMPS

Hello
I am trying to set up Tyk Pump with Docker using environment variables only, thus avoid using dependency on the host file system for pump.conf
My objective is similar to what Efix posted a while ago: https://community.tyk.io/t/api-object-validation-failed-in-setup-script-in-tyk-quickstart-repo/1381/9 and back then this was not supported.
According to the documentation, TYK_PMP_PUMPS can be used to set pumps - is this now working?

Many thanks,
Peter

same question here, thanks in advance!

Hi, same question here

I see there was a PR merged on April 20

But when I’m using it with docker-compose it’s still not overriding the .conf file

Hi @ghilman27

Welcome to the forum. Do you mind sharing the properties in the environment variables that are not overriding the config file.

@Olu

I just set the environment in docker-compose.yml
I configured the mongo container to have authentication with root username and password, then assigning a user and password to tykmongo with ‘dbOwner’ roles to ‘tyk_analytics’ database.
Given that situation, it’s impossible to connect without username and password.

docker-compose.yml

.... other compose configs
  tyk-pump:
    container_name: tyk-pump
    image: tykio/tyk-pump-docker-pub:latest
    networks:
      - tyk
    depends_on: 
      - tyk-redis
      - tyk-mongo
      - tyk-gateway
    volumes:
      - ./tyk.pump.conf:/opt/tyk-pump/pump.conf
    restart: unless-stopped
    environment:
      TYK_PMP_PUMPS_MONGO_META_MONGOURL: mongodb://username:password@tyk-mongo:27017/tyk_analytics
      TYK_PMP_PUMPS_MONGOAGG_META_MONGOURL: mongodb://username:password@tyk-mongo:27017/tyk_analytics
... other compose configs

tyk.pump.conf

{
  "analytics_storage_type": "redis",
  "analytics_storage_config": {
    "type": "redis",
    "host": "tyk-redis",
    "port": 6379,
    "hosts": null,
    "username": "",
    "password": "",
    "database": 0,
    "optimisation_max_idle": 100,
    "optimisation_max_active": 100,
    "enable_cluster": false,
    "redis_use_ssl": false,
    "redis_ssl_insecure_skip_verify": false
  },
  "log_level":"debug",
  "log_format":"text",
  "purge_delay": 2,
  "health_check_endpoint_name": "hello",
  "health_check_endpoint_port": 8083,
  "pumps": {
    "MONGO": {
      "type": "mongo",
      "meta": {
        "collection_name": "tyk_analytics",
        "mongo_url": "mongodb://tyk-mongo:27017/tyk_analytics"
      }
    },
    "MONGOAGG": {
      "type": "mongo-pump-aggregate",
      "meta": {
        "mongo_url": "mongodb://tyk-mongo:27017/tyk_analytics",
        "use_mixed_collection": true
      }
    },
    "CSV": {
      "type": "csv",
      "meta": {
        "csv_dir": "./csv-analytics"
      }
    }
  },
  "dont_purge_uptime_data": true,
  "omit_detailed_recording": false
}

I expected the pumps.MONGO.meta.mongo_url and pumps.MONGOAGG.meta.mongo_url to be overrided with the environment (meaning pump will successfully authenticate). But it’s not happening.

The environments were read successfully into the container, I confirmed it by docker exec into the container and print it myself.

1 Like

Thanks for the feedback. I have tried it on my end and the result is the same.

I’ll let the engineering team know and get back to you

Thanks for the response. I really appreciate it. This is a great software and I hope it will benefit the OSS community.

1 Like

@peter.bratu
@Hino
@ghilman27

Can you try pump version v1.5.1 and let us know? The issue seems to be fixed there