[Docker] Canary + MariaDB + MyAAC
In the end of this tutorial, you will be able to upload Canary Server on your local machine or on a VPS, using Docker Compose.
To create this tutorial the information contained in the tutorials was used:
1 - Downloads Required:
Downloads Required
Visual Studio Code: https://code.visualstudio.com/
GIT Client: https://git-scm.com/downloads (optional)
Docker Compose: To install Docker, please follow the steps on the https://docs.docker.com/engine/install/
MariaDB Database Official image: https://hub.docker.com/_/mariadb
2 - File Structure:
File Structure
Create the file structure below in the directory of your choice:

The following structure in text format:
- data - db - myaac - server - bin - data - docker - db.env - docker-compose.yml
2.1 - Canary (data/server):
Binary file:
To generate the binary, you need to compile the project. To do this, please follow the step
2 - Installation Canaryin the tutorial [Linux] Canary + Nginx + MariaDB + MyAAC: https://docs.opentibiabr.com/opentibiabr/projects/canary/getting-started/linux/linux-canary-+-nginx-+-mariadb-+-myaac#id-2-installation-canaryAfter generating the binary, copy it to the directory
data/server/binand grant it permission to run.To do this, run the following command in the terminal:
chmod +x ~/Canary/data/server/bin/canary⚠️ Remember to change the directory path(
~/Canary) to the one you created.
The directory will look like this:

Server Settings and Data:
We'll need to clone the project
https://github.com/opentibiabr/canaryin thedata/server/data. We can do this in 2 ways:
GIT:
Run the following command, to clone the repository to the local directory:
git clone https://github.com/opentibiabr/canary.git ~/Canary/data/server/data⚠️ Remember to change the directory path(
~/Canary) to the one you created.ZIP:
Download the project ZIP file (https://github.com/opentibiabr/canary): - Extract the contents of the file into the
data/server/data.
The directory will look like this:

2.2 - MyAAC (data/myaac):
We'll need to clone the project
https://github.com/opentibiabr/myaacin the directorydata/myaacso we can use the files in the container. As in the previous step, we can do this in 2 ways:GIT:
Run the following command to clone the repository to the local directory:
git clone https://github.com/opentibiabr/myaac.git ~/Canary/data/myaac/⚠️ Remember to change the directory path(
~/Canary) to the one you created.ZIP File:
Download the project's ZIP file (https://github.com/opentibiabr/myaac) and extract its contents into the
data/myaacThe directory will look like this:

3 - Database:
Database
Basically, we need to enter the name of the database instance (
MARIADB_DATABASE), the user credential that will be created along with the container (MARIADB_USERandMARIADB_PASSWORD) and the password of the super user (MARIADB_ROOT_PASSWORD). For more details, access the address https://hub.docker.com/_/mariadb.In this tutorial, we'll use the username
canaryand password<canary_user_password>. For the userroot, we will be using the password<mariadb_root_password>.
Environment variables:
Edit the file
docker/db.envand add the following information:
TZ=America/Sao_Paulo
MARIADB_DATABASE=canary_db
MARIADB_USER=canary
MARIADB_PASSWORD=<canary_user_password>
MARIADB_ROOT_PASSWORD=<mariadb_root_password>❗️For safety's sake, change the value of the variables
MARIADB_PASSWORDandMARIADB_ROOT_PASSWORDto the one of your preference.
Starting the container:
Change the file
docker-compose.ymlas follows:
services:
tibia_canary_db:
container_name: tibia_canary_db
image: mariadb
env_file: ~/Canary/docker/db.env
restart: unless-stopped
volumes:
- ~/Canary/data/db:/var/lib/mysql⚠️ Remember to change the directory path(
~/Canary) to the one you created.
To start the container, go to the
dockerdirectory and run the following command in the terminal:
cd ~/Canary/docker
docker compose upThe container will be created, as shown in the image:

