eisengrind / docker-altv-voice-server

A Docker image providing the alt:V voice server.
https://hub.docker.com/r/eisengrind/altv-voice-server
MIT License
9 stars 3 forks source link

failed to bind to public port #1

Closed danilaplee closed 4 years ago

danilaplee commented 4 years ago

if i set my public ip to the real server ip on which the container runs it cannot bind

Starting voice server on 0.0.0.0:7798
[Error] Failed to bind to port 7799

and if I leave it at 0.0.0.0 my alt server just disconnects

[16:18:14] alt:V Server, build #1181, branch release
[16:18:14] Starting test.net on 0.0.0.0:8000
[16:18:14] Disconnected from voice server
pixlcrashr commented 4 years ago

First of all, thanks for the issue!

What command did you execute to start the container?

danilaplee commented 4 years ago

i added it to my docker compose like this:

voice:
    container_name: "altv_voice"
    image: eisengrind/altv-voice-server:release
    tty: true
    ports:
      - 7798:7798/tcp
      - 7798:7798/udp
      - 7799:7799/tcp
      - 7799:7799/udp
    environment:
      - ALTV_VOICE_SERVER_HOST=0.0.0.0
      - ALTV_VOICE_SERVER_PORT=7798
      - ALTV_VOICE_SERVER_PLAYER_HOST=my_server_ip
      - ALTV_VOICE_SERVER_PLAYER_PORT=7799
      - ALTV_VOICE_SERVER_SECRET=1234568
pixlcrashr commented 4 years ago

First of all, there are no tcp connections provided by the voice server.

Second, you CAN NOT use the ip of the host system, as the container has its own separated network. Using the ports option, you can map the ports from the container to the host system (if the ports are unused on the host system, logically).
Thus, you have to use the ip 0.0.0.0 for ALTV_VOICE_SERVER_HOST and ALTV_VOICE_SERVER_PLAYER_HOST as, again, the Docker container does not know about the ip address of the host system. The step that the ports of the voice server are bound to the host network is done via ports.

Note that the only thing that you have to consider is to provide the public ip address on the alt:V game server, where the voice server is reachable from.
ALTV_VOICE_SERVER_PLAYER_HOST is only used to provide a separate ip address for the port where the players connect to.

E.g. this problem is not related to the image itself.

pixlcrashr commented 4 years ago

Though, one thing I don't know is what parameters you provide to the game server (probably also running in a container, am I right?).

danilaplee commented 4 years ago

yep I'am running a custom container with altv server and my altv config looks like this:

name: 'GTA'
host: 0.0.0.0
port: 8000
players: 128
announce: false
gamemode: Freeroam
website: 'gta'
language: "en"
description: 'GTA5'
useCdn: true
cdnUrl: 'my_domain'
debug: true
streamingDistance: 500
modules: [ node-module ]
voice: {
  bitrate: 64000
  externalSecret: 1234568
  externalHost: altv_voice
  externalPort: 7798
  externalPublicHost: my_server_ip
  externalPublicPort: 7799
}
resources: [
  gamemode
]

any my docker-compose entry for the container:

  gta:
    hostname: "dev-gta"
    image: my_registry
    tty: true
    ports:
      - 8000:8000/tcp
      - 8000:8000/udp
    restart: always
    volumes:
      - /data/cdnfiles:/usr/app/build/cdn_upload
pixlcrashr commented 4 years ago

@danilaplee The problem is that you use alt_voice as a DNS name. Since the DNS system (at least common ones such as the one used by Docker) does not know the character _, so you will have to use the container name alt-voice and thus you also have to use the DNS name alt-voice.

Also notice that, as far as I discovered (https://github.com/altmp/altv-issues/issues/565), it is by now not possible to configure custom ports in the config of the voice server. A fix for that would be to just map from the default voice server ports to the customized ports.

pixlcrashr commented 4 years ago

@danilaplee Does it work now?

danilaplee commented 4 years ago

nope this didn't help, and essentially this didn't change anything my docker's dns can handle underscores they are used quite wide in my system and cause no issues. p.s. my guess is that this is related to the fact none of the containers run on the host system so there could definitely be some nat traversal issues with any kind of rtp connection p.p.s. but essentially the main stoper for me is that there is no support for external sound card in altv so i can't really test even if the voice control works :)

pixlcrashr commented 4 years ago

@danilaplee Could be. The thing is that I am not able to reproduce this error.

I used the following config:

version: "3"

services:
  voice:
    container_name: "altv-voice"
    image: eisengrind/altv-voice-server:release
    tty: true
    ports:
      - 8898:7798/udp
      - 8899:7799/udp
    environment:
      - ALTV_VOICE_SERVER_HOST=127.0.0.1
      - ALTV_VOICE_SERVER_PLAYER_HOST=127.0.0.1
      - ALTV_VOICE_SERVER_SECRET=1234568
  gta:
    hostname: "dev-gta"
    depends_on:
    - voice
    image: eisengrind/altv-server:release
    tty: true
    ports:
      - 7788:7788/tcp
      - 7788:7788/udp
    restart: always
    environment:
    - ALTV_SERVER_VOICE_BITRATE=64000
    - ALTV_SERVER_VOICE_EXTERNAL_SECRET=1234568
    - ALTV_SERVER_VOICE_EXTERNAL_HOST=altv-voice
    - ALTV_SERVER_VOICE_EXTERNAL_PORT=8898
    - ALTV_SERVER_VOICE_EXTERNAL_PUBLIC_HOST=dev-gta
    - ALTV_SERVER_VOICE_EXTERNAL_PUBLIC_PORT=8899
pixlcrashr commented 4 years ago

Though, you should be able to test the Voice server as alt:V makes use of the Windows Sound Devices, I guess?

danilaplee commented 4 years ago

Though, you should be able to test the Voice server as alt:V makes use of the Windows Sound Devices, I guess?

I'am using a soundcraft mtk-12 which uses a custom multichannel sounddriver, somehow altv doesn't recognize that i have mic on my channel 2 in my 12 channel setup :) p.s. but anyway I'll have to fix this one day :) so I'll reply with a fix when i'll do this :)

danilaplee commented 4 years ago

so this seems to be an issue with software provided by the altv community, the docker seems to be fine, but their piece of software doesnt accept changes to port

pixlcrashr commented 4 years ago

@danilaplee Yep, I already noticed that.

But you can do a workaround with the NAT of the Docker container: Simply change the port mapping of the voice server container.