Create internal directory for scripts

This commit is contained in:
Matthew Lopez 2024-05-03 13:17:36 +00:00 committed by GitHub
parent 06c89a4920
commit 826c52d706
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 24 additions and 32 deletions

View File

@ -3,6 +3,7 @@
These are important scripts that are used for container setup and administration. Here is a list of each one and what it
does.
- `internal/`: These scripts are consider internal and are run by other scripts.
- `run-in-container/`: These are scripts that, as the name suggests, are run inside containers. They should not be run
directly, but rather through the other scripts.
- `backup.sh [backup_name]`: This backs up MongoDB, PostgreSQL, MinIO, Redis, and mitmproxy data to the `backups`
@ -14,8 +15,6 @@ does.
This creates a community in Juxtaposition, which is required before posting anything. Specify a name, description, and
linked title IDs, and optionally set a custom icon and banner image. It should be run once for each community you want
to create.
- `firstrun-*.sh`: These are scripts that are run on the first run of certain containers. They are run automatically by
the main setup script and shouldn't be used after that.
- `get-boss-keys.sh [--write]`: This validates the BOSS keys from the dumped key files in `console-files`. Run with
`--write` to validate the keys and write them to the BOSS server environment variables file.
- `make-pnid-dev.sh <PNID to give developer access>`: This sets the access level of a PNID to developer, which gives it
@ -30,12 +29,5 @@ does.
updated and new servers are added or if the server or Wii U IP addresses change.
- `setup-submodule-patches.sh`: This sets up the various submodules in`repos` and applies patches to them. It should
also be run whenever this repository is updated and new servers are added.
- `update-account-servers-database.sh`: This updates the database of account servers. It should be run whenever a new
account server is added to this repository or the server IP address changes, and it is automatically run by
`setup-environment.sh`.
- `update-miiverse-endpoints.sh`: This updates the Miiverse endpoints for the discovery API server. It currently uses
hard-coded values, so it should not be neccesary to run it again.
- `update-postgres-password.sh`: This updates the password for the PostgreSQL database. It should be run whenever the
password is regenerated, and it is automatically run by `setup-environment.sh`.
- `upload-3ds-files.sh [--reset]`: This uploads required files from `/console-files` to your 3DS to help with connection
setup. Run with `--reset` to reset the Juxt certificate to Pretendo's official certificate.

View File

@ -3,7 +3,7 @@
set -eu
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
backup_name="${1-}"
if [ -z "$backup_name" ]; then

View File

@ -8,7 +8,7 @@ if [ "${1-}" = "--reset" ]; then
fi
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
if [ ! -f "$git_base/environment/system.local.env" ]; then
error "Missing environment file system.local.env. Did you run setup-environment.sh?"

View File

@ -3,7 +3,7 @@
set -eu
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
create_community_script=$(cat "$git_base/scripts/run-in-container/create-juxt-community.js")
if [ "$#" -lt 3 ]; then

View File

@ -12,7 +12,7 @@ expected_wiiu_aes_key_hash="5202ce5099232c3d365e28379790a919"
expected_wiiu_hmac_key_hash="b4482fef177b0100090ce0dbeb8ce977"
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
cd "$git_base/console-files"
if ls ./boss_keys.bin 1>/dev/null 2>&1; then

View File

@ -3,7 +3,7 @@
set -eu
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
minio_init_script=$(cat "$git_base/scripts/run-in-container/minio-init.sh")
docker compose up -d minio

View File

@ -3,7 +3,7 @@
set -eu
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
mongodb_init_script=$(cat "$git_base/scripts/run-in-container/mongodb-init.js")
docker compose up -d mongodb

View File

@ -3,7 +3,7 @@
set -eu
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
create_server_script=$(cat "$git_base/scripts/run-in-container/update-account-servers-database.js")
if [ ! -f "$git_base/environment/system.local.env" ]; then

View File

@ -3,7 +3,7 @@
set -eu
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
create_endpoint_script=$(cat "$git_base/scripts/run-in-container/update-miiverse-endpoints.js")
docker compose up -d miiverse-api

View File

@ -3,7 +3,7 @@
set -eu
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
if [ ! -f "$git_base/environment/postgres.local.env" ]; then
error "Missing environment file postgres.local.env. Did you run setup-environment.sh?"
exit 1

View File

@ -3,7 +3,7 @@
set -eu
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
update_pnid_access_level_script=$(cat "$git_base/scripts/run-in-container/make-pnid-dev.js")
if [ "$#" -lt 1 ]; then

View File

@ -3,7 +3,7 @@
set -eu
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
if [ -z "${1-}" ]; then
echo "Usage: $0 <backup_name>"
@ -60,6 +60,6 @@ docker compose cp "$backup_dir/mitmproxy" mitmproxy-pretendo:/home/mitmproxy/.mi
# The restored Postgres backup might be using a different password than what is currently in the .env files
info "Updating the Postgres password from the environment..."
"$git_base/scripts/update-postgres-password.sh"
"$git_base/scripts/internal/update-postgres-password.sh"
success "Restore completed successfully."

View File

@ -28,7 +28,7 @@ if [ "$#" -ge 3 ]; then
fi
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
cd "$git_base/environment"
info "Setting up local environment variables..."
@ -157,8 +157,8 @@ success "Successfully set up environment."
# set won't be configured during initial setup, and the scripts will fail.
if [ -z "${PRETENDO_SETUP_IN_PROGRESS+x}" ]; then
info "Running necessary container update scripts..."
"$git_base"/scripts/update-postgres-password.sh
"$git_base"/scripts/update-account-servers-database.sh
"$git_base"/scripts/internal/update-postgres-password.sh
"$git_base"/scripts/internal/update-account-servers-database.sh
docker compose down
success "Successfully updated containers with new environment variables."
fi

View File

@ -3,7 +3,7 @@
set -eu
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
info "Resetting all submodules..."
git submodule sync --recursive >/dev/null

View File

@ -8,7 +8,7 @@ if [ "${1-}" = "--reset" ]; then
fi
git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
cd "$git_base"
if [ ! -f "$git_base/environment/system.local.env" ]; then

View File

@ -85,15 +85,15 @@ setup_environment_variables() {
setup_containers() {
info "Setting up MongoDB container..."
./scripts/firstrun-mongodb-container.sh
./scripts/internal/firstrun-mongodb-container.sh
info "Setting up MinIO container..."
./scripts/firstrun-minio-container.sh
./scripts/internal/firstrun-minio-container.sh
info "Setting up Pretendo account servers database..."
./scripts/update-account-servers-database.sh
./scripts/internal/update-account-servers-database.sh
info "Setting up Pretendo Miiverse endpoints database..."
./scripts/update-miiverse-endpoints.sh
./scripts/internal/update-miiverse-endpoints.sh
info "Updating Postgres password..."
./scripts/update-postgres-password.sh
./scripts/internal/update-postgres-password.sh
info "Stopping containers after initial setup..."
docker compose down
}
@ -104,7 +104,7 @@ check_git_repository
git_base=$(git rev-parse --show-toplevel)
cd "$git_base"
. "$git_base/scripts/.function-lib.sh"
. "$git_base/scripts/internal/function-lib.sh"
title "Unofficial Pretendo Network setup script"
header "Pretendo setup script started at $(date)."