• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

PHP Running mysql/my-acc/forgottenserver.exe using Docker / docker-compose

drakylucas

Well-Known Member
Joined
Dec 15, 2015
Messages
194
Solutions
4
Reaction score
89
Hi all, good afternoon, how are you doing?

I'm a totally newbie in Containers/docker.
Can someone please explain step by step to put mysql, website and the TFS running through containers?

without having to compile the server, I imagine this file structure:
folders:
otserver
otserver/forgottenserver <-- this will be the main folder which contains "theforgottenserver-x64.exe" (previously compiled)
otserver/docker <-- this should be the folder that will contain all Dockerfiles and the docker-compose.yml I think, but I'm not sure
otserver/website <-- This should be the folder with my-acc website (the folder with index.php file) (slawkens/myaac (https://github.com/slawkens/myaac))


I imagine something like this:
a Dockerfile to run forgottenserver.exe
a Dockerfile to run mysql (and also run the schemas.sql, but it should load the database stored in computer and not recreate it every time)
a Dockerfile to run php7 / nginx

a docker-compose that compose all these dockerfiles into a single file and starts both website/tfs.

can someone help me understanding Docker? thanks in advance!
Post automatically merged:

so far I tried this:


YAML:
version: "3.7"
services:
  db:
    image: mariadb
    container_name: "mariadb-container"
    restart: unless-stopped
    environment:
      - MYSQL_DATABASE=otserver
      - MYSQL_USER=otserver
      - MYSQL_PASSWORD=otserver
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
    volumes:
      - ./db-volume:/var/lib/mysql
    ports:
      - "3306:3306"

  website:
    image: webdevops/php-nginx:7.4-alpine
    container_name: "myaac-website"
    restart: unless-stopped
    environment:
      - WEB_DOCUMENT_ROOT=/tmp/web/
      - WEB_DOCUMENT_INDEX=index.php
    ports:
      - "80:80"
    depends_on:
      - db
    volumes:
      - ../website/myaac:/tmp/web

docker-compose up
added schemas.sql into /db-volume folder
docker exec -it mariadb-container /bin/bash
cd /var/lib/mysql
mysql -u otserver -p otserver < schema.sql <--- so the schemas was actually copied to the database "otserver"

I don't know if this is the right way of adding the schemas.
after all these steps, I could access 127.0.0.1 website but, myaac is telling me this:

In file install/ip.txt must be your IP!
In file is:
127.0.0.1
127.0.0.2
::1

Your IP is:
172.19.0.1

I'm still searching, but is there any way to set my container IP being the same of my computer (127.0.0.1)?
anyway, I changed my ip in install/ip.txt to 172.19.0.1 and it's working.

now, another doubt:
while configurint myaac, it asked me the path of my TFS folder (Path to your TFS main directory, where you have config.lua located.)
I added this:
C:\Users\Lucas\Desktop\OTServer\forgottenserver

but it couldn't find config.lua
Cannot find config.lua file. Is your server path correct? Go back and check again.

I think this is because actually, when the container starts, he only have access to "
../website/myaac" in my computer.
Should I also share my TFS volume in this case?

also, I still need to add the start of forgotten-server in docker-compose.yml file.
 
Last edited:
Top