diff --git a/.env.example b/.env.example index 94b5f90..f543e8c 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,9 @@ -MYSQL_ROOT_PASSWORD=CHANGEME -MYSQL_REOSERV_PASSWORD=CHANGEME \ No newline at end of file +# database settings +MYSQL_ROOT_PASSWORD="CHANGEME" +MYSQL_PASSWORD="CHANGEME" +MYSQL_USER="reoserv" +MYSQL_DATABASE="reoserv" +TZ="UTC" + +# misc +RUST_DEBUG="debug" diff --git a/README.md b/README.md index cb12b03..cd48743 100644 --- a/README.md +++ b/README.md @@ -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 s with your own secure password) +For a release build, use: +```sh +cargo build --release ``` -MYSQL_ROOT_PASSWORD= -MYSQL_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. diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..898319f --- /dev/null +++ b/compose.yml @@ -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/ diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index e1c2e98..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,15 +0,0 @@ -services: - - db: - image: mariadb - restart: always - environment: - MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} - MYSQL_USER: reoserv - MYSQL_DATABASE: reoserv - MYSQL_PASSWORD: ${MYSQL_REOSERV_PASSWORD} - TZ: UTC - ports: - - "3306:3306" - volumes: - - ./db-init/:/docker-entrypoint-initdb.d/