Importing the schema into the database:
Now, we'll need to import the schema into the DB.
Open a new terminal and run the following command to copy the schema to the container:
docker cp ~/Canary/data/server/data/schema.sql tibia_canary_db:/tmp/schema.sql⚠️ Remember to change the directory path(
~/Canary) to the one you created.
Next, we need to access the container to proceed with the import:
docker exec -it tibia_canary_db bashInside the container, run the following command to import the schema into the database:
mariadb -u root -p canary_db < /tmp/schema.sqlEnter the user's password (variable ):

Finally, let's validate the import:
Still in the container, let's list the registered users, with the following command:
mariadb -u root -p canary_db -e "select id, name from players order by id;"After entering the password, a table with the example characters will be displayed:

Type
exitand pressenterto exit the container.Once the database is finished, let's move on to the application part.
4 - Preparing the Server:
Preparing the Server
Config.lua:
The Nginx + MariaDB + MyAAC tutorial also covers this item. Please follow the step
8 - Config.lua, available at:
To create this tutorial, the following steps were performed:
Copy the file
data/server/data/config.lua.disttodata/server/data/config.lua.Change the following parameters in the file
config.lua:IP: Enter the DNS or IP of the VPS. Keep value to local
127.0.0.1ip = "127.0.0.1"allowOldProtocol: Change to allow client access 11.00 (OTCv8, for example)
allowOldProtocol = truemaxPacketsPerSecond: If you're having connection issues on clients, try increasing this parameter (default = 25)
maxPacketsPerSecond = 200Database Connection:
-- MySQL mysqlHost = "tibia_canary_db" mysqlUser = "canary" mysqlPass = "<canary_password>" mysqlDatabase = "canary_db" mysqlPort = 3306 mysqlSock = "" passwordType = "sha1"coinImagesURL: Swap
127.0.0.1with DNS or VPS IP. Keep the value for local:coinImagesURL = "http://127.0.0.1/images/store/"
Creating docker image:
Let's create an image with the libraries needed to run the server, and with the
datavolume mapping. That way, we won't have to worry about building other docker images with the updates.First, we need to create the server
Dockerfile. Open the filedocker/Dockerfile.serverand add the following content:
FROM ubuntu:24.04 AS dependencies
RUN apt update
RUN apt install tzdata -y
RUN apt install ca-certificates -y
RUN apt install gcc-14 g++-14 -y
WORKDIR /canary
VOLUME /canary
EXPOSE 7171
EXPOSE 7172
ENTRYPOINT ["/bin/canary"]Then go back to the terminal, navigate to the
dockerdirectory, and create the image that will be used in docker-compose:
cd ~/Canary/docker
docker build -t koalan/opentibiabr_canary:latest -f Dockerfile.server .⚠️ Remember to change the directory path(
~/Canary) to the one you created.⚠️ Change the image name
koalan/opentibiabr_canary:latestto one of your own.
Updating docker-compose:
Now, let's add the server container, using the image created in the previous step.
In summary, we need to map the directory with the server data and settings (
data/server/data) and the server binary (data/server/bin/canary). To do this, let's edit the filedocker-compose.yml, as shown below:
services:
tibia_canary_server:
container_name: tibia_canary_server
image: koalan/opentibiabr_canary:latest
restart: unless-stopped
depends_on:
- tibia_canary_db
volumes:
- ~/Canary/data/server/data:/canary
- ~/Canary/data/server/bin/canary:/bin/canary
ports:
- 7171:7171
- 7172:7172
tibia_canary_db:
container_name: tibia_canary_db
image: mariadb
env_file: ~/Canary/docker/db.env
restart: unless-stopped
volumes:
- ~/Canary/data/db:/var/lib/mysql⚠️ Remember to change the directory path(
~/Canary) to the one you created.⚠️ Remember to change the name of the docker image.
Go back to the terminal that is running
docker compose, pressCtrl + Cto stop running, and run again, with the command:
docker compose up

