OpenTibiaBR
GithubDiscordSponsor
  • Home
    • 📖Welcome!
    • 💵Donate
  • OpenTibiaBR
    • 🖥️Projects
      • 🐦Canary
        • About
        • Getting Started
          • Compiling
            • Linux
              • [Linux] Compiling Canary Sources
            • Windows
              • Visual Studio
                • [Windows][VC2022][CMake] Compiling Canary Sources
                • [Windows][VC2022][Solution] Compiling Canary Sources
              • WSL
                • [WSL] Compiling Canary Sources
          • Installing
            • aaPanel
              • [Linux] Canary + aaPanel + MyAAC
            • Docker
              • [Docker] Canary + MariaDB + MyAAC
            • Linux
              • Nginx + MariaDB + MyAAC
            • Windows
              • Uniform Server
                • [Windows][Basic] Canary + Uniform Server + MyAAC
              • XAMPP
                • [Windows][Advanced] Canary + XAMPP + MyAAC
        • Tutorials
          • Basic
            • Auto Backup Server Database
            • Auto Restart and Linux Logs
            • Custom Bestiary / Prey with Canary Monster Editor
            • Event Schedule Canary / OTServBR-Global
            • How to make a custom server with Canary
            • How to reset players in your database
            • How to secure a Linux server
            • SSL Certificates
            • Webhook Discord
            • [Outdated] Custom Bestiary / Prey
            • [Linux] Backup + Upload - Google Drive
            • [Linux] How to install Linux headers
            • VPS Linux
            • [Windows] SSL/HTTPS Certificate with XAMPP
          • Mapping
            • [Windows] Remere's Map Editor - Opening Canary / OTServBR-Global Map
            • [Windows] Remere's Map Editor - Converting map server id to client id
          • Programming & Scripting
            • How to add a new vocation
            • Revscriptsys
            • Guide Lua Objects
            • How to get raceId for monsters
          • Websites
            • [Canary][OTServBR-Global][GesiorAAC][MyAAC] Set up Initial Character
          • Miscellaneous
            • Useful Tutorials
            • Video Tutorials
      • 🗺️Remere's Map Editor
        • About
        • Getting Started
          • Linux
            • [Linux] Compiling Remere's Map Editor Sources
          • Windows
            • WSL
              • [WSL] Compiling Remere's Map Editor Sources
            • Visual Studio
              • [Windows][VC2022][CMake] Compiling Remere's Map Editor Sources
              • [Windows][VC2022][Solution] Compiling Remere's Map Editor Sources
      • 🎮OTClient Redemption
        • About
        • Getting Started
          • Android
            • [Android] Compiling OTClient Redemption Sources
          • Linux
            • [Linux] Compiling OTClient Redemption Sources
          • Windows
            • WSL
              • [WSL] Compiling OTClient Redemption Sources
            • Visual Studio
              • [Windows][VC2022][CMake] Compiling OTClient Redemption Sources
              • [Windows][VC2022][Solution] Compiling OTClient Redemption Sources
          • Web
            • [Web] OTClient Redemption
        • Tutorials
          • Basic
            • Client Updater
    • 🔗Downloads
      • 🎮Clients
        • Client 11
        • Client 14
          • Tutorials
            • Client with HexEditorXVI32
            • Client with Notepad++
            • Client with config.ini
            • [Windows] How to change client background
        • OTClientV8
          • About
          • Getting Started
            • Android
              • [Android] Compiling OTClientV8 Sources
            • Linux
              • [Linux] Compiling OTClientV8 Sources
            • Windows
              • WSL
                • [WSL] Compiling OTClientV8 Sources
              • Visual Studio
                • [Windows][VC2022][CMake] Compiling OTClientV8 Sources
                • [Windows][VC2022][Solution] Compiling OTClientV8 Sources
          • Features
            • Health and Mana bar backgrounds
            • HTTP support
            • OTML Improvement
            • Simple cam recorder and player
            • Updater, encryption and compression
            • WebSockets
        • Minimap
      • 📑Codes
        • C++
        • Events
        • Functions
        • Libs
        • Modules
        • Others
      • 🖼️Images
        • PSDs
        • Others
      • 🗺️Maps
        • Custom
        • Global
      • 📑Revscripts
        • Actions
        • CreatureEvents
        • GlobalEvents
        • MoveEvents
        • NPCs
        • Spells
        • Systems
        • TalkActions
      • ⚔️Sprites
      • ⚙️Tools
        • Editors
        • Launchers
          • Canary Launcher
            • About
            • Getting Started
              • Windows
                • [Windows][VC2022][Solution] Compiling Canary Launcher Sources
          • Slender Launcher
            • About
            • Getting Started
              • Windows
                • [Windows][Go] Compiling Slender Launcher Sources
        • Login Server
          • About
          • Getting Started
        • Map Generators
      • 🌐Web Packages
        • Linux
        • Windows
      • 🌐Website Applications
        • Websites
          • CanaryAAC
            • About
            • Informations
              • Features
              • Functions
              • API
              • Routes
              • Middleware
            • CanaryAAC Bot
          • Gesior2012
            • About
          • GesiorAAC Global
            • About
          • MyAAC
            • About
          • MyAAC Global
            • About
          • SlenderAAC
            • About
          • ZnoteAAC
            • About
        • Applications
        • Layouts
        • APIs and SDKs
