Server hosting a game of Battle of the Centerländ.
  • Rust 99.3%
  • Shell 0.7%
Find a file
Chunquan Cheng 8358ec5ee2 Merge branch '61-update-readme' into 'dev'
Resolve "Update README"

Closes #61

See merge request softwaregrundprojekt/2022-2023/gruppenprojekt/group-03/server-03!49
2023-07-04 13:43:43 +00:00
src Ai trainer hangs during game execution 2023-06-28 17:21:05 +00:00
.gitignore Resolve "dont offer cards to dead players" 2023-06-17 20:00:10 +00:00
.gitlab-ci.yml Resolve "Update README" 2023-07-04 13:43:43 +00:00
APKBUILD Resolve "Make Container Available" 2023-05-13 15:48:30 +00:00
apko.yaml Resolve "Fix Wrong CI Path For Container Build" 2023-05-15 04:21:59 +00:00
Cargo.lock Resolve "Release 1.0.0" 2023-07-04 11:55:11 +00:00
Cargo.toml Resolve "Release 1.0.0" 2023-07-04 11:55:11 +00:00
LICENSE feat: initial commit 2023-03-24 18:57:26 +01:00
README.md Resolve "Update README" 2023-07-04 13:43:43 +00:00

server

Server hosting a game of Battle of the Centerländ.

Usage

The server takes the following arguments:

Short Long Environment Description Default
-p --port PORT Port to listen on 3018
-b --board-config BOARD_CONFIG Path to board configuration /var/lib/app/config/board.json
-g --game-config BOARD_CONFIG Path to game configuration /var/lib/app/config/game.json
-l --log-level LOG_LEVEL Logging level, one of trace, debug, info, warn or error info

Run server --help to see the full help message.

Podman/Docker

To run the AI via Podman or Docker, use

podman run \
-v <path to board config>:/var/lib/app/config/board.json
-v <path to game config>:/var/lib/app/config/game.json
gitlab.uni-ulm.de:5050/softwaregrundprojekt/2022-2023/gruppenprojekt/group-03/server-03

This will:

  • listen on port 3018
  • load the game and board configuration mounted into the container via the specified volumes
  • output logging information at least on level info

Note: You might need to log in first:

podman login -u <username> -p <access token> gitlab.uni-ulm.de:5050

Build

Prerequisites

Everything can be installed with rustup:

# Update rustup's information.
rustup update

# Install the stable Rust toolchain (if not already present).
rustup toolchain add stable

# Add rustfmt.
rustup component add rustfmt

# Add clippy.
rustup component add clippy

Building

To run the binary:

cargo run

To build a debug binary:

cargo build

The resulting binary will be under target/debug/server.

To build the binary in release mode:

cargo build --release

The resulting binary will be under target/release/server.

Testing

Code Formatting

This should not output anything when the code is formatted corretcly:

cargo fmt --check

Run the following to automatically format the Rust code:

cargo fmt

Code Analysis

Run the following to check the code for common mistakes:

cargo clippy

Tests

Run tests with the following:

cargo test