Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Masterlist #8

Closed
Freekers opened this issue Apr 20, 2020 · 33 comments
Closed

Masterlist #8

Freekers opened this issue Apr 20, 2020 · 33 comments

Comments

@Freekers
Copy link

In order for the server to show up on the Activision Masterlist, you need to use host network mode for the container so that it can bind to the WAN/Internet IP address of your server. Additionally, you need to set +set net_ip 123.123.123.123 +set net_port 28961 as ARGS environment variable.

If using bridge network mode, the container will bind to the IP address of the Docker network and therefore won't show up on the Activision Masterlist, as the heartbeat will send a 'local' IP-address to the Masterserver (e.g. 172.16.X.X.).

Perhaps you can add this to the README :)

@qdm12
Copy link
Owner

qdm12 commented Apr 20, 2020

Nice, many thanks! I'll definitely add it to the readme. Although it would be nice to somehow make it work in bridge mode, but it may be impossible.

@Freekers
Copy link
Author

I'm not sure. I tried several approaches and this was the only one that worked for me in order to get the server to show up on the Activision Masterlist.

@TheTrigger
Copy link

I still can't register to cod4x master server 😢
Meanwhile, another (bad, with precompiled files) image I created works ..
Here my stack:

version: "3"
services:
  cod4-server:
    image: qmcgaw/cod4:latest
    container_name: cod4x-server-standard
    volumes:
      - /opt/cod4x/server/main:/home/user/cod4/main
      - /opt/cod4x/server/zone:/home/user/cod4/zone:ro
      - /opt/cod4x/server/mods:/home/user/cod4/mods
      - /opt/cod4x/server/usermaps:/home/user/cod4/usermaps:ro
      - /opt/cod4x/logs/standard:/home/user/.callofduty4
    network_mode: host
    stdin_open: true
    tty: true
    ports:
      - 28960:28960/udp
    command:
      [
        "+set dedicated 2",
        "+sv_authtoken mytoken",
        "+set sv_punkbuster 0",
        "+set rcon_password mypassword",
        "+set sv_maxclients 24",
        "+set ui_maxclients 32",
        "+set net_ip mypublicipv4",
        "+set net_port 28960",
        "+exec server.cfg",
        "+map_rotate",
      ]
    restart: unless-stopped

@Freekers
Copy link
Author

Your docker-compose looks fine to me, but you can remove the following lines:

    stdin_open: true
    tty: true
    ports:
      - 28960:28960/udp

Ports are not used in network_mode host.

Looking at the date of the image on Docker Hub, I suspect the image of @qdm12 has to be rebuild because it doesn't have the sv_authtoken variable incorporated yet, which is now enforced to be listed on the cod4x.me master. Judging from the announcement post on the cod4x.me forums, they incorporated that into their code just áfter the last build of the @qdm12 Docker image.

Source: https://cod4x.me/index.php?/forums/topic/2814-new-requirement-for-cod4-x-servers-to-get-listed-on-masterserver/

@TheTrigger
Copy link

TheTrigger commented Apr 21, 2020

I use -it so I can attach to the process and launch commands

Correct me if I'm wrong but it should work with $@ passing any parameter from command

./cod4x18_dedrun +set fs_homepath /home/user/cod4"$@"

@Freekers
Copy link
Author

I'm not sure how that relates to what I said above.

The COD4x version in qdm12's Docker image needs to be updated in order to support the new token requirement by COD4x for their masterserver. This is done by updating the version number in the Dockerfile and rebuilding the image:

ARG COD4X_VERSION=v17.7.2

For example, try the fork of skrtheboss, which uses an update COD4x version: https://github.com/skrtheboss/cod4-docker

@TheTrigger
Copy link

Oh sorry now I got it, @qdm12 is working on the new Dockerfile

@qdm12
Copy link
Owner

qdm12 commented Apr 22, 2020

Hello all, sorry for not answering earlier. So I just created that issue in order to have releases, because the image is based on Alpine to keep a small size and so we need to build the binary from source.

I just made a v17.7.2 release with its corresponding Docker tag v17.7.2 (Alpine 3.11, cod4x v17.7.2 and shell entrypoint).

I will make another release using the latest commit available for now and name the Docker tag with the short commit. Both :latest and this docker tag will point to the latest source code from the cod4x repository.

I'm still working on making that fancy entrypoint (udp proxy + http static file server + launch cod4x, eventually restart it etc.), but it's not done unfortunately (all in 6MB extra). I will comment here once I've setup more releases/docker tags for you to try.

@qdm12
Copy link
Owner

qdm12 commented Apr 22, 2020

qmcgaw/cod4 and qmcgaw/cod4:v17.8 now use the commit corresponding to the version change to v17.8 for cod4xServer. Note that you might have to update your cod4 client. I'll dig into the masterlist issue in the coming days, but feel free to try with the newer image 😉

@TheTrigger
Copy link

TheTrigger commented Apr 22, 2020

Nice! I will try soon!

