Start setting up the account server

This is about the minimum required to make the account server start. It doesn't fully work yet.
This commit is contained in:
Matthew Lopez
2023-12-17 14:39:20 -05:00
parent 3b62284d33
commit 79a8b81bab
14 changed files with 364 additions and 1 deletions

27
scripts/setup-environment.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/sh
set -eu
echo "Setting up local environment variables..."
rm environment/*.local.env || true
# Generate an AES-256-CBC key for account server tokens
account_aes_key=$(openssl rand -hex 32)
echo "PN_ACT_CONFIG_AES_KEY=$account_aes_key" >>./environment/account.local.env
# Generate master API keys for the account gRPC server
account_api_key_account=$(openssl rand -base64 32)
account_api_key_api=$(openssl rand -base64 32)
echo "PN_ACT_CONFIG_GRPC_MASTER_API_KEY_ACCOUNT=$account_api_key_account" >>./environment/account.local.env
echo "PN_ACT_CONFIG_GRPC_MASTER_API_KEY_API=$account_api_key_api" >>./environment/account.local.env
# Generate access and secret keys for MinIO
minio_access_key=$(openssl rand -base64 32)
echo "PN_ACT_CONFIG_S3_ACCESS_KEY=$minio_access_key" >>./environment/account.local.env
echo "MINIO_ACCESS_KEY=$minio_access_key" >>./environment/minio.local.env
minio_secret_key=$(openssl rand -base64 32)
echo "PN_ACT_CONFIG_S3_ACCESS_SECRET=$minio_secret_key" >>./environment/account.local.env
echo "MINIO_SECRET_KEY=$minio_secret_key" >>./environment/minio.local.env
echo "Successfully set up environment."

View File

@@ -0,0 +1,27 @@
#!/bin/sh
set -eu
echo "Resetting all submodules..."
git submodule sync --recursive
git submodule foreach --recursive "git reset --hard"
git submodule update --init --recursive --checkout --force
git_base=$(git rev-parse --show-toplevel)
echo "Applying patches..."
num_patches=0
for dir in "$git_base/patches/"*; do
if [ -d "$dir" ]; then
subdir=$(basename "$dir")
cd "$git_base/repos/$subdir"
for patch in "$git_base/patches/$subdir"/*; do
echo "Applying patch $patch..."
git apply "$patch" -v
num_patches=$((num_patches + 1))
done
fi
done
echo "Successfully applied $num_patches patches."