Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Minecraft Server #102

Merged
merged 4 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,10 @@ ignore = dirty
path = repos/splatoon
url = https://github.com/ashquarky/splatoon
branch = master
ignore = dirty
ignore = dirty

[submodule "repos/minecraft-wiiu"]
path = repos/minecraft-wiiu
url = https://github.com/PretendoNetwork/minecraft-wiiu
branch = master
ignore = dirty
19 changes: 19 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
MatthewL246 marked this conversation as resolved.
Show resolved Hide resolved
# 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:
Expand Down
1 change: 1 addition & 0 deletions docs/docs/containers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
5 changes: 5 additions & 0 deletions environment/minecraft-wiiu.env
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions patches/minecraft-wiiu/adjust-docker.patch
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions repos/minecraft-wiiu
Submodule minecraft-wiiu added at 8a30e4
3 changes: 2 additions & 1 deletion scripts/internal/update-account-servers-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."
9 changes: 9 additions & 0 deletions scripts/run-in-container/update-account-servers-database.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
5 changes: 5 additions & 0 deletions scripts/setup-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down