[Docker] Canary + MariaDB + MyAAC
Last updated
Last updated
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 tutorial [Linux] Canary + Nginx + MariaDB + MyAAC was used:
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
Create the file structure below in the directory of your choice:
The following structure in text format:
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: https://docs.opentibiabr.com/opentibiabr/projects/canary/getting-started/linux/linux-canary-+-nginx-+-mariadb-+-myaac#id-2-installation-canary
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:
⚠️ 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:
GIT:
Run the following command, to clone the repository to the local directory:
⚠️ 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:
We'll need to clone the project https://github.com/opentibiabr/myaac
in the directory data/myaac
so 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:
⚠️ 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/myaac
The directory will look like this:
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_USER
and MARIADB_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 canary
and password<canary_user_password>
. For the userroot
, we will be using the password<mariadb_root_password>.
Edit the file docker/db.env
and add the following information:
❗️For safety's sake, change the value of the variables
MARIADB_PASSWORD
andMARIADB_ROOT_PASSWORD
to the one of your preference.
Starting the container:
Change the file docker-compose.yml
as follows:
⚠️ 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:
The container will be created, as shown in the image:
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:
⚠️ Remember to change the directory path(
~/Canary
) to the one you created.
Next, we need to access the container to proceed with the import:
Inside the container, run the following command to import the schema into the database:
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:
After entering the password, a table with the example characters will be displayed:
Type and press exit
to exit the container.
Once the database is finished, let's move on to the application part.
The [Linux] Canary + Nginx + MariaDB + MyAAC tutorial also covers this item. Please follow the step 10 - Config.lua
, available at:
To create this tutorial, the following steps were performed:
Copy the file data/server/data/config.lua.dist
to data/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 local127.0.0.1
allowOldProtocol: Change to allow client access 11.00 (OTCv8, for example)
maxPacketsPerSecond: If you're having connection issues on clients, try increasing this parameter (default = 25)
Database Connection:
coinImagesURL: Swap 127.0.0.1
with DNS or VPS IP. Keep the value for local:
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:
Then go back to the terminal, navigate to the docker
directory, and create the image that will be used in docker-compose:
⚠️ 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.
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:
⚠️ 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:
If you've made it this far and were able to view the message ... server online!
, congratulations, your server is ready to be accessed!!
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:
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:
⚠️ 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.
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:
⚠️ 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:
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
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.
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/linux/linux-canary-+-nginx-+-mariadb-+-myaac