Skip to content

Declarative MuOnline 0.97k Server on Linux - NixOS + Wine

License

Notifications You must be signed in to change notification settings

r0naldoom/bifrost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bifrost

License: MIT NixOS MuOnline

Declarative MuOnline 0.97k Server on Linux

Run MuOnline private servers without Windows. Configure once, deploy anywhere.

Why Bifrost?

Traditional Setup Bifrost
Windows Server license Linux (free)
Edit .ini files manually services.bifrost.rates.exp = 200;
Manual backups git push (everything is code)
"Works on my machine" Same config = same server
Reinstall everything on crash podman-compose up -d

Features

  • Zero Windows - Runs via Wine on Linux
  • Declarative - NixOS module configures everything
  • Reproducible - Same flake = identical server anywhere
  • Isolated - Podman container, clean system
  • Versioned - Git tracks all configuration

Quick Start

Option 1: Podman (Recommended)

git clone https://github.com/your-user/bifrost
cd bifrost/containers

# Configure
cp .env.example .env
vim .env  # Set your passwords

# Add your MuServer files
cp -r /path/to/MuServer ../blueprint/

# Run
podman-compose up -d

Option 2: NixOS Module

# flake.nix
{
  inputs.bifrost.url = "github:your-user/bifrost";

  outputs = { nixpkgs, bifrost, ... }: {
    nixosConfigurations.my-server = nixpkgs.lib.nixosSystem {
      modules = [
        bifrost.nixosModules.default
        {
          services.bifrost = {
            enable = true;
            serverFiles = ./MuServer;
            database.passwordFile = "/run/secrets/db-pass";

            rates = {
              experience = 100;
              drop = 50;
              zen = 100;
            };

            ports = {
              connectServer = 44405;
              gameServer = 55901;
            };
          };
        }
      ];
    };
  };
}

Then deploy:

nixos-rebuild switch --flake .#my-server

What Gets Configured

When you enable Bifrost, NixOS automatically sets up:

  • Firewall - Opens required ports (44405, 55901, 55990, 55980, 55601/udp)
  • MariaDB - Database with MuOnline schema
  • System User - Dedicated bifrost user
  • Wine Prefix - Configured with vcrun2015 and required DLLs
  • Systemd Services - All 4 servers with proper startup order
MariaDB → DataServer → JoinServer → ConnectServer → GameServer

Configuration Options

services.bifrost = {
  enable = true;

  # Server files location
  serverFiles = ./MuServer;

  # Server identity
  serverName = "My Server";

  # Game rates
  rates = {
    experience = 100;  # 1x
    drop = 50;
    zen = 100;
  };

  # Network
  network.bindAddress = "0.0.0.0";
  ports = {
    connectServer = 44405;
    connectServerUdp = 55601;
    joinServer = 55990;
    dataServer = 55980;
    gameServer = 55901;
  };

  # Database
  database = {
    host = "127.0.0.1";
    port = 3306;
    name = "MuOnline97";
    user = "muonline";
    passwordFile = "/run/secrets/db-password";
  };
};

Ports

Service Port Protocol Description
ConnectServer 44405 TCP Client connection
ConnectServer 55601 UDP Inter-server
JoinServer 55990 TCP Authentication
DataServer 55980 TCP Database proxy
GameServer 55901 TCP Game logic

Project Structure

bifrost/
├── flake.nix              # Entry point
├── modules/
│   ├── bifrost.nix        # Main NixOS module
│   └── database.nix       # MariaDB initialization
├── configs/templates/     # .ini templates
├── scripts/
│   └── init-wineprefix.sh # Wine setup
├── containers/
│   ├── compose.yml        # Podman compose
│   └── Containerfile      # NixOS container
└── blueprint/             # MuServer files (gitignored)

Requirements

  • MuEmu 0.97k files - Server executables (not included)
  • NixOS or Podman - For deployment
  • x86_64 Linux - Wine requirement

Development

# Enter dev shell
nix develop

# Initialize Wine
./scripts/init-wineprefix.sh $PWD/.wine

# Test servers manually
cd blueprint/MuServer/ConnectServer
wine ConnectServer.exe

FAQ

Why Linux instead of Windows?

  • Cost - No Windows Server license needed
  • Stability - Linux servers have better uptime
  • Resources - Lower memory/CPU footprint
  • Automation - Better tooling for DevOps

Why NixOS?

  • Declarative - Entire server defined in one file
  • Reproducible - Same config = same result, always
  • Rollback - Broken update? Revert instantly
  • Atomic - Updates either complete fully or not at all

Does Wine affect performance?

Minimal impact. MuEmu servers are not graphically intensive - they're essentially network services. Wine overhead is negligible for this use case.

Can I run multiple GameServers?

Yes. Define additional ports in your config:

services.bifrost.ports.gameServer = 55901;  # First server
# Add more via systemd service overrides

Where do I get MuServer files?

Bifrost provides the infrastructure, not the game files. You need:

  • MuEmu 0.97k executables (kayito fork recommended)
  • Client files configured to connect to your server

Can I use this with other MuOnline versions?

Currently tested with 0.97k. Other versions may work but are not officially supported. PRs welcome!

How do I update the server?

# Podman
cd containers && podman-compose pull && podman-compose up -d

# NixOS
nix flake update
nixos-rebuild switch --flake .#my-server

Troubleshooting

Server won't start

Check logs:

# Podman
podman logs bifrost-servers

# NixOS
journalctl -u bifrost-dataserver -f

Common causes:

  • Database not ready - wait for MariaDB health check
  • Port already in use - check with ss -tlnp | grep 44405
  • Missing MuServer files - verify blueprint/MuServer/ exists

Database connection failed

# Test connection
mysql -h 127.0.0.1 -u muonline -p MuOnline97

# Check MariaDB status
systemctl status mysql  # NixOS
podman logs bifrost-db  # Podman

Fixes:

  • Verify password in .env or passwordFile
  • Ensure MariaDB started before Wine servers
  • Check if schema was initialized (tables exist)

Wine errors

"wine: could not load kernel32.dll"

# Reinitialize Wine prefix
rm -rf /var/lib/bifrost/.wine
./scripts/init-wineprefix.sh /var/lib/bifrost/.wine

DLL not found:

# Verify DLL overrides
wine reg query 'HKEY_CURRENT_USER\Software\Wine\DllOverrides'

Client can't connect

  1. Check firewall:

    # NixOS - should be automatic
    iptables -L -n | grep 44405
    
    # Manual open
    iptables -A INPUT -p tcp --dport 44405 -j ACCEPT
  2. Verify server is listening:

    ss -tlnp | grep -E '44405|55901'
  3. Check client configuration:

    • Main.exe must point to server IP
    • Port must match ConnectServer (44405)

Container build fails

"nix develop" hangs:

# Clear Nix cache
nix-collect-garbage -d

# Rebuild with verbose
podman build --no-cache -t bifrost-servers .

Out of disk space:

# Clean Podman
podman system prune -a

# Clean Nix
nix-collect-garbage -d

Servers crash on startup

Check Wine compatibility:

# Test individual server
cd blueprint/MuServer/ConnectServer
WINEDEBUG=+all wine ConnectServer.exe 2>&1 | head -100

Verify vcrun2015:

winetricks list-installed | grep vcrun
# Should show: vcrun2015

How to reset everything

# Podman - nuclear option
podman-compose down -v
podman system prune -a
podman-compose up -d --build

# NixOS
systemctl stop bifrost.target
rm -rf /var/lib/bifrost
nixos-rebuild switch --flake .#my-server

Based On

Contributing

Contributions welcome! This is a community project.

  1. Fork the repository
  2. Create your feature branch
  3. Submit a pull request

License

MIT


Bifrost - The bridge between Windows servers and Linux freedom

Releases

No releases published

Packages

 
 
 

Contributors