Skip to content

Commit c693542

Browse files
committed
add more configuration options for container
1 parent e48f2fb commit c693542

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,36 @@ Type `auth login device` in the container terminal and follow the instructions t
4545

4646
I recommend running `auth persistence Encrypted` within the container to ensure that your authentication tokens are saved securely and persist across container restarts. Make sure to reauthenticate after running this command to store the tokens.
4747

48+
## Configuration
49+
50+
The following environment variables can be used to configure the Hytale server:
51+
52+
| Variable | Default | Description |
53+
| ------------------------------ | -------------------- | ------------------------------------------- |
54+
| `HYTALE_MINIMUM_MEMORY` | `128M` | Minimum memory allocation for the JVM |
55+
| `HYTALE_MAXIMUM_MEMORY` | 90% of system memory | Maximum memory allocation for the JVM |
56+
| `HYTALE_SERVER_PORT` | `5520` | Port the server binds to |
57+
| `HYTALE_PARAMETERS` | _(see below)_ | Override all JVM/server parameters |
58+
| `HYTALE_ADDITIONAL_PARAMETERS` | _(none)_ | Append additional parameters to the default |
59+
60+
### Example with Custom Memory Settings
61+
62+
```yaml
63+
services:
64+
hytale:
65+
image: ghcr.io/zuedev/hytale-server-docker
66+
ports:
67+
- "5520:5520/udp"
68+
volumes:
69+
- ./data:/app/Hytale
70+
environment:
71+
- HYTALE_MINIMUM_MEMORY=512M
72+
- HYTALE_MAXIMUM_MEMORY=4096M
73+
restart: unless-stopped
74+
stdin_open: true
75+
tty: true
76+
```
77+
4878
## Legal
4979
5080
This project is not affiliated with or endorsed by Hypixel Studios. Hytale and all related trademarks are the property of their respective owners. This project is intended for educational and personal use only.

entrypoint.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
#!/bin/sh
22

3+
# Extract total memory in MB
4+
SYSTEM_TOTAL_MEMORY=$(free -m | awk '/^Mem:/ {print $2}')
5+
SYSTEM_TOTAL_MEMORY=${SYSTEM_TOTAL_MEMORY:-4096} # fallback to 4GB if free command fails
6+
7+
# Set minimum memory to 128M if not specified
8+
HYTALE_MINIMUM_MEMORY=${HYTALE_MINIMUM_MEMORY:-128M}
9+
10+
# Set maximum memory to 90% of total system memory if not specified
11+
HYTALE_MAXIMUM_MEMORY=${HYTALE_MAXIMUM_MEMORY:-$(($SYSTEM_TOTAL_MEMORY * 90 / 100))M}
12+
13+
# Set default server port if not specified
14+
HYTALE_SERVER_PORT=${HYTALE_SERVER_PORT:-5520}
15+
316
# set default parameters for Hytale server
4-
HYTALE_PARAMETERS=${HYTALE_PARAMETERS:-"-jar /app/Hytale/Server/HytaleServer.jar --assets /app/Hytale/Assets.zip"}
17+
HYTALE_PARAMETERS=${HYTALE_PARAMETERS:-"-XX:AOTCache=/app/Hytale/Server/HytaleServer.aot -Xms${HYTALE_MINIMUM_MEMORY} -Xmx${HYTALE_MAXIMUM_MEMORY} -jar /app/Hytale/Server/HytaleServer.jar --assets /app/Hytale/Assets.zip --bind 0.0.0.0:${HYTALE_SERVER_PORT}"}
518

619
# do we have any additional parameters to append?
720
if [ ! -z "$HYTALE_ADDITIONAL_PARAMETERS" ]; then

0 commit comments

Comments
 (0)