2023-12-09 23:42:39 +02:00
|
|
|
# The Metin2 Deployment Files
|
2024-12-07 20:22:30 +02:00
|
|
|
The Old Metin2 Project aims at improving and maintaining the 2014 Metin2 game
|
|
|
|
files up to modern standards. The goal is to archive the game as it was in
|
|
|
|
order to preserve it for the future and enable nostalgic players to have a
|
|
|
|
good time.
|
|
|
|
|
|
|
|
For-profit usage of this material is certainly illegal without the proper
|
|
|
|
licensing agreements and is hereby discouraged (not legal advice). Even so, the
|
|
|
|
nature of this project is HIGHLY EXPERIMENTAL - bugs are to be expected for now.
|
|
|
|
|
|
|
|
## Compatibility matrix
|
|
|
|
| **Operating system** | amd64 | i386 | arm64 | armv7 | Notes |
|
|
|
|
|------------------------|-------|------|-------|-------|------------------------------------------------------------|
|
|
|
|
| **Debian 11** | ⚠️ | ❔ | ❔ | ❌ | Requires `EVENT_NOEPOLL=1` environment variable to be set. |
|
|
|
|
| **Debian 12** | ✅ | ❔ | ❔ | ❌ | |
|
|
|
|
| **Ubuntu 22.04.5 LTS** | ✅ | N/A | ❔ | ❌ | |
|
|
|
|
| **Ubuntu 24.04.1 LTS** | ❔ | N/A | ❔ | ❌ | |
|
|
|
|
| **Docker on WSL** | ✅ | N/A | ❔ | N/A | |
|
|
|
|
| **Docker on macOS** | ❔ | N/A | ✅ | N/A | |
|
|
|
|
|
|
|
|
### What about Windows, FreeBSD? macOS?
|
|
|
|
As described below, the deployment system for The Old Metin2 Project is based
|
|
|
|
on Docker and Docker Compose. Since support for native Windows, FreeBSD or
|
|
|
|
macOS Docker containers is experimental at best and unavailable at worst,
|
|
|
|
the auto-magical deployment system in this repository is not compatible with
|
|
|
|
these OSs.
|
|
|
|
|
|
|
|
Compiling [the server](https://git.old-metin2.com/metin2/server)
|
|
|
|
binary and running it on these systems should be possible, but you have to come
|
|
|
|
up with your own deployment strategy, be it shell scripts, a custom watchdog
|
|
|
|
program, or simply manually starting the binaries. Moreover, this is currently
|
|
|
|
outside the scope of the project and unsupported for the time being.
|
2023-12-09 23:42:39 +02:00
|
|
|
|
|
|
|
|
2024-11-17 10:48:33 +02:00
|
|
|
## Quick start guide
|
|
|
|
The deployment strategy for this project is based around Docker Compose.
|
2023-12-09 23:42:39 +02:00
|
|
|
|
2024-11-17 10:48:33 +02:00
|
|
|
### Architecture description
|
2024-12-07 20:22:30 +02:00
|
|
|
The MySQL database is currently pinned on version 5.5. We're using the
|
|
|
|
[biarms/mysql](https://github.com/biarms/mysql) project in order to provide ARM
|
|
|
|
compatibility for such an old version of MySQL.
|
2023-12-09 23:42:39 +02:00
|
|
|
|
2024-12-07 20:22:30 +02:00
|
|
|
The game cores (`db`, `auth`, `game-*`) are ran by using pre-built images
|
|
|
|
containing the server binaries and game files, provided in the
|
|
|
|
[Server repository](https://git.old-metin2.com/metin2/server/packages).
|
2024-11-17 10:48:33 +02:00
|
|
|
|
2024-12-07 20:22:30 +02:00
|
|
|
The web application provides the actual website, item mall and autopatcher
|
|
|
|
functionality. Moreover, it is responsible with maintaining the database schema,
|
|
|
|
creating and updating tables when needed. Pre-built images containing the web
|
|
|
|
application are provided in the
|
|
|
|
[Website repository](https://git.old-metin2.com/metin2/web/packages).
|
2024-11-17 10:48:33 +02:00
|
|
|
|
|
|
|
### Preparing the server
|
2024-12-07 20:22:30 +02:00
|
|
|
Clone this repository and access its root directory. For instance, on Linux you
|
|
|
|
would do this:
|
2023-12-09 23:42:39 +02:00
|
|
|
```shell
|
2024-11-17 10:48:33 +02:00
|
|
|
git clone --depth 1 https://git.old-metin2.com/metin2/deploy.git metin2-deploy
|
|
|
|
cd metin2-deploy/
|
2023-12-09 23:42:39 +02:00
|
|
|
```
|
|
|
|
|
2024-12-07 20:22:30 +02:00
|
|
|
Now, we need to copy the example environment file and name it `.env`. This file
|
|
|
|
contains all settings used by Docker Compose to start up our project.
|
2023-12-09 23:42:39 +02:00
|
|
|
```shell
|
2024-11-17 10:48:33 +02:00
|
|
|
cp .env.example .env
|
2023-12-09 23:42:39 +02:00
|
|
|
```
|
|
|
|
|
2024-12-07 20:22:30 +02:00
|
|
|
Some settings aren't yet filled out. The actual settings will differ based on
|
|
|
|
your setup. We'll assume that you're using WSL and Docker on your own computer,
|
|
|
|
and you want to run the server locally, just for yourself. Start with opening
|
|
|
|
the newly copied `.env` file.
|
2024-11-17 10:48:33 +02:00
|
|
|
|
2024-12-07 20:22:30 +02:00
|
|
|
Firstly, we need to configure the web application. Find `WEB_APP_URL` and change
|
|
|
|
it to the URL you would use to access the machine you're installing this on
|
|
|
|
(without a trailing slash!). In our case, simply set it to `http://localhost`.
|
2024-11-17 10:48:33 +02:00
|
|
|
|
2024-12-07 20:22:30 +02:00
|
|
|
You might already use port 80 on your machine for something else, in which case
|
|
|
|
we need to configure the app to use another port. Simply change `WEB_EXTERNAL_PORT`
|
|
|
|
to another value, for example `8080`. Don't forget to change `WEB_APP_URL`
|
|
|
|
accordingly, in our case to `http://localhost:8080`.
|
2024-11-17 10:48:33 +02:00
|
|
|
|
2024-12-07 20:22:30 +02:00
|
|
|
Next, we need to generate a cryptographic key. We'll make use of Laravel's
|
|
|
|
generator feature, as follows:
|
2024-11-17 10:48:33 +02:00
|
|
|
```shell
|
2024-11-17 11:19:21 +02:00
|
|
|
docker run --rm git.old-metin2.com/metin2/web:latest "php artisan key:generate --show"
|
2024-11-17 10:48:33 +02:00
|
|
|
```
|
|
|
|
|
2024-12-07 20:22:30 +02:00
|
|
|
Run the above command and configure `WEB_APP_KEY` with the output. You should
|
|
|
|
end up with something like: `WEB_APP_KEY=base64:<your-key-here>`.
|
2024-11-17 10:48:33 +02:00
|
|
|
|
2024-12-07 20:22:30 +02:00
|
|
|
Lastly, let's switch our focus to the game server. Make sure that `PUBLIC_IP` is
|
|
|
|
set to a value at which you can access your machine. As a rule of thumb, this
|
|
|
|
should be the same value you set in your client's `serverinfo.py`. In our case,
|
|
|
|
leaving a value of `127.0.0.1` should work just fine.
|
2024-11-17 10:48:33 +02:00
|
|
|
|
|
|
|
Don't forget to save your `.env` file!
|
|
|
|
|
2023-12-09 23:42:39 +02:00
|
|
|
### Starting the server
|
2024-12-07 20:22:30 +02:00
|
|
|
You're ready to start the server. Simply run the following command to start up
|
|
|
|
the server:
|
2023-12-09 23:42:39 +02:00
|
|
|
```shell
|
2024-11-17 10:48:33 +02:00
|
|
|
docker compose up -d --pull always
|
2023-12-09 23:42:39 +02:00
|
|
|
```
|
|
|
|
|
2024-11-17 10:48:33 +02:00
|
|
|
On the first run, your database tables will be created and populated with default data.
|
|
|
|
|
|
|
|
### Stopping the server
|
|
|
|
Should you want to stop the server, simply bring down the Docker Compose stack:
|
|
|
|
```shell
|
|
|
|
docker compose down
|
|
|
|
```
|
|
|
|
|
|
|
|
### Start only some services
|
2024-12-07 20:22:30 +02:00
|
|
|
This deployment environment can also be used for development purposes. If you
|
|
|
|
need a database and website, but want to run the server in some other way (for
|
|
|
|
example, in an IDE), you can just bring up only the services you need:
|
2024-11-17 10:48:33 +02:00
|
|
|
|
|
|
|
```shell
|
|
|
|
docker compose up -d mysql web
|
|
|
|
```
|
2024-12-07 20:22:30 +02:00
|
|
|
|
|
|
|
## Help!
|
|
|
|
|
|
|
|
### `epoll_wait` issues
|
|
|
|
On some Linux distributions, kernels are shipped without `epoll_wait` support,
|
|
|
|
which in turn might lead to the following error being shown (and the server
|
|
|
|
naturally won't start):
|
|
|
|
|
|
|
|
```
|
|
|
|
[warn] epoll_wait: Function not implemented
|
|
|
|
```
|
|
|
|
|
|
|
|
Luckily, there is a workaround: disabling the `epoll` backend of libevent. In
|
|
|
|
order to do this, modify your `&common-environment` section in your
|
|
|
|
`docker-compose.yml` file by adding the following line:
|
|
|
|
|
|
|
|
```
|
|
|
|
EVENT_NOEPOLL: 1
|
|
|
|
```
|