Powered by GitBook
On this page
  • 1 - Downloads Required:
  • 2 - File Structure:
  • 3 - Database:
  • 4 - Preparing the Server:
  • 5 - MyAAC:
  • 6 - Credits:
  1. OpenTibiaBR
  2. Projects
  3. Canary
  4. Getting Started
  5. Installing
  6. Docker

[Docker] Canary + MariaDB + MyAAC

Last updated 2 months ago

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:

  • GIT Client: (optional)

  • Docker Compose: To install Docker, please follow the steps on the

  • MariaDB Database Official image:

  • Canary:

  • MyAAC:

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 Canary in the tutorial [Linux] Canary + Nginx + MariaDB + MyAAC:

  • After generating the binary, copy it to the directory data/server/bin and 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/canary in the data/server/data. We can do this in 2 ways:

  1. 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.

  2. ZIP:

    Download the project ZIP file (): - 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/myaac in the directory data/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 () and extract its contents into the data/myaac

  • The 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_USERand MARIADB_PASSWORD) and the password of the super user (MARIADB_ROOT_PASSWORD). For more details, access the address .

  • 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.env and 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_PASSWORD and MARIADB_ROOT_PASSWORD to the one of your preference.

  • Starting the container:

  • Change the file docker-compose.yml as 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 docker directory and run the following command in the terminal:

cd ~/Canary/docker
docker compose up
  • The 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 bash
  • Inside the container, run the following command to import the schema into the database:

mariadb -u root -p canary_db < /tmp/schema.sql
  • Enter 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 exit and press enter to 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:

  1. Copy the file data/server/data/config.lua.dist to data/server/data/config.lua.

  2. Change the following parameters in the file config.lua:

    • IP: Enter the DNS or IP of the VPS. Keep value to local127.0.0.1

      ip = "127.0.0.1"
    • allowOldProtocol: Change to allow client access 11.00 (OTCv8, for example)

      allowOldProtocol = true
    • maxPacketsPerSecond: If you're having connection issues on clients, try increasing this parameter (default = 25)

      maxPacketsPerSecond = 200
    • Database Connection:

      -- MySQL
      mysqlHost = "tibia_canary_db"
      mysqlUser = "canary"
      mysqlPass = "<canary_password>"
      mysqlDatabase = "canary_db"
      mysqlPort = 3306
      mysqlSock = ""
      passwordType = "sha1"
    • coinImagesURL: Swap 127.0.0.1 with 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 data volume 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.server and 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 docker directory, 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:latest to 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 file docker-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, press Ctrl + C to 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.myaac and 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 bcmath
  • Go back to the terminal, navigate to the docker directory, 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:latest to 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 file docker-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 up

Installing MyAAC:

  • Open your browser and go to the address http://127.0.0.1 to proceed with the installation of MyAAC.

  • Add your IP in the filedata/myaac/install/ip.txt and refresh the page F5. Choose the language and click Next.

  • Accept the terms of use by clicking on the button:Next

  • The next screen will verify that all requirements have been met. We solved this step in the created docker image (koalan/opentibiabr_myaac:latest). Click:Next

  • In server path, enter /canary/data. Also, enter the other fields and click on the button:Next

  • Wait for the database to update, and click:Next

  • Enter the data for creating the Administrator's account and character. Click:Next

  • Wait 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.php file.

  • Open the file data/myaac/config.php and 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: .

OpenTibiaBR - MyAAC: .

Beats, Majesty (Linux Tutorial):

🖥️
🐦
https://docs.opentibiabr.com/opentibiabr/projects/canary/getting-started/installing/linux/nginx-+-mariadb-+-myaac
https://github.com/opentibiabr/canary
https://github.com/opentibiabr/myaac
https://docs.opentibiabr.com/opentibiabr/projects/canary/getting-started/installing/linux/nginx-+-mariadb-+-myaac
[Linux] Compiling Canary Sources
Nginx + MariaDB + MyAAC
https://code.visualstudio.com/
https://git-scm.com/downloads
https://docs.docker.com/engine/install/
https://hub.docker.com/_/mariadb
https://github.com/opentibiabr/canary
https://github.com/opentibiabr/myaac
https://docs.opentibiabr.com/opentibiabr/projects/canary/getting-started/linux/linux-canary-+-nginx-+-mariadb-+-myaac#id-2-installation-canary
https://github.com/opentibiabr/canary
https://github.com/opentibiabr/myaac
https://hub.docker.com/_/mariadb