Skip to content

Minecraft Forge server configuration that I set up for my friends :)

License

Notifications You must be signed in to change notification settings

jfreedman0212/mc-forge-server

Repository files navigation

Minecraft Forge Server

This is a Minecraft Forge server that's running some mods and hosted on Fly.io for my friends. The repo has a couple uses that facilitate the server setup:

  1. It lowers the likelihood of these files being lost if I accidentally delete or modify them in a way that
  2. It acts as a central repository for documentation (both as a user and as an admin)
  3. It lets me automate the config and deployment with GitHub Actions

The crux of this setup comes from Geoff Bourne's Minecraft Server Docker image, which is SUPER helpful for getting this up and running. If you're thinking of setting up your own server, I highly recommend using this!

Connecting to the Server as a User

General Server Info

  • URL: gay-minecraft.fly.dev
  • Minecraft version: 1.20.1
  • Mod manager: Forge
  • Forge version: 47.3.0

If you aren't allowed, message me your username to add you to the whitelist.

Curseforge Instructions

  1. Download the modpack
  2. In Curseforge, create a "new modpack", hit "Import", and select the zip file you just downloaded
  3. If asked for the versions, enter the data in the General Server Info section
  4. Connect to the server!

Manual Instructions

If you don't use Curseforge or some other mod manager, you'll need to do it manually. Also these instructions are for Linux and Mac and assume some familiarity with the terminal.

  1. Download Minecraft Java edition and run the launcher at least once (this creates the ~/.minecraft folder)
  2. Install the right version of Forge from the website
  • This downloads a JAR file, which you will run using java -jar forge_installer.jar. Worked using Java 11 for me, but YMMV.
  1. Download the "server" version of the modpack
  • Why the server version? Because it already has all the mod JAR files installed.
  1. In your ~/.minecraft folder, create a mods folder
  2. Unzip the contents of the server modpack into the new mods folder
  3. Run the Minecraft launcher as normal and select "Forge" from the dropdown
  4. Connect to the server!

Server Administration

Dedicated IPv4 on Fly.io

Since Minecraft uses raw TCP w/o TLS, you'll need a dedicated IPv4 address. As of writing, it costs $2/month and you can request one by running:

fly ips allocate-v4

Here are the Fly docs on it.

External Repository Configuration

There are 3 variables that get configured in GitHub for use in the Actions workflow:

  • FLY_API_TOKEN: Fly.io API token for the gay-minecraft app
  • RELEASE_TOKEN: GitHub personal access token
  • HAS_OVERRIDES_FOLDER: set to true if the modpack/overrides folder exists, otherwise set to false

The first two are secrets since they're credentials for other systems. The last one is just a regular variable.

The RELEASE_TOKEN needs read-only "Metadata" permissions and read/write "Contents" permissions. Just configure it for this repo, not all of them!

Making Configuration Changes

All configuration (except for the datapacks, more on those later) are defined in this repository. If people are on the server and you want to make minor changes (like adding someone to the allowlist), you may do that through RCON commands. That way, the server doesn't have to be restarted and affect your players. However, here's how to make longer lasting changes:

  1. Make your changes in the repo:
  • fly.toml for general server config (this includes RCON commands for gamerules)
  • ops.json to change who the admins are
  • whitelist.json to change who's allowed to log into the server
  • .github/workflows/release.yml if you want to change the release process
  1. Make your commit, tag it, and push it
  • For some reason, I'm using semantic versioning but only updating the patch version?

That will kick off the Actions workflow and deploy the server. Check up on it to make sure it successfully restarted. As of 10/30/2024, I've had to manually start it each release for some reason... TODO: fix that.

Triggering a new release is critical for changes to take effect! That's because the server looks for the latest release for all the config files. You may delete old releases as they're no longer needed. It might be useful to keep older versions of the modpacks around if those change.

Adding Users to Allowlist or Ops

Get the person's username and enter it into mcuuid.net. I like to have both the username and the UUID to be completely sure I'm only allowing my friends.

Installing Datapacks

There's not an option in the Docker configuration (at least when I initially set it up in Summer 2023) to set up datapacks from a zip file. So, I've manually installed them through SFTP. This doesn't require a server restart in most cases. TODO: make this a more comprehensive, step-by-step guide.

About

Minecraft Forge server configuration that I set up for my friends :)

Resources

License

Stars

Watchers

Forks