Compare commits

...

2 Commits

3 changed files with 55 additions and 15 deletions

View File

@ -1,3 +1,9 @@
################################################################################
# Docker images
################################################################################
GAME_IMAGE=git.old-metin2.com/metin2/server:latest
WEB_IMAGE=git.old-metin2.com/metin2/web:latest
################################################################################
# MySQL settings
################################################################################
@ -16,7 +22,6 @@ MYSQL_DB_LOG=log
################################################################################
# General configuration
WEB_IMAGE=git.old-metin2.com/metin2/website:nightly
WEB_APP_NAME=Metin2
WEB_APP_ENV=production
WEB_APP_URL=http://metin2.local
@ -46,5 +51,4 @@ DB_PORT=15000
# Game settings
PUBLIC_IP=127.0.0.1
GAME_IMAGE=git.old-metin2.com/metin2/server:nightly
GAME_MAX_LEVEL=105

View File

@ -3,27 +3,62 @@ The Old Metin2 Project aims at improving and maintaining the 2014 Metin2 game fi
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.
## Usage
The deployment strategy for this project is based around Docker Compose. For now, no images are published, so building your own server image is required. Also, for now, you need to provide your own database schema.
## Quick start guide
The deployment strategy for this project is based around Docker Compose.
### Building the server image
This process requires that you do the following steps on a Linux environment with Docker installed and running.
### Architecture description
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.
Clone the Server project repository:
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).
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).
### Preparing the server
Clone this repository and access its root directory. For instance, on Linux you would do this:
```shell
git clone https://git.old-metin2.com/metin2/server.git
git clone --depth 1 https://git.old-metin2.com/metin2/deploy.git metin2-deploy
cd metin2-deploy/
```
Build the image:
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.
```shell
cd server
docker build -t metin2/server:test .
cp .env.example .env
```
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.
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`.
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`.
Next, we need to generate a cryptographic key. We'll make use of Laravel's generator feature, as follows:
```shell
docker run git.old-metin2.com/metin2/web:latest "php artisan key:generate --show"
```
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>`.
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.
Don't forget to save your `.env` file!
### Starting the server
Clone this repository and open a terminal window in its root directory. Then, simply bring up the Compose project:
You're ready to start the server. Simply run the following command to start up the server:
```shell
docker compose up -d
docker compose up -d --pull always
```
On the first run, you might need to connect to port 3306 with your favourite MySQL client (Navicat, DBeaver, phpMyAdmin etc.) and install a Metin2 database schema.
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
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:
```shell
docker compose up -d mysql web
```

View File

@ -22,7 +22,8 @@ x-environment:
services:
# MySQL Database
mysql:
image: mysql:5.5
# The biarms/mysql Docker image supports ARM machines; you may also use mysql:5.5
image: biarms/mysql:5.5
restart: on-failure
environment:
# Password for root access