CreepPork / Apollo

Discord bot that allows to get status updates on your Arma 3 server.
MIT License
17 stars 8 forks source link

Connexion problem #158

Open eldarius24 opened 2 years ago

eldarius24 commented 2 years ago

Hello @CreepPork i have a problem with the bot, when i try to connect this to my server, i have this message

_Bot has logged in Apollo is ready. Performing first-start refresh. Error: Failed all 2 attempts at QueryRunner.run (/apollo/Apollo/node_modules/gamedig/lib/QueryRunner.js:88:21) Attempt #1 - Port=2333 Retry=0: Error: UDP - Timed out after 2000ms at Timeout.setTimeout (/apollo/Apollo/node_modules/gamedig/lib/Promises.js:7:25) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10) Attempt #2 - Port=2332 Retry=0: Error: UDP - Timed out after 2000ms at Timeout.setTimeout (/apollo/Apollo/nodemodules/gamedig/lib/Promises.js:7:25) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10) Failed to refresh server info. Remaining retries: 1/3

I try with 2 VPS on debian (same problem) I try différent arma ip server (and a server arma with your bot)

if you have an idea 👍

CreepPork commented 2 years ago

Hi, it seems that from Apollo's side your server is not accessible. It could be either the server's firewall blocking it, wrong IP address and/or ports are not correct.

Try a port checker and see if you can connect to that server.

eldarius24 commented 2 years ago

i think the same, the firewall side apollo block the connexion, you have a default port define ?

eldarius24 commented 2 years ago

For more information, From the beginning i have the bot connected to my discord server and when i tried to discute with it, it responds image

So i have a connexion with it.

But... image

And i open the firewall image

CreepPork commented 2 years ago

You need to expose Steam Query ports too: see all ports here.

eldarius24 commented 2 years ago

On my arma server or Apollo server, because my Apollo is already open

CreepPork commented 2 years ago

On your Arma 3 server.

CreepPork commented 2 years ago

Closing as no response, if you experience the issue once again, feel free to re-open this issue.

eldarius24 commented 2 years ago

For information, I test this when I back in my home Screenshot_20220208-225854 Screenshot_20220208-225656

eldarius24 commented 2 years ago

hello @CreepPork, i reopen this discussion because i want to put your bot in a docker and after trying on several machines and looking for different solutions, I really think that setting a port on gamedig will solve the problem. (https://www.npmjs.com/package/gamedig)

Can you tell me what you think about it and if it is difficult for you to solve?

thank you for you'r work

Common Issues

Firewalls block incoming UDP

(replit / docker / some VPS providers)

Most game query protocols require a UDP request and response. This means that in some environments, gamedig may not be able to receive the reponse required due to environmental restrictions.

Some examples include:

Docker containers

You may need to run the container in --network host mode so that gamedig can bind a UDP listen port. Alternatively, you can forward a single UDP port to your container, and force gamedig to listen on that port using the instructions in the section down below. replit Most online IDEs run in an isolated container, which will never receive UDP responses from outside networks. Various VPS / server providers Even if your server provider doesn't explicitly block incoming UDP packets, some server hosts block other server hosts from connecting to them for DDOS-mitigation and anti-botting purposes. Gamedig doesn't work in the browser Gamedig cannot operate within a browser. This means you cannot package it as part of your webpack / browserify / rollup / parcel package. Even if you were able to get it packaged into a bundle, unfortunately no browsers support the UDP protocols required to query server status from most game servers. As an alternative, we'd recommend using gamedig on your server-side, then expose your own API to your webapp's frontend displaying the status information. If your application is thin (with no constant server component), you may wish to investigate a server-less lambda provider.

Specifying a listen UDP port override

In some very rare scenarios, you may need to bind / listen on a fixed local UDP port. The is usually not needed except behind some extremely strict firewalls, or within a docker container (where you only wish to forward a single UDP port). To use a fixed listen udp port, construct a new Gamedig object like this:

const gamedig = new Gamedig({
    listenUdpPort: 13337
});
gamedig.query(...)
CreepPork commented 2 years ago

Hello, once again!

Sorry, missed your first reply after the closing.

I'm not sure, I understand your issue fully. You stated before that you tried it on 2 VPSes and it still didn't work. Are these your VPS or are you purchasing them from a provider, if so what provider?

You've also mentioned docker containers. Is Arma running in a Docker container or have you made a container for Apollo?

Please, try to elaborate on the infrastructure you are using, so I can help you better.

eldarius24 commented 2 years ago

Indeed, from the beginning I try to make an apollo docker that I could share to simplify the installation of the bot. I tried my container on several servers, and each time the same error which is quite clear, there was not the right port open for apollo. So I searched on the side of gamedig and I came across this article.

on https://www.npmjs.com/package/gamedig

Firewalls block incoming UDP

(replit / docker / some VPS providers)

Most game query protocols require a UDP request and response. This means that in some environments, gamedig may not be able to receive the reponse required due to environmental restrictions.

Some examples include:

Docker containers You may need to run the container in --network host mode so that gamedig can bind a UDP listen port. Alternatively, you can forward a single UDP port to your container, and force gamedig to listen on that port using the instructions in the section down below.

I tried the method -> You may need to run the container in --network host mode so that gamedig can bind a UDP listen port. and everything works fine.

but you have to think about opening the ports on the server and to simplify things I would have preferred it to be directly in the container that the port is defined

That's why I wanted to know if it was possible easily for you ?