Skip to content

Commit

Permalink
Add pikmin 3 env files to scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ItzSwirlz committed Aug 1, 2024
1 parent dfd6423 commit 59c5a34
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 2 deletions.
35 changes: 35 additions & 0 deletions patches/pikmin-3/adjust-docker.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/Dockerfile b/Dockerfile
index 3e08c61..05d9b51 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -9,15 +9,17 @@ 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 \
- go mod download -x
+ --mount=type=bind,source=go.sum,target=go.sum \
+ --mount=type=bind,source=go.mod,target=go.mod \
+ go mod download -x

COPY . .
ARG BUILD_STRING=pretendo.pikmin3.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=:2353", "--headless", "--api-version=2", "--log", "--accept-multiclient", "--continue"]
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" "minecraft-wiiu")
dotenv_files=("friends" "miiverse-api" "wiiu-chat" "super-mario-maker" "splatoon" "minecraft-wiiu" "pikmin-3")
for file in "${dotenv_files[@]}"; do
load_dotenv "$file.env" "$file.local.env"
done
Expand All @@ -23,6 +23,7 @@ run_verbose docker compose exec -e SERVER_IP="$SERVER_IP" \
-e SMM_PORT="$PN_SMM_AUTHENTICATION_SERVER_PORT" \
-e SPLATOON_PORT="$PN_SPLATOON_AUTHENTICATION_SERVER_PORT" \
-e MINECRAFT_PORT="$PN_MINECRAFT_AUTHENTICATION_SERVER_PORT" \
-e PIKMIN3_PORT="$PN_PIKMIN3_AUTHENTICATION_SERVER_PORT" \
account node -e "$create_server_script"

print_success "Account servers database is set up."
2 changes: 1 addition & 1 deletion scripts/run-in-container/postgres-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eu

databases="friends super_mario_maker"
databases="friends super_mario_maker pikmin3"

for database in $databases; do
if [ "$(psql -At -U "$POSTGRES_USER" -c "SELECT 1 FROM pg_database WHERE datname='$database'")" = '' ]; then
Expand Down
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 @@ -100,6 +100,15 @@ async function runAsync() {
1,
"0".repeat(64)
);
await createNexServer(
"Pikmin 3",
"1012BC00",
["0005000E1012BC00", "0005000E1012BD00", "0005000E1012BE00"],
process.env.SERVER_IP,
process.env.PIKMIN3_PORT,
1,
"0".repeat(64)
);
}

runAsync().then(() => {
Expand Down
7 changes: 7 additions & 0 deletions scripts/setup-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ echo "PN_BOSS_CONFIG_GRPC_ACCOUNT_SERVER_API_KEY=$account_grpc_api_key" >>./boss
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
echo "PN_PIKMIN3_ACCOUNT_GRPC_API_KEY=$account_grpc_api_key" >>./pikmin-3.local.env

# Generate a secret key for MinIO
minio_secret_key=$(generate_password 32)
Expand All @@ -101,6 +102,7 @@ postgres_password=$(generate_password 32)
echo "POSTGRES_PASSWORD=$postgres_password" >>./postgres.local.env
echo "PN_FRIENDS_CONFIG_DATABASE_URI=postgres://postgres_pretendo:$postgres_password@postgres/friends?sslmode=disable" >>./friends.local.env
echo "PN_SMM_POSTGRES_URI=postgres://postgres_pretendo:$postgres_password@postgres/super_mario_maker?sslmode=disable" >>./super-mario-maker.local.env
echo "PN_PIKMIN3_POSTGRES_URI=postgres://postgres_pretendo:$postgres_password@postgres/pikmin3?sslmode=disable" >>./pikmin-3.local.env

# Generate passwords, a gRPC API key, and an AES key for the friends server
friends_authentication_password=$(generate_password 32)
Expand Down Expand Up @@ -131,6 +133,10 @@ echo "PN_SPLATOON_KERBEROS_PASSWORD=$splat_kerberos_password" >>./splatoon.local
minecraft_kerberos_password=$(generate_password 32)
echo "PN_MINECRAFT_KERBEROS_PASSWORD=$minecraft_kerberos_password" >>./minecraft-wiiu.local.env

# Generate a Kerberos password for the Pikmin 3 server
pikmin3_kerberos_password=$(generate_password 32)
echo "PN_PIKMIN3_KERBEROS_PASSWORD=$pikmin3_kerberos_password" >>./pikmin-3.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 @@ -148,6 +154,7 @@ 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_PIKMIN3_SECURE_SERVER_HOST=$server_ip" >>./pikmin-3.local.env

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

0 comments on commit 59c5a34

Please sign in to comment.