prebid / prebid-cache

Apache License 2.0
31 stars 60 forks source link

Default aerospike connection #128

Closed Hamper closed 1 year ago

Hamper commented 1 year ago

config.backend.aerospike.host is deprecated, but have default value "aerospike.prebid.com". In that case if prebid-cache started with something like PBC_BACKEND_AEROSPIKE_HOSTS=127.0.0.1 then we see message "Connected to Aerospike host(s) [127.0.0.1 aerospike.prebid.com] on port 3000". I think that default value must be removed or changed to default "hosts" instead of default "host".

guscarreon commented 1 year ago

Good day @Hamper thanks for raising this question. Values inside the "hosts" take precedence over "host", a field we intend to deprecate soon. The log message :

INFO[0005] Connected to Aerospike host(s) [127.0.0.1 aerospike.prebid.com] on port 3000

implies you are connected to 127.0.0.1 because aerospike.prebid.com is not a real reachable endpoint from the internet. A way to correct this log message is to simply remove the "host" entry from the config.yaml file:

   backend:
     type: "aerospike" # Can also be "aerospike", "cassandra", "memcache" or "redis"
     aerospike:
 -     host: "aerospike.prebid.com"
       port: 3000
config.yaml

Whether you are reading "hosts" from the configuration file config.yaml or from an environment variable, we don't need the "host" entry in the config file because this value's default is set to an empty string in line 50 of config/config.go:

 49     v.SetDefault("backend.type", "memory")
 50     v.SetDefault("backend.aerospike.host", "")
 51     v.SetDefault("backend.aerospike.hosts", []string{})
config/config.go

Let me know if this works for you.

Hamper commented 1 year ago

When using docker image "prebid/prebid-server" it is more convenient to use environment variables and don't replace full config file with mounts. Your latest push must resolve this issue because when sample host is defined as hosts it can be simply replaced with PBC_BACKEND_AEROSPIKE_HOSTS variable