diff --git a/.gitmodules b/.gitmodules index eece9a0..21539fb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -78,4 +78,10 @@ ignore = dirty path = repos/splatoon url = https://github.com/ashquarky/splatoon branch = master -ignore = dirty \ No newline at end of file +ignore = dirty + +[submodule "repos/minecraft-wiiu"] +path = repos/minecraft-wiiu +url = https://github.com/PretendoNetwork/minecraft-wiiu +branch = master +ignore = dirty diff --git a/compose.yml b/compose.yml index 8bfd52d..d299f4c 100644 --- a/compose.yml +++ b/compose.yml @@ -440,6 +440,25 @@ services: - ./environment/splatoon.env - ./environment/splatoon.local.env + minecraft-wiiu: + build: ./repos/minecraft-wiiu + depends_on: + - account + restart: unless-stopped + ports: + # Go delve debugger + - 127.0.0.1:2352:2350 + # Authentication server + - 6008:6008/udp + # Secure server + - 6009:6009/udp + networks: + internal: + dns: 172.20.0.200 + env_file: + - ./environment/minecraft-wiiu.env + - ./environment/minecraft-wiiu.local.env + volumes: mitmproxy-pretendo-data: mongodb-database: diff --git a/docs/docs/containers.md b/docs/docs/containers.md index 7e94b6d..12784f7 100644 --- a/docs/docs/containers.md +++ b/docs/docs/containers.md @@ -41,3 +41,4 @@ to authenticate with the servers. | Wii U Chat ([authentication](https://github.com/PretendoNetwork/wiiu-chat-authentication) and [secure](https://github.com/PretendoNetwork/wiiu-chat-secure)) | Server for the Wii U Chat app. | | [BOSS](https://github.com/PretendoNetwork/BOSS) | Server for BOSS (SpotPass) content. | | [Super Mario Maker](https://github.com/PretendoNetwork/super-mario-maker) | Server for Super Mario Maker online features. | +| [Minecraft: WiiU edition](https://github.com/PretendoNetwork/minecraft-wiiu) | Server for Minecraft: WiiU Edition online features. ⚠️ **Note:** For safety reasons, **public matchmaking is disabled by default**. You can enable it by setting the environment variable `PN_MINECRAFT_ALLOW_PUBLIC_MATCHMAKING ` to 1 in the `environment/minecraft-wiiu.env` file. diff --git a/environment/minecraft-wiiu.env b/environment/minecraft-wiiu.env new file mode 100644 index 0000000..b1a5e5a --- /dev/null +++ b/environment/minecraft-wiiu.env @@ -0,0 +1,5 @@ +PN_MINECRAFT_AUTHENTICATION_SERVER_PORT=6008 +PN_MINECRAFT_SECURE_SERVER_PORT=6009 +PN_MINECRAFT_ACCOUNT_GRPC_HOST=account +PN_MINECRAFT_ACCOUNT_GRPC_PORT=5000 +PN_MINECRAFT_ALLOW_PUBLIC_MATCHMAKING=0 diff --git a/patches/minecraft-wiiu/adjust-docker.patch b/patches/minecraft-wiiu/adjust-docker.patch new file mode 100644 index 0000000..e5d958d --- /dev/null +++ b/patches/minecraft-wiiu/adjust-docker.patch @@ -0,0 +1,32 @@ +diff --git a/Dockerfile b/Dockerfile +index 94effb5..902eb1e 100644 +--- a/Dockerfile ++++ b/Dockerfile +@@ -9,6 +9,8 @@ ARG app_dir + + WORKDIR ${app_dir} + ++RUN go install github.com/go-delve/delve/cmd/dlv@latest ++ + RUN --mount=type=cache,target=/go/pkg/mod/ \ + --mount=type=bind,source=go.sum,target=go.sum \ + --mount=type=bind,source=go.mod,target=go.mod \ +@@ -17,7 +19,7 @@ RUN --mount=type=cache,target=/go/pkg/mod/ \ + COPY . . + ARG BUILD_STRING=pretendo.minecraftwiiu.docker + RUN --mount=type=cache,target=/go/pkg/mod/ \ +- CGO_ENABLED=0 go build -ldflags "-X 'main.serverBuildString=${BUILD_STRING}'" -v -o ${app_dir}/build/server ++ CGO_ENABLED=0 go build -ldflags "-X 'main.serverBuildString=${BUILD_STRING}'" -v -o ${app_dir}/build/server -gcflags "all=-N -l" + + + # * Running the final application +@@ -31,6 +33,7 @@ RUN mkdir -p ${app_dir}/log && chown go:go ${app_dir}/log + + USER go + ++COPY --from=build /go/bin/dlv ${app_dir}/dlv + COPY --from=build ${app_dir}/build/server ${app_dir}/server + +-CMD [ "./server" ] ++CMD ["./dlv", "exec", "./server", "--listen=:2348", "--headless", "--api-version=2", "--log", "--accept-multiclient", "--continue"] +\ No newline at end of file diff --git a/repos/minecraft-wiiu b/repos/minecraft-wiiu new file mode 160000 index 0000000..8a30e47 --- /dev/null +++ b/repos/minecraft-wiiu @@ -0,0 +1 @@ +Subproject commit 8a30e4728126a5b3d9fafa440eb6b04e658f7f16 diff --git a/scripts/internal/update-account-servers-database.sh b/scripts/internal/update-account-servers-database.sh index d7539cd..04de241 100755 --- a/scripts/internal/update-account-servers-database.sh +++ b/scripts/internal/update-account-servers-database.sh @@ -7,7 +7,7 @@ parse_arguments "$@" print_info "Setting up Pretendo account servers database..." load_dotenv .env -dotenv_files=("friends" "miiverse-api" "wiiu-chat" "super-mario-maker" "splatoon") +dotenv_files=("friends" "miiverse-api" "wiiu-chat" "super-mario-maker" "splatoon" "minecraft-wiiu") for file in "${dotenv_files[@]}"; do load_dotenv "$file.env" "$file.local.env" done @@ -22,6 +22,7 @@ run_verbose docker compose exec -e SERVER_IP="$SERVER_IP" \ -e WIIU_CHAT_PORT="$PN_WIIU_CHAT_AUTHENTICATION_SERVER_PORT" \ -e SMM_PORT="$PN_SMM_AUTHENTICATION_SERVER_PORT" \ -e SPLATOON_PORT="$PN_SPLATOON_AUTHENTICATION_SERVER_PORT" \ + -e MINECRAFT_PORT="$PN_MINECRAFT_AUTHENTICATION_SERVER_PORT" \ account node -e "$create_server_script" print_success "Account servers database is set up." diff --git a/scripts/run-in-container/update-account-servers-database.js b/scripts/run-in-container/update-account-servers-database.js index eaa2532..e599632 100644 --- a/scripts/run-in-container/update-account-servers-database.js +++ b/scripts/run-in-container/update-account-servers-database.js @@ -92,6 +92,15 @@ async function runAsync() { 1, "0".repeat(64) ); + await createNexServer( + "Minecraft", + "101D9D00", + ["0005000E101D9D00", "0005000E101DBE00", "00050000101D7500"], + process.env.SERVER_IP, + process.env.MINECRAFT_PORT, + 1, + "0".repeat(64) + ); await mongoose.connection.close(); } diff --git a/scripts/setup-environment.sh b/scripts/setup-environment.sh index f262b85..7c46523 100755 --- a/scripts/setup-environment.sh +++ b/scripts/setup-environment.sh @@ -85,6 +85,7 @@ echo "JUXT_CONFIG_GRPC_ACCOUNT_API_KEY=$account_grpc_api_key" >>./juxtaposition- echo "PN_BOSS_CONFIG_GRPC_ACCOUNT_SERVER_API_KEY=$account_grpc_api_key" >>./boss.local.env echo "PN_SMM_ACCOUNT_GRPC_API_KEY=$account_grpc_api_key" >>./super-mario-maker.local.env echo "PN_SPLATOON_ACCOUNT_GRPC_API_KEY=$account_grpc_api_key" >>./splatoon.local.env +echo "PN_MINECRAFT_ACCOUNT_GRPC_API_KEY=$account_grpc_api_key" >>./minecraft-wiiu.local.env # Generate a secret key for MinIO minio_secret_key=$(generate_password 32) @@ -127,6 +128,9 @@ echo "PN_SMM_KERBEROS_PASSWORD=$smm_kerberos_password" >>./super-mario-maker.loc splat_kerberos_password=$(generate_password 32) echo "PN_SPLATOON_KERBEROS_PASSWORD=$splat_kerberos_password" >>./splatoon.local.env +minecraft_kerberos_password=$(generate_password 32) +echo "PN_MINECRAFT_KERBEROS_PASSWORD=$minecraft_kerberos_password" >>./minecraft-wiiu.local.env + # Generate an AES key for the Miiverse servers miiverse_aes_key=$(generate_hex 64) echo "PN_MIIVERSE_API_CONFIG_AES_KEY=$miiverse_aes_key" >>./miiverse-api.local.env @@ -143,6 +147,7 @@ echo "PN_FRIENDS_SECURE_SERVER_HOST=$server_ip" >>./friends.local.env echo "PN_WIIU_CHAT_SECURE_SERVER_LOCATION=$server_ip" >>./wiiu-chat.local.env echo "PN_SMM_SECURE_SERVER_HOST=$server_ip" >>./super-mario-maker.local.env echo "PN_SPLATOON_SECURE_SERVER_HOST=$server_ip" >>./splatoon.local.env +echo "PN_MINECRAFT_SECURE_SERVER_HOST=$server_ip" >>./minecraft-wiiu.local.env # Get the Wii U IP address if [[ -n "$wiiu_ip" ]]; then