andybe c4095615b6
docker contribution for linux (#153)
* initial review for docker

* update link

* more typos

* hight letter

* it's realm.rft

* realm.rtf

* remove legacy code from dockerfiles

* docker-compose cleanup,- documented clone the right database

* add timezone to mangos.env

* add more at the build command

* double only

* it's a script not a container

* more documentation and moved into seperate folder

* revert back the openssl

* reformat documentation

* high letter

* timezone

* reduce dockerfiles and add documentation

* removed mangos user from build script

* correct links for realmd and world

* fixing small things, after railroid the documentation.

* command is called restart

* hold the documentation line

* add the changes for realmlist.wtf

Co-authored-by: AndyBe <andreas.benzler@gmail.com>
2021-05-09 21:11:05 +01:00

1.9 KiB

The mangosd (world) Dockerfile

This Dockerfile only is used on running the mangosd service. As you know we got a build container.
Most docker instance not use this way, but this is the cleanest way.

We use ubuntu focal as base system because of longterm

from ubuntu:focal

Update the container and add neccesary parts to run the realmd binary

RUN apt update && apt dist-upgrade -y  --no-install-recommends \
    openssl \
    libmariadb3 

Create the bin directory, copy in mangosd service and tools

RUN mkdir -p /app/bin/tools
COPY bin/mangosd /app/bin/
COPY bin/tools/* /app/bin/tools/

We save the configuration the container.
It will not be used in our process, but we got it handy in te container.

RUN mkdir /app/etc
COPY etc/mangosd.conf.dist /app/etc/
COPY etc/ahbot.conf.dist /app/etc/

Now we expose the ports that the client listen on the first one for the world game play. (8085).
This has to be declared in the database realmd

EXPOSE 8085
EXPOSE 7878

Define the app/bin as start point ...

WORKDIR "/app/bin"

We got a diffrent entrypoint - the run script.

ENTRYPOINT ["/usr/bin/entrypoint.sh"]

We can protect the server more if we run the mangosd as seperate user. In the matter of simplicty this is a future step.

The mangosd-entrypoint.sh

What the script is just simple. Fire up an screen command with the daemon and watch over it until it ends.
In case there is no daemon the container will stop.

Please got in mind:
docker-compose "restart: unless-stopped" the container restart endless.

#!/bin/bash
DAEMON=mangosd

cd /app/bin

# run daemon as mangos user
screen -dmS mangos-zero "./$DAEMON"

echo "MaNGOS zero world daemon started"

UP_AND_RUNNING=2
# mangos server still up?
while [ $UP_AND_RUNNING -gt 1 ] ;
do
     sleep 1;
     UP_AND_RUNNING="$(ps uax | grep $DAEMON  | wc -l)";
done