Set up Juxtaposition servers!

This commit is contained in:
Matthew Lopez
2023-12-21 17:05:42 -05:00
parent d97a00cb3b
commit 4813e74e2b
18 changed files with 329 additions and 13 deletions

View File

@@ -27,16 +27,21 @@ account_aes_key=$(generate_hex 64)
echo "PN_ACT_CONFIG_AES_KEY=$account_aes_key" >>./account.local.env
# Generate master API keys for the account gRPC server
account_api_key_account=$(generate_password 32)
account_api_key_api=$(generate_password 32)
echo "PN_ACT_CONFIG_GRPC_MASTER_API_KEY_ACCOUNT=$account_api_key_account" >>./account.local.env
echo "PN_ACT_CONFIG_GRPC_MASTER_API_KEY_API=$account_api_key_api" >>./account.local.env
echo "PN_FRIENDS_ACCOUNT_GRPC_API_KEY=$account_api_key_account" >>./friends.local.env
# The Juxtaposition UI uses the same API key for both the account and API
# servers, so both keys need to be the same
account_grpc_api_key=$(generate_password 32)
echo "PN_ACT_CONFIG_GRPC_MASTER_API_KEY_ACCOUNT=$account_grpc_api_key" >>./account.local.env
echo "PN_ACT_CONFIG_GRPC_MASTER_API_KEY_API=$account_grpc_api_key" >>./account.local.env
echo "PN_FRIENDS_ACCOUNT_GRPC_API_KEY=$account_grpc_api_key" >>./friends.local.env
echo "PN_MIIVERSE_API_CONFIG_GRPC_ACCOUNT_API_KEY=$account_grpc_api_key" >>./miiverse-api.local.env
echo "JUXT_CONFIG_GRPC_ACCOUNT_API_KEY=$account_grpc_api_key" >>./juxtaposition-ui.local.env
# Generate secret key for MinIO
minio_secret_key=$(generate_password 32)
echo "PN_ACT_CONFIG_S3_ACCESS_SECRET=$minio_secret_key" >>./account.local.env
echo "MINIO_ROOT_PASSWORD=$minio_secret_key" >>./minio.local.env
echo "PN_ACT_CONFIG_S3_ACCESS_SECRET=$minio_secret_key" >>./account.local.env
echo "PN_MIIVERSE_API_CONFIG_S3_ACCESS_SECRET=$minio_secret_key" >>./miiverse-api.local.env
echo "JUXT_CONFIG_AWS_SPACES_SECRET=$minio_secret_key" >>./juxtaposition-ui.local.env
# Generate a password for mongo-express
mongo_express_password=$(generate_password 32)
@@ -53,6 +58,8 @@ echo "PN_FRIENDS_CONFIG_KERBEROS_PASSWORD=$friends_kerberos_password" >>./friend
friends_api_key=$(generate_password 32)
echo "PN_FRIENDS_CONFIG_GRPC_API_KEY=$friends_api_key" >>./friends.local.env
echo "PN_WIIU_CHAT_FRIENDS_GRPC_API_KEY=$friends_api_key" >>./wiiu-chat.local.env
echo "PN_MIIVERSE_API_CONFIG_GRPC_FRIENDS_API_KEY=$friends_api_key" >>./miiverse-api.local.env
echo "JUXT_CONFIG_GRPC_FRIENDS_API_KEY=$friends_api_key" >>./juxtaposition-ui.local.env
friends_aes_key=$(generate_hex 64)
echo "PN_FRIENDS_CONFIG_AES_KEY=$friends_aes_key" >>./friends.local.env
@@ -60,6 +67,11 @@ echo "PN_FRIENDS_CONFIG_AES_KEY=$friends_aes_key" >>./friends.local.env
chat_kerberos_password=$(generate_password 32)
echo "PN_WIIU_CHAT_KERBEROS_PASSWORD=$chat_kerberos_password" >>./wiiu-chat.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
echo "JUXT_CONFIG_AES_KEY=$miiverse_aes_key" >>./juxtaposition-ui.local.env
# Get the computer IP address
printf "What is your computer's IP address? It must be accessible to your consoles: "
read -r computer_ip

View File

@@ -8,11 +8,13 @@ for _ in $(seq 1 64); do
done
git_base=$(git rev-parse --show-toplevel)
necessary_environment="friends miiverse-api wiiu-chat"
. "$git_base/environment/system.local.env"
. "$git_base/environment/friends.env"
. "$git_base/environment/friends.local.env"
. "$git_base/environment/wiiu-chat.env"
. "$git_base/environment/wiiu-chat.local.env"
for environment in $necessary_environment; do
. "$git_base/environment/$environment.env"
. "$git_base/environment/$environment.local.env"
done
docker compose up -d account
@@ -20,8 +22,14 @@ docker compose exec account node /app/dist/create-server-in-database.js reset
docker compose exec account node /app/dist/create-server-in-database.js nex \
"Friend List" "00003200" "0005001010001C00" "$COMPUTER_IP" \
"$PN_FRIENDS_AUTHENTICATION_SERVER_PORT" "prod" "$PN_FRIENDS_CONFIG_AES_KEY"
"$PN_FRIENDS_AUTHENTICATION_SERVER_PORT" "dev" "$PN_FRIENDS_CONFIG_AES_KEY"
docker compose exec account node /app/dist/create-server-in-database.js service \
"Miiverse" "87cd32617f1985439ea608c2746e4610" "000500301001610A" "dev" \
"$PN_MIIVERSE_API_CONFIG_AES_KEY"
# Wii U Chat server doesn't seem to care about the AES key
docker compose exec account node /app/dist/create-server-in-database.js nex \
"Wii U Chat" "1005A000" "000500101005A100" "$COMPUTER_IP" \
"$PN_WIIU_CHAT_AUTHENTICATION_SERVER_PORT" "prod" "$null_aes_key"
"$PN_WIIU_CHAT_AUTHENTICATION_SERVER_PORT" "dev" "$null_aes_key"
# TODO: Script should a PNID's access_level to 3 and server_access_level to dev
# so users can access the servers