Here my working sketch FTP server (I had 15kb/s problem with HTTP)

  ftpd_server: # https://github.com/stilliard/docker-pure-ftpd
    image: stilliard/pure-ftpd
    container_name: cod4-ftpd
    ports:
      - "21:21"
      - "30000-30009:30000-30009"
    volumes: # mount only mods and usermaps
      - /opt/cod4x/server/mods:/home/username/mods:ro
      - /opt/cod4x/server/usermaps:/home/username/usermaps:ro
      - /opt/cod4x/passwd:/etc/pure-ftpd/passwd
    environment:
      PUBLICHOST: "localhost"
      FTP_USER_HOME: /home/username
      FTP_USER_NAME: cod4fdl
      FTP_USER_PASS: cod4fdl

@qdm12
Copy link
Owner

qdm12 commented Apr 22, 2020

I'll send my config for http, I use Caddy instead of apache and it works well on a single port. The 15KB/s must be the default fallback method transferring data over udp. Are you using your 80 (or 443) port for anything?

@TheTrigger
Copy link

I used HTTP and HTTPS with valid cert under traefik2 but no luck, maybe it could be a client bug idk. With FTP server my friends are able to download fast, for me was fast-dl just the mod and not maps lol. (with HTTP/s always slow).
Ps. Still won't register to master server, does it work for you?

@qdm12
Copy link
Owner

qdm12 commented Apr 22, 2020

I meant that I use Caddy just to serve over http the files... to my other Caddy proxy (with https) haha. So it should work for you as Caddy > Traefik > clients instead of Apache > Traefik > clients. You could also bind mount and serve the files directly with Traefik though, and you would have to add a line in your cod4 server config file. I'll send you what I use.

I haven't had time to test the master list, I'll do it this weekend together with the newer entrypoint/supervising program.

@Freekers
Copy link
Author

@TheTrigger Are you running it on a VPS? If so, type ip a and tell me if your WAN IP is listed there.

@TheTrigger
Copy link

@Freekers

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 96:00:00:22:a5:b0 brd ff:ff:ff:ff:ff:ff
    inet 116.203.122.91/32 brd 116.203.122.91 scope global eth0

My own docker-image is actually working (with port binding and bridge network), I tried bot your (freekers/docker-cod4x17a) and @qdm12 image, and wont register to master server for me. idk where I'm wrong

FROM ubuntu:18.04
EXPOSE 28960/udp

RUN mkdir -p /home/user/cod4
WORKDIR /home/user/cod4

RUN dpkg --add-architecture i386
RUN apt update && apt upgrade -y
RUN apt install -yq wget net-tools unzip libc6:i386 libstdc++6:i386

RUN mkdir -p main
RUN mkdir -p zone
RUN mkdir -p mods
RUN mkdir -p usermaps

COPY . .

RUN chmod +x cod4x18_dedrun
RUN chmod +x entrypoint.sh

ENTRYPOINT ["/home/user/cod4/entrypoint.sh"]

VOLUME ["/home/user/cod4/main"]
VOLUME ["/home/user/cod4/zone"]
VOLUME ["/home/user/cod4/mods"]
VOLUME ["/home/user/cod4/usermaps"]

@Freekers
Copy link
Author

The only thing I can think of is a firewall issue, but that doesn't make any sense since you stated your own image seems to be working fine, assuming you're deploying it on the same Docker host.... Sorry, I'm out of ideas for now...

@qdm12
Copy link
Owner

qdm12 commented Apr 24, 2020

Ok there are several differences with my image and this Dockerfile

  • alpine:3.11 vs ubuntu:18.04 (so musl vs glibc)
  • static cod4x18_dedrun vs non statically built cod4x18_dedrun (depending on runtime/libstdc++.so.6)
  • what does COPY copy? From the downloaded zip file? If so, my image might be missing some files from there!
  • What's the entrypoint.sh?

I will dig into it now/tomorrow, maybe after I finish that newer entrypoint though.

@TheTrigger
Copy link

COPY:

  • main/server.cfg
  • main/xbase_00.iwd
  • cod4x18_dedrun
  • entrypoint.sh
  • steam_api.so
  • steamclient.so

Content of entrypoint.sh

#!/usr/bin/env bash

./cod4x18_dedrun +set dedicated 2+set sv_punkbuster 0+set rcon_password "password"+sv_authtoken token+set sv_maxclients 24+set ui_maxclients 32+set net_port "28960"+exec server.cfg+map_rotate

@Freekers
Copy link
Author

What are the steam_api.so and steamclient.so files used for?

xbase_00.iwd is obsolete and can be removed: https://cod4x.me/index.php?/forums/topic/1013-xiceops_00iwd/&tab=comments#comment-5217

@TheTrigger
Copy link

TheTrigger commented Apr 24, 2020

xbase_00.iwd is obsolete and can be removed: https://cod4x.me/index.php?/forums/topic/1013-xiceops_00iwd/&tab=comments#comment-5217

Are you sure he doesn't indent xiceops_00.iwd is deprecated?
Actually if you download the bin of server, main/xbase_00.iwd is present, also steam_api.dll and steamclient.dll

