Question docker-compose setup: Velocity proxy refuses to connect to Paper hub world on same machine

Klaribot

New member
Sep 1, 2022
1
1
1
Alright, so I have a bit of an advanced problem I've been struggling to solve for the past day.

I'm building a larger-scale Minecraft network using Docker Compose (or preparing to anyway), and I'm trying to find out why the Velocity container is refusing to forward players to the Hub container.

Here's my docker-compose.yml:
YAML:
version: '3.8'

services:

  #######################################################
  # hub Profile - The main Minecraft hub world. Includes a Velocity proxy configured for modern forwarding, and a void world running on Paper.

  main-proxy:
    hostname: main-proxy
    container_name: main-proxy
    profiles: ["hub"]
    image: itzg/bungeecord:java17
    ports:
      - "25565:25565"
    environment:
      UID: 1002 #Minecraft user
      GID: 1003 #Minecraft group
      TYPE: VELOCITY
      VELOCITY_VERSION: latest
      MEMORY: 512m
      JVM_XX_OPTS: "-XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15"
      PLUGINS: https://github.com/ViaVersion/ViaVersion/releases/download/4.4.2/ViaVersion-4.4.2.jar,https://github.com/ViaVersion/ViaBackwards/releases/download/4.4.2/ViaBackwards-4.4.2.jar
    restart: always
    volumes:
      - ./servers/main-proxy:/server
    links:
      - main-hub

  main-hub:
    hostname: main-hub
    container_name: main-hub
    profiles: ["hub"]
    image: itzg/minecraft-server:java17
    ports:
      - "30065:25565"
    environment:
      UID: 1002 #Minecraft user
      GID: 1003 #Minecraft group
      TYPE: PAPER
      VERSION: latest
      MEMORY: 1024m
      USE_AIKAR_FLAGS: "TRUE"
      EULA: "TRUE"
      SPIGET_RESOURCES: 19254,27448,25391,102902 #ViaVersion, ViaBackwards, VoidGen, NoEncryption
      #EXEC_DIRECTLY: true
      # enable env variable replacement
      REPLACE_ENV_VARIABLES: "true"
      # define an optional prefix for env variables we want to replace
      ENV_VARIABLE_PREFIX: "CFG_"
      # actual variables
      CFG_FORWARDING_SECRET_FILE: "/forwarding.secret"
    tty: true
    stdin_open: true
    restart: always
    volumes:
      - ./servers/main-hub:/data
secrets:
  forwarding_secret:
    file: /forwarding.secret

velocity.toml already knows about the forwarding.secret file (at least it should?):
Code:
. . .

# If you are using modern or BungeeGuard IP forwarding, configure a file that contains a unique secret here.
# The file is expected to be UTF-8 encoded and not empty.
forwarding-secret-file = "forwarding.secret"

. . .

and paper-global.yml is configured to have an environment variable replaced at container start:
YAML:
. . .

proxies:
  bungee-cord:
    online-mode: false
  proxy-protocol: false
  velocity:
    enabled: true
    online-mode: true
    secret: ${CFG_FORWARDING_SECRET_FILE}

. . .

This SHOULD just work, right?

In testing, it does not.

Code:
main-proxy  | [06:55:36 INFO]: [connected player] Klari (/{IP REDACTED}) has connected
main-proxy  | [06:55:36 ERROR]: [connected player] Klari (/{IP REDACTED}): unable to connect to server main-hub
main-proxy  | io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: main-hub/172.28.0.2:30065
main-proxy  | Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused
main-proxy  |   at io.netty.channel.unix.Errors.newConnectException0(Errors.java:155) ~[velocity-3.1.2-SNAPSHOT-179.jar:3.1.2-SNAPSHOT (git-6547ccaa-b179)]
main-proxy  |   at io.netty.channel.unix.Errors.handleConnectErrno(Errors.java:128) ~[velocity-3.1.2-SNAPSHOT-179.jar:3.1.2-SNAPSHOT (git-6547ccaa-b179)]
main-proxy  |   at io.netty.channel.unix.Socket.finishConnect(Socket.java:359) ~[velocity-3.1.2-SNAPSHOT-179.jar:3.1.2-SNAPSHOT (git-6547ccaa-b179)]
main-proxy  |   at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:710) ~[velocity-3.1.2-SNAPSHOT-179.jar:3.1.2-SNAPSHOT (git-6547ccaa-b179)]
main-proxy  |   at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:687) ~[velocity-3.1.2-SNAPSHOT-179.jar:3.1.2-SNAPSHOT (git-6547ccaa-b179)]
main-proxy  |   at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:567) ~[velocity-3.1.2-SNAPSHOT-179.jar:3.1.2-SNAPSHOT (git-6547ccaa-b179)]
main-proxy  |   at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:489) ~[velocity-3.1.2-SNAPSHOT-179.jar:3.1.2-SNAPSHOT (git-6547ccaa-b179)]
main-proxy  |   at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:397) ~[velocity-3.1.2-SNAPSHOT-179.jar:3.1.2-SNAPSHOT (git-6547ccaa-b179)]
main-proxy  |   at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[velocity-3.1.2-SNAPSHOT-179.jar:3.1.2-SNAPSHOT (git-6547ccaa-b179)]
main-proxy  |   at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[velocity-3.1.2-SNAPSHOT-179.jar:3.1.2-SNAPSHOT (git-6547ccaa-b179)]
main-proxy  |   at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[velocity-3.1.2-SNAPSHOT-179.jar:3.1.2-SNAPSHOT (git-6547ccaa-b179)]
main-proxy  |   at java.lang.Thread.run(Thread.java:833) [?:?]
main-proxy  | [06:55:36 INFO]: [connected player] Klari (/{IP REDACTED}) has disconnected: Unable to connect you to main-hub. Please try again later.

...although I'm 100% expecting to be pointed towards an obvious and/or incomplete misconfiguration in my config.
I asked this in the Github Discussion forums of itzg/docker-minecraft-server (the image I'm using to deploy this environment), and I was redirected to ask this question on the Velocity forums as well.
Here is that discussion:
Any feedback would be appreciated to the highest degree. 🙏
 
  • Like
Reactions: BelowAverageUser