If you've made it this far and were able to view the message
... server online!, congratulations, your server is ready to be accessed!!
5 - MyAAC:
MyAAC
Creating docker image:
Similar to what we did with the server, we'll create a docker image with the libraries needed to run MyAAC.
Open the file
docker/Dockerfile.myaacand add the following content:
FROM php:8.2-apache
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
libzip-dev \
zip \
unzip \
nano \
vim
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-install pdo pdo_mysql gd zip opcache
RUN docker-php-ext-install bcmathGo back to the terminal, navigate to the
dockerdirectory, and create the image that will be used in docker-compose, with the following commands:
cd ~/Canary/docker
docker build -t koalan/opentibiabr_myaac:latest -f Dockerfile.myaac .⚠️ Remember to change the directory path(
~/Canary) to the one you created.⚠️ Change the image name
koalan/opentibiabr_myaac:latestto one of your own.
Updating docker-compose:
Now, let's add the MyAAC container, using the image created in the previous step.
In summary, we need to map the directory with the settings (
data/myaac). To do this, let's edit the filedocker-compose.yml, as shown below:
services:
tibia_canary_server:
container_name: tibia_canary_server
image: koalan/opentibiabr_canary:latest
restart: unless-stopped
depends_on:
- tibia_canary_db
volumes:
- ~/Canary/data/server/data:/canary
- ~/Canary/data/server/bin/canary:/bin/canary
ports:
- 7171:7171
- 7172:7172
tibia_canary_myaac:
container_name: tibia_canary_myaac
image: koalan/opentibiabr_myaac:latest
restart: unless-stopped
depends_on:
- tibia_canary_db
volumes:
- ~/Canary/data/myaac:/var/www/html
- ~/Canary/data/server/data:/canary/data
ports:
- 80:80
- 443:443
tibia_canary_db:
container_name: tibia_canary_db
image: mariadb
env_file: ~/Canary/docker/db.env
restart: unless-stopped
volumes:
- ~/Canary/data/db:/var/lib/mysql⚠️ Remember to change the directory path(
~/Canary) to the one you created.⚠️ Remember to change the name of the docker image.
Go back to the terminal that is running , press Ctrl + C to stop running, and then run the command docker compose again:
docker compose upInstalling MyAAC:
Open your browser and go to the address
http://127.0.0.1to proceed with the installation of MyAAC.Add your IP in the file
data/myaac/install/ip.txtand refresh the pageF5. Choose the language and clickNext.Accept the terms of use by clicking on the button:
NextThe next screen will verify that all requirements have been met. We solved this step in the created docker image (
koalan/opentibiabr_myaac:latest). Click:NextIn server path, enter
/canary/data. Also, enter the other fields and click on the button:NextWait for the database to update, and click:
NextEnter the data for creating the Administrator's account and character. Click:
NextWait for the MyAAC to update.
Finally, delete the directory as requested:
data/myaac/install.The homepage will be available at
http://127.0.0.1.
Server Offline:
If MyAAC displays the Server Offline message, and the server IP is 127.0.0.1, you will need to adjust the MyAAC
config.phpfile.Open the file
data/myaac/config.phpand enter the server container name(tibia_canary_server) in the configuration:status_ip'status_ip' => 'tibia_canary_server',When refreshing the page, the server status will be corrected and the number of users online will be displayed.
Admin:
The admin page will be available at http://127.0.0.1/admin.
6 - Credits:
Credits
Allan (Koalan) (Docker Tutorial).
Amanda (Review).
OpenTibiaBR - Canary Server: https://github.com/opentibiabr/canary.
OpenTibiaBR - MyAAC: https://github.com/opentibiabr/myaac.
Beats, Majesty (Linux Tutorial): https://docs.opentibiabr.com/opentibiabr/projects/canary/getting-started/installing/linux/nginx-+-mariadb-+-myaac
Last updated