@Freekers
Copy link
Author

Ah yes, I see. That seems more likely indeed. A bit confusing the way it's written down.

@qdm12
Copy link
Owner

qdm12 commented Apr 24, 2020

I'll add the two steam library files (hopefully they work on Alpine's musl though, otherwise I'll switch to a debian slim I guess), but these seem to be the only files missing. Maybe xbase_00.iwd changed although its size is the same as before, I didn't check with a hash if it changed though. Otherwise there are:

  • runtime/libstdc++.so.6 which is for non statically built cod4x18_dedrun binaries
  • cod4x18_dedrun_dbg is a debug run version of the standard binary program

@qdm12
Copy link
Owner

qdm12 commented Apr 25, 2020

So the steam files are closed source, non statically built files as I discussed in this issue ages ago (sorry forgot!) so they won't work on Alpine. What I'll do is have a Debian version with Steam (although it will likely be like 10 times bigger), but at least you can test it out see if this masterlist works

qdm12 added a commit that referenced this issue Apr 25, 2020
@qdm12
Copy link
Owner

qdm12 commented Apr 25, 2020

It should work now with

docker pull qmcgaw/cod4:steam

And add the Docker tag :steam to your config file.

Although, @Freekers did the master list even worked initially with the older Docker image?

That steam Docker image uses the steam files downloaded but it's 300MB+ vs 21MB, so ideally if we find a way to make it work on Alpine that would be nice 👍

@TheTrigger
Copy link

docker pull qmcgaw/cod4:steam

It works thank you!

@Freekers
Copy link
Author

@qdm12 I honestly don't remember. I tried many different combinations/configurations, including my own Docker image... Sorry!

Regarding those steam .DLL files; aren't these only for Windows? Does Linux actually use them?

@qdm12
Copy link
Owner

qdm12 commented Apr 26, 2020

Linux uses the same files but built for Linux using the .so file extension. It seems they are needed for authenticating users and quite likely needed for connecting to the master list.

I am still a bit confused where these steam library files are from and if they would be a way to use them without the 300MB of C++ libraries. There may be a way to handpick libraries needed by them (check with docker exec cod4 ldd steam_api.so for example) but I gave up 😄 I'll ask on the cod4xserver repo, maybe they have better ideas.

qdm12 added a commit that referenced this issue Apr 26, 2020
@qdm12 qdm12 mentioned this issue Apr 26, 2020
@qdm12
Copy link
Owner

qdm12 commented Apr 26, 2020

Ok i think the issue is fixed.

Note that I added this morning a built in HTTP server listening on port 8000 for mods and usermaps (iwd and ff files only, the rest are blocked). Instructions are here. Feel free to open another issue if you need help setting it up with your reverse proxy / port forwarding.

@qdm12 qdm12 closed this as completed Apr 26, 2020
@Freekers
Copy link
Author

Linux uses the same files but built for Linux using the .so file extension. It seems they are needed for authenticating users and quite likely needed for connecting to the master list.

I am still a bit confused where these steam library files are from and if they would be a way to use them without the 300MB of C++ libraries. There may be a way to handpick libraries needed by them (check with docker exec cod4 ldd steam_api.so for example) but I gave up 😄 I'll ask on the cod4xserver repo, maybe they have better ideas.

Sorry, I got confused by this #8 (comment) of TheTrigger, where he is referring to .DLL files, which don't work on Linux, but I now see there's a Linux version available of those as well.

It looks like they are used for authentication indeed. Quote: 'This library is required for receiving screenshots, everything related to Steam and getting of players the playerid. It is required to auth players.' https://cod4x.me/index.php?/forums/topic/148-library-doing-playerauthentication-for-version-159/

BTW. Do you know how to find out which COD4x subversion is running?

@qdm12
Copy link
Owner

qdm12 commented Apr 27, 2020

Yes indeed. Although I'm starting to wonder, I've seen an error message on the statically compiled program about invalid certificates for https access (and it cannot resolve hostnames), that might be a reason why the masterlist doesn't work. I'll reopen, maybe I can fix that so it works on the tinier image.

You can find the cod4x subversion running at the top of your logs if I'm not mistaken.

@qdm12 qdm12 reopened this Apr 27, 2020
@Freekers
Copy link
Author

Regarding the invalid certificates; try adding the 'ca-certificates' package.

@qdm12
Copy link
Owner

qdm12 commented Apr 27, 2020

Yes I already tried, even placed ca/ca-bundle.crt next to the binary but it doesn't see it somehow. I think the statically compiled program is a bit messed up somehow, I'll try digging into it this week.

@qdm12
Copy link
Owner

qdm12 commented Aug 9, 2021

Hey guys, just before closing this issue:

  1. I reworked the image now, it's now up to date at cod4x version 20.1
  2. I reduced the image size of the Debian image from 365MB to 125MB, therefore it will be the only image from now. Support and build for the Alpine based images are abandoned.
  3. Now :latest (and future releases) should work with all features, feel free to let me know if it doesn't for anything.

@qdm12 qdm12 closed this as completed Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants