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 2 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. ⚠️ By default Minigame's public matchmaking is disable by default. You can enable it by modifying the env variable `PN_MINECRAFT_ALLOW_PUBLIC_MATCHMAKING ` to 1 in the `environment/minecraft-wiiu.local.env` environment file.
MatthewL246 marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions environment/minecraft-wiiu.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PN_MINECRAFT_AUTHENTICATION_SERVER_PORT=6008
PN_MINECRAFT_SECURE_SERVER_PORT=6009
PN_MINECRAFT_ACCOUNT_GRPC_HOST=account
PN_MINECRAFT_ACCOUNT_GRPC_PORT=5000
66 changes: 66 additions & 0 deletions patches/minecraft-wiiu/0001-Adjust-DockerFile.patch
MatthewL246 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From e053d94edf86d8bef03218bffe71c7590f7d4f56 Mon Sep 17 00:00:00 2001
From: redmine4404 <[email protected]>
Date: Sun, 28 Jul 2024 14:45:46 +0200
Subject: [PATCH] Adjust DockerFile

---
Dockerfile | 34 +++++++++++++---------------------
1 file changed, 13 insertions(+), 21 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 94effb5..2f48967 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,36 +1,28 @@
# syntax=docker/dockerfile:1

-ARG app_dir="/home/go/app"
-
-
# * Building the application
-FROM golang:1.22-alpine3.20 AS build
-ARG app_dir
+FROM golang:1.22-alpine3.20 AS builder
+WORKDIR /build

-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 \
- go mod download -x
+COPY go.* ./
+RUN go mod download

-COPY . .
+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 /build/server
+


# * Running the final application
FROM alpine:3.20 AS final
-ARG app_dir
-WORKDIR ${app_dir}
-
-RUN addgroup go && adduser -D -G go go
-
-RUN mkdir -p ${app_dir}/log && chown go:go ${app_dir}/log
+WORKDIR /app

-USER go
+RUN mkdir -p /app/log

-COPY --from=build ${app_dir}/build/server ${app_dir}/server
+COPY --from=builder /build/server /app/server
+COPY --from=builder /go/bin/dlv /app/

-CMD [ "./server" ]
+CMD ["/app/dlv", "exec", "/app/server", "--listen=:2350", "--headless", "--api-version=2", "--log", "--accept-multiclient", "--continue"]
--
2.45.2

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
8 changes: 8 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,10 @@ 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

echo "PN_MINECRAFT_ALLOW_PUBLIC_MATCHMAKING=0" >>./minecraft-wiiu.local.env
echo "# 0 = disable, 1 = enable" >>./minecraft-wiiu.local.env
MatthewL246 marked this conversation as resolved.
Show resolved Hide resolved

# Get the Wii U IP address
if [[ -n "$wiiu_ip" ]]; then
Expand Down