{"id":22620540,"url":"https://github.com/dbrennand/mc-hetzner","last_synced_at":"2025-04-11T15:33:42.738Z","repository":{"id":58656722,"uuid":"532285779","full_name":"dbrennand/mc-hetzner","owner":"dbrennand","description":"Deploy a Minecraft PaperMC server on Hetzner using Terraform and Ansible.","archived":false,"fork":false,"pushed_at":"2023-08-08T07:32:42.000Z","size":27,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T22:39:06.387Z","etag":null,"topics":["ansible","hetzner","hetzner-cloud","mc-hetzner","minecraft","minecraft-server","papermc","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dbrennand.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-03T14:37:20.000Z","updated_at":"2024-12-27T14:42:05.000Z","dependencies_parsed_at":"2023-01-18T23:45:36.140Z","dependency_job_id":null,"html_url":"https://github.com/dbrennand/mc-hetzner","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrennand%2Fmc-hetzner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrennand%2Fmc-hetzner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrennand%2Fmc-hetzner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrennand%2Fmc-hetzner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbrennand","download_url":"https://codeload.github.com/dbrennand/mc-hetzner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248432041,"owners_count":21102305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","hetzner","hetzner-cloud","mc-hetzner","minecraft","minecraft-server","papermc","terraform"],"created_at":"2024-12-08T22:14:16.761Z","updated_at":"2025-04-11T15:33:42.713Z","avatar_url":"https://github.com/dbrennand.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mc-hetzner\n\n![Ansible-Lint](https://github.com/dbrennand/mc-hetzner/actions/workflows/ansible-lint.yml/badge.svg)\n\nDeploy a Minecraft [PaperMC](https://papermc.io/) server on [Hetzner](https://www.hetzner.com/cloud) using [Terraform](https://www.terraform.io/) and [Ansible](https://www.ansible.com/).\n\nThe Minecraft server is deployed as a [container](https://github.com/itzg/docker-minecraft-server) and using [GeyserMC](https://geysermc.org/) and [Floodgate](https://github.com/GeyserMC/Floodgate/), Minecraft Bedrock Edition players can also play on the Java edition server. Optionally, you can also deploy a [container](https://github.com/itzg/docker-mc-backup) to backup the Minecraft server world.\n\nThe default server deployed is [`cx21`](mc-hetzner.tf#L31). See [Hetzner Cloud](https://www.hetzner.com/cloud) for the full list of available server types.\n\n## Prerequisites\n\n* [Terraform](https://www.terraform.io/downloads)\n\n* [Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-and-upgrading-ansible)\n\n* [Hetzner Account](https://accounts.hetzner.com/signUp)\n\n* [Hetzner API Token](https://docs.hetzner.com/cloud/api/getting-started/generating-api-token/)\n\n## Playbook variables\n\n```yaml\nminecraft_image_tag: latest\n```\n\nThe [itzg/minecraft-server](https://github.com/itzg/docker-minecraft-server) container image tag to use. See [itzg/minecraft-server/tags](https://hub.docker.com/r/itzg/minecraft-server/tags) for more available tags.\n\n```yaml\nminecraft_geysermc_download_url: https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/master/lastSuccessfulBuild/artifact/bootstrap/spigot/target/Geyser-Spigot.jar\nminecraft_floodgate_download_url: https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/lastSuccessfulBuild/artifact/spigot/build/libs/floodgate-spigot.jar\n```\n\nThe download URLs for the [GeyserMC](https://geysermc.org/) and [Floodgate](https://github.com/GeyserMC/Floodgate/) plugins. These plugins allow Minecraft Bedrock Edition players to play on a Java edition server.\n\n```yaml\n# All container environment variables can be found at: https://github.com/itzg/docker-minecraft-server#server-configuration\nminecraft_options:\n  # ...\n  # Modify the below variables\n  # https://github.com/itzg/docker-minecraft-server#memory-limit\n  MEMORY: 2500M\n  # https://github.com/itzg/docker-minecraft-server#versions\n  VERSION: LATEST\n  # https://github.com/itzg/docker-minecraft-server#downloadable-world\n  WORLD: http://www.example.com/worlds/MySave.zip\n  # https://github.com/itzg/docker-minecraft-server#server-configuration\n  MOTD: A Minecraft Server created using https://github.com/dbrennand/mc-hetzner\n  # ...\n```\n\nThe environment variables passed to the [itzg/minecraft-server](https://github.com/itzg/docker-minecraft-server) container. These environment variables configure the Minecraft server.\n\n```yaml\nminecraft_backup: false\n```\n\nWhether or not to deploy the [itzg/mc-backup](https://github.com/itzg/docker-mc-backup) container image to backup the Minecraft server world.\n\n```yaml\nminecraft_backup_image_tag: latest\n```\n\nThe [itzg/mc-backup](https://github.com/itzg/docker-mc-backup) container image tag to use. See [itzg/mc-backup/tags](https://hub.docker.com/r/itzg/mc-backup/tags) for more available tags.\n\n```yaml\n# All container environment variables can be found at: https://github.com/itzg/docker-mc-backup#common-variables\nminecraft_backup_options:\n  # ...\n  # Modify the below variables\n  BACKUP_INTERVAL: 24h\n  INITIAL_DELAY: 5m\n  BACKUP_METHOD: restic\n  RESTIC_REPOSITORY: b2:\u003cbucket\u003e\n  # ...\n```\n\nThe environment variables passed to the [itzg/mc-backup](https://github.com/itzg/docker-mc-backup) container. These environment variables configure backups for the Minecraft server world.\n\n## Usage\n\n1. Install the required Ansible roles:\n\n    ```bash\n    ansible-galaxy install -r requirements.yml\n    ```\n\n2. Create the `mc_hetzner` SSH key pair:\n\n   ```bash\n   ssh-keygen -f ~/.ssh/mc_hetzner -t rsa -b 4096 -N \"\"\n   ```\n\n3. Modify the Ansible playbook [vars](vars/main.yml#L24) file to configure the Minecraft server Docker container and backup container.\n\n4. Initialise the [hcloud](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs) Terraform provider:\n\n    ```bash\n    terraform init\n    ```\n\n5. Deploy the server:\n\n   ```bash\n   # Using defaults\n   terraform apply -var=\"hcloud_token=\u003cAPI Token\u003e\"\n   # Example: Overriding the default server_type\n   terraform apply -var=\"hcloud_token=\u003cAPI Token\u003e\" -var=\"server_type=cx31\"\n   ```\n\n6. Enjoy ✨\n\n## FAQs\n\n### How do I reconfigure the Minecraft or Backup container?\n\nLater down the line, you may want to modify the Minecraft server container or backup container's environment variables.\n\nTo re-run the creation of either without running the entire playbook, use the tags as below:\n\n```bash\nansible-playbook -u mc-hetzner -i \"\u003cServer IP\u003e\", --private-key ~/.ssh/mc_hetzner --tags \"minecraft,backup\" mc-hetzner.yml\n```\n\n### How do I whitelist a Minecraft Bedrock Edition player using Floodgate?\n\n```bash\nansible all -u mc-hetzner -i \"\u003cServer IP\u003e\", --private-key ~/.ssh/mc_hetzner -m ansible.builtin.command -a \"docker exec minecraft rcon-cli fwhitelist add \u003cBedrock player name\u003e\"\n```\n\n## How do Minecraft Bedrock Edition players on console connect to the server?\n\nThere are several options for Minecraft Bedrock Edition players on console to connect to the server:\n\n1. Use a CLI application such as [jhead/phantom](https://github.com/jhead/phantom).\n\n2. Use a mobile application such as [MC Server Connector](https://play.google.com/store/apps/details?id=com.smokiem.mcserverconnector\u0026hl=en_GB\u0026gl=US) or [BedrockTogether](https://apps.apple.com/us/app/bedrocktogether/id1534593376)\n\n## Authors \u0026 Contributors\n\n* [**dbrennand**](https://github.com/dbrennand) - *Author*\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbrennand%2Fmc-hetzner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbrennand%2Fmc-hetzner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbrennand%2Fmc-hetzner/lists"}