crazy-max / csgo-server-launcher

Counter-Strike Global Offensive Dedicated Server Launcher
GNU Lesser General Public License v3.0
586 stars 119 forks source link

[Docker] AutoUpdate / separate server.cfg #44

Closed mrc4tt closed 5 years ago

mrc4tt commented 5 years ago

Hey @crazy-max

Is there planned or are it already possible to make auto-update of the csgo-server(s) via docker?

Reason for I'm asking, because, I will hear about it's possible to host multiple csgoservers on shared files (srcds_run/maps/cfg) except server.cfg e.g ;) so it's possible to create (to one of each csgoserver via docker)

Let me hear, from you! And thanks for your nice script! ;)

Soren90 commented 5 years ago

Hi MikkelDK,

Im not sure if im just being cpt obvious here, but you could run multiple docker containers with the same configfiles/maps bind-mounted from the host.

mrc4tt commented 5 years ago

Hi MikkelDK,

Im not sure if im just being cpt obvious here, but you could run multiple docker containers with the same configfiles/maps bind-mounted from the host.

I have still not found out, how it works! ;/

Soren90 commented 5 years ago

Could you elaborate what your issue is? I will do my best to help!

Den fre 1 mars 2019 20:40Mikkel notifications@github.com skrev:

Hi MikkelDK,

Im not sure if im just being cpt obvious here, but you could run multiple docker containers with the same configfiles/maps bind-mounted from the host.

I have still not found out, how it works! ;/

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/crazy-max/csgo-server-launcher/issues/44#issuecomment-468786811, or mute the thread https://github.com/notifications/unsubscribe-auth/AiZzO5m6kwFiyK37I8rqkiHV30lC2r-Nks5vSYIpgaJpZM4aclUe .

mrc4tt commented 5 years ago

Yeah, I don't know how the "settings" should be. (I just noted on the Wiki) As example via "FAQ" I'm just reading this: "Create multiple instances" - But that doesn't give me an answer: How I do it!

As example, about it "share" files (without) to share the same server.cfg (with servername/rcon_password/sv_password) e.g

Soren90 commented 5 years ago

All right. Just to clarify some of your questions first. You don't need to think about the sharing the files, that is handled by dockers overlay2 filesystem automatically. What it does is that every image you store will be the baseline for the container that you run and i the container will only increase in filesize when changes are being made to the container. You can see it as a snapshot in a normal virtual environment. You can read more about that here: https://docs.docker.com/storage/storagedriver/overlayfs-driver/

You will need to modify the dockerfile first and add this to the expose (csgo dont like it when docker changes the port -p): EXPOSE 27015 27015/udp EXPOSE 27016 27016/udp

then you build the container: $ docker build -t csgoserverlauncher .

when done. Run the first server:

docker run -dt --name csgo --restart always \ --ulimit nproc=65535 \ --ulimit nofile=32000:40000 \ -p 27015:27015 \ -p 27015:27015/udp \ --env-file $(pwd)/csgo-server-launcher.env \ csgoserverlauncher:latest

change the env file to use port 27016 for the second server (maybe copy the repo to a second folder?)

docker run -dt --name csgo2 --restart always \ --ulimit nproc=65535 \ --ulimit nofile=32000:40000 \ -p 27016:27016 \ -p 27016:27016/udp \ --env-file $(pwd)/csgo-server-launcher.env \ csgoserverlauncher:latest

Please note that you have no volumes, which is needed if you want files to persist after you remove the container, which should not be an issue with a csgo server.

mrc4tt commented 5 years ago

@Soren90 So, what if I want to locate (as example server.cfg) on each? is that possible? like I'm thinking to add few .cfg files (e.g: alias.cfg, esl5on5, sourcemod e.g?)

Soren90 commented 5 years ago

@MikkelDK Yes, you can bind mount it in: -v /path/to/cfg/on/host/server.cfg:/destination/in/container/server.cfg

mrc4tt commented 5 years ago

@Soren90 What about the installation of addons? - Do you have tested that?

Soren90 commented 5 years ago

@MikkelDK Well, it's accually the same process as installing it on the host. The "correct" way of doing it is to modify the dockerfile and rebuild the image. But the quick and lazy way of doing it is to attach to the container and install the same way as you would do it on the host with: docker exec -it csgo /bin/bash

This is getting kind of unrelated to the project. You should be able to find the most of your answers in the docker documentation :)

mrc4tt commented 5 years ago

I will try to do that one tomorrow! ;) for testing. thanks! ^^