Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Attempts to connect to 127.0.0.1:6379 despite being configured otherwise #14

Closed
lylo opened this issue Oct 4, 2020 · 3 comments
Closed

Comments

@lylo
Copy link

lylo commented Oct 4, 2020

I've built Caddy with the caddy-tlsredis module but I'm seeing connection problems. Caddy version:

v2.2.0 h1:sMUFqTbVIRlmA8NkFnNt9l7s0e+0gw+7GPIrhty905A=

I have configured Caddy as follows:

{
  storage redis {
    address       "myredisinstance.ondigitalocean.com:25061"
    password      "mypassword"
    db            1
    key_prefix    "caddytls"
    value_prefix  "caddy-storage-redis"
    timeout       5
    tls_enabled   "false"
    tls_insecure  "true"
    aes_key       "redistls-01234567890-caddytls-32"
  }
}

However I'm seeing this in the logs when starting Caddy:

Oct  4 11:30:47 caddy[1082]: {"level":"info","ts":1601811047.0859385,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Oct  4 11:30:47 caddy[1082]: {"level":"info","ts":1601811047.0913122,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["[::1]:2019","127.0.0.1:2019","localhost:2019"]}
Oct  4 11:30:47 caddy[1082]: {"level":"info","ts":1601811047.0918891,"logger":"caddy.storage.redis","msg":"TLS Storage are using Redis, on 127.0.0.1:6379"}
Oct  4 11:30:47 caddy[1082]: run: loading initial config: loading new config: loading storage module: loading module 'redis': provision caddy.storage.redis: dial tcp 127.0.0.1:6379: connect: connection refused
Oct  4 11:30:47 systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Oct  4 11:30:47 systemd[1]: caddy.service: Failed with result 'exit-code'.

It's quite likely I've made a mistake somewhere but it's unclear to me where! I am aware that 127.0.0.1:6379 is the Redis default but I don't understand why Caddy (or this module) is attempting to connect to it, given that I have specified the host and port as well as address. I have also tried setting just the address and also just the host and port. I've even tried adding CADDY_CLUSTERING_REDIS_PORT etc in the environment but I still get the same error.

Thanks in advance.

@lylo
Copy link
Author

lylo commented Oct 4, 2020

I'm not using a JSON Caddyfile. I've noticed that caddy adapt returns this:

  "storage": {
    "Client": null,
    "ClientLocker": null,
    "Logger": null,
    "address": "",
    "aes_key": "",
    "db": 0,
    "host": "",x
    "key_prefix": "",
    "module": "redis",
    "password": "",
    "port": "",
    "timeout": 0,
    "tls_enabled": false,
    "tls_insecure": false,
    "value_prefix": ""
  },

Presumably this is the root of the problem? Any advice on how to correct this would be welcome!

@lylo lylo closed this as completed Oct 4, 2020
@SkYNewZ
Copy link

SkYNewZ commented Oct 15, 2020

I have the same issue. Not working even from env or from static config

@SkYNewZ
Copy link

SkYNewZ commented Oct 15, 2020

~/Sources/caddyv2/test using ☁️  default/iwc-apipy-ss-int-dtep 
➜ cat Caddyfile         
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: Caddyfile
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ {
   2   │   storage redis {
   3   │     address       "myredisinstance.ondigitalocean.com:25061"
   4   │     password      "mypassword"
   5   │     db            1
   6   │     key_prefix    "caddytls"
   7   │     value_prefix  "caddy-storage-redis"
   8   │     timeout       5
   9   │     tls_enabled   "false"
  10   │     tls_insecure  "true"
  11   │     aes_key       "redistls-01234567890-caddytls-32"
  12   │   }
  13   │ }
  14   │ 
  15   │ # lb.cloud.skynewz.local:80 {
  16   │ #   respond /health "OK" 200
  17   │ # }
  18   │ 
  19   │ localhost {
  20   │     respond "Hello, world!"
  21   │ }
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/Sources/caddyv2/test using ☁️  default/iwc-apipy-ss-int-dtep 
➜ ./caddy-redis run       
2020/10/15 00:30:57.033	INFO	using adjacent Caddyfile
2020/10/15 00:30:57.036	INFO	admin	admin endpoint started	{"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["127.0.0.1:2019", "localhost:2019", "[::1]:2019"]}
2020/10/15 00:30:57.036	INFO	caddy.storage.redis	TLS Storage are using Redis, on :6379
run: loading initial config: loading new config: loading storage module: loading module 'redis': provision caddy.storage.redis: dial tcp :6379: connect: connection refused

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants