Skip to content

Commit

Permalink
Clean up README.md and use docker compose
Browse files Browse the repository at this point in the history
Now that the docker cli provides the `compose` command, we can move away from `docker-compose`.
  • Loading branch information
chrzrdx committed Sep 21, 2024
1 parent bc252ac commit 6ad05ad
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 44 deletions.
11 changes: 9 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
MYSQL_ROOT_PASSWORD=CHANGEME
MYSQL_REOSERV_PASSWORD=CHANGEME
# database settings
MYSQL_ROOT_PASSWORD="CHANGEME"
MYSQL_PASSWORD="CHANGEME"
MYSQL_USER="reoserv"
MYSQL_DATABASE="reoserv"
TZ="UTC"

# misc
RUST_DEBUG="debug"
68 changes: 41 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,65 @@

# REOSERV

The rust powered [Endless Online](https://game.eoserv.net/) server emulator!
The Rust-powered server emulator for [Endless Online](https://game.eoserv.net/) 🦀

# Building
## Prerequisites

The only depency is rust and cargo. I recommend using [rustup](https://rustup.rs/) to install both.
Before building the server, ensure you have the following installed:

To build the server simply run
- [Rust](https://www.rust-lang.org/)
- [Cargo](https://doc.rust-lang.org/cargo/appendix/glossary.html#cargo)
- [Docker](https://docs.docker.com/engine/install/)

`cargo build`
I recommend using [rustup](https://rustup.rs/) to install Rust and Cargo.

or for release build
## Building

`cargo build --release`
To build the server, simply run:

# Database setup
```sh
cargo build
```

0. You should install docker-compose
1. Create a .env file with the following (replacing <PASSWORD>s with your own secure password)
For a release build, use:

```sh
cargo build --release
```
MYSQL_ROOT_PASSWORD=<ROOT_PASSWORD>
MYSQL_REOSERV_PASSWORD=<REOSERV_PASSWORD>
```

2. Start the container
## Database setup and Configuration

1. Create a `.env` file at the root of the repository using `.env.example` as a template. Replace `CHANGEME` with your own secure passwords, leaving other configuration options as is:

`docker-compose up`
```ini
# database settings
MYSQL_ROOT_PASSWORD="CHANGEME"
MYSQL_PASSWORD="CHANGEME"
MYSQL_USER="reoserv"
MYSQL_DATABASE="reoserv"
TZ="UTC"

# Configure the server
# misc
RUST_DEBUG="debug" # or "trace" for more detailed output
```

_You can either edit Config.toml directly or edit a copy Config.local.toml_
2. Start the container:

The only required change right now is the settings for the database connection.
```sh
docker compose up
```

If you're using the provided docker-compose file then all you need to do is set
password to the same password you set to for `MYSQL_REOSERV_PASSWORD` in the .env file.
3. Edit the server configuration in `config/Config.toml` or a copy of it (`config/Config.local.toml`). Edit the database connection settings to match the `MYSQL_PASSWORD` in the `.env` file.

# Start server
## Start the server

You can run the server with
To run the server, use:

`cargo run`
```sh
cargo run
```

(if you want more logging then set the `RUST_LOG` environment variable to one
of the following:
The logging level can be adjusted by changing the `RUST_LOG` variable in the `.env` file. The options are:

- debug: The human readable data structures for every packet will be printed
- trace: The raw byte arrays for every packet will be printed
- `debug`: This will print human-readable data structures for every packet.
- `trace`: This will print the raw byte arrays for every packet.
11 changes: 11 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
db:
image: mariadb:latest
restart: unless-stopped
env_file:
- .env
ports:
- "3306:3306"
volumes:
- db-data:/var/lib/mysql
- ./db-init/:/docker-entrypoint-initdb.d/
15 changes: 0 additions & 15 deletions docker-compose.yml

This file was deleted.

0 comments on commit 6ad05ad

Please sign in to comment.