mangos/contrib/docker/doc/DOCKERCOMPOSE.md
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

2.8 KiB

The "if and why" about the mangos docker-compose.yml


There a many ways to write an docker-compose.

For best practice

  • keep it simple as possible
  • all container named
  • network is defined as mangos
  • every container starts automatical, but can be stopped at any time
    "restart: unless-stopped"
  • localtime is mapped into the container and also define in mangos.env
    This is absolute recommend, because container can run in different timezones.

Alle containers depends on the database

The mariadb:latest is a debian based container.
Nothing needs to be rethink - debian and ubuntu - use the same command lines.
  mangos-db:
    container_name: mangos-db
    image: mariadb:latest
    restart: unless-stopped
    env_file:
      - mangos.env
    networks: 
      - mangos
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./mariadb/:/var/lib/mysql
      - ./zero-database:/zero-database

As you can see at the last line the source from database is mapped into the container. This is normal needed once for initialization.

Next moangos login server

  mangos-realm:
    image: mangos-realm
    build:
      context: ./app
      dockerfile: ../mangos/contrib/docker/realm/Dockerfile
    container_name: mangos-realm
    restart: unless-stopped
    ports:
      - target: 3724
        published: 3724
        protocol: tcp
        mode: host
    env_file:
      - mangos.env
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./app/etc:/app/etc
      - ./logs:/app/logs
    depends_on:
      - mangos-db

    networks:
      - mangos

The part of ports is a little bit different and live on "host".

Why? All streams are transported into the container and ip address is changed.
How you wanne ban clients with the right ip address?
The mode "host" makes it possible. In this case it can be define only onces at running the host.

The configuration and logs are mapped as volume into the container.

Lets jump into the world server

  mangos:
    image: mangos
    build:
      context: app
      dockerfile: ../mangos/contrib/docker/world/Dockerfile
    container_name: mangos
    restart: unless-stopped
    ports:
      - target: 8085
        published: 8085
        protocol: tcp
        mode: host
      - 7878:7878
    env_file:
      - mangos.env
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./app/etc:/app/etc
      - ./data:/app/data
      - ./logs:/app/logs
    depends_on:
      - mangos-db
      - mangos-realm

    networks:
      - mangos
   

In principal same stuff as on the realm service.
In additional we need the world data as volume.

The mangos network adapter

At the end we define an network adapter for the inner communication.

networks:
  mangos:
    name: mangos
    driver: bridge

Cheers