serverwiz
A tool made for installing, updating and running modded Minecraft servers using
Packwiz.
Installing
You can use Serverwiz either using the command, which is installed using Go,
or using docker.
Go
First make sure you have golang installed on your system. If not, install it
using your system's package manager.
Next, you can simply install Serverwiz using the following command:
go install codeberg.org/lizzybruls/serverwiz
Docker
When using the docker image, make sure of the following points:
- Use the
https://codeberg.org/lizzybruls/serverwiz:latest image
- Use the
--user "$(id -u):$(id -g)" flag. This makes sure the output files
are owned by your user instead of root.
- Mount the desired output directory to /mount using a volume.
- If you use a local repository, mount it to /input.
- To change other variables, you can use use environment variables as specified
below in the
Environment variables section.
Example usage:
docker run --user "$(id -u):$(id -g)" -v ./local_repo:/input -v ./server:/output -e SERVERWIZ_PACKWIZSUBDIR=fabric https://codeberg.org/lizzybruls/serverwiz:latest
Usage
To run Serverwiz, simply run the serverwiz command and use the command flags
to configure what settings to use.
Use serverwiz --help to view the possible flags and what they do.
Examples
Example usage for local repository:
serverwiz --packwizRepo {path_to_local_repository}
Example usage for remote repository:
serverwiz --packwizRepo {URL_of_remote_repository} --isLocal false
Secrets
Serverwiz can inject secrets into files in your Packwiz repository, so you can
specify sensitive variables when running the server instead of having them be
stored on the repository. To do this, you can replace the secret you want to
obscure with an environment variable like this: ${DISCORD_BOT_TOKEN}.
The variable must be in full caps.
You can now set the environment variable DISCORD_BOT_TOKEN on the environment
running Serverwiz to what you want ${DISCORD_BOT_TOKEN} to be replaced with
and Serverwiz will replace it.
Configuration
Alternatively to the command flags, you can also configure Serverwiz through
environment variables or it's config file.
The priority of these different configuration methods is:
flags --> environment variables --> config file
Environment variables
The following environment variables can be changed:
- SERVERWIZ_CONFIG - Config file location
- SERVERWIZ_ISREMOTE - Set to true if the packwiz repo is remote
- SERVERWIZ_PACKWIZREPO - Either the location of a local repository or the URL
of a remote git repo, depending on the ISLOCAL setting
- SERVERWIZ_PACKWIZSUBDIR - The location of the packwiz project within the set repo
- SERVERWIZ_OUTPUTDIR - Directory used as the output
- SERVERWIZ_REPOSITORYDIR - Directory the repo gets cloned to as working directory
- SERVERWIZ_LIBRARYDIR - Directory used for library files
- SERVERWIZ_PACKWIZINSTALLERBOOTSTRAPJAR - The location of the packwiz-installer-bootstrap.jar;
This is the executable for installing the Packwiz modpack
- SERVERWIZ_SECRETPATTERN - The regex pattern used for secret population
- SERVERWIZ_FABRICAPIURL - Base URL for downloading Fabric; Default is "https://meta.fabricmc.net/v2"
- SERVERWIZ_NEOFORGEAPIURL - Base URL for downloading Neoforge; Default is "https://maven.neoforged.net"
Config file
To use the config file, edit the serverwiz.toml file. By default this is
located at $HOME/.config/serverwiz/serverwiz.toml, but this can be changed
using the --config flag.
The config file could look something like this:
isLocal = false
outputDir = "./minecraft_server"
Building
Prerequisites
If you have Mise, run the commands listed below, if not, install go using
your package manager.
mise trust
mise install
Next, install the required Go packages:
go install
Build & run
To build the project, run the following command. This will output a serverwiz
file, which is executable.
go build
Alternatively, you can build & run at the same time using the following command:
go run .