Skip to content

Docker Compose

Daniel Speichert edited this page Feb 22, 2020 · 2 revisions

Docker Compose

WIP PR: https://github.com/otland/forgottenserver/pull/2758

There is also a way of running the server + database at once using docker-compose. By default it:

  • Creates a database named forgottenserver.
  • Executes schema.sql file, so that you don't have to manually import it.
  • Saves all the database files inside a ./db local directory.
Preparation:
  1. Update your configu.lua with these values, so that server properly connects to the database:
-- MySQL
mysqlHost = "db"
mysqlUser = "forgottenserver"
mysqlPass = "<your_db_password>"
mysqlDatabase = "forgottenserver"
mysqlPort = 3306
mysqlSock = ""
  1. Change your database user password by replacing <your_db_password> with your password of choice. Remember to also update it in docker-compose.yml.

  2. Change your database root password by replacing <your_root_password> in docker-compose.yml.

Start:
docker-compose up -d
Stop:
docker-compose down
Rebuild container after source code changes:
docker-compose up -d --build

Created services:

  1. The Forgotten Server - localhost:7171, localhost:7172.
  2. Database - direct connection hidden to the outside world.
  3. Database explorer - localhost:8080. Allows viewing what's inside the database.

Docker-compose issues:

  1. During startup the server container is created after database, however, the database might not be initially available. This is why the server will restart a couple of times before it successfully establishes the connection.

  2. If you are using Docker Toolbox for Windows and it uses VirtualBox, then the server and database explorer address host name will be 192.168.99.100 instead of localhost.

Clone this wiki locally