-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from worldcoin/POP-1707/load-default-configs-f…
…rom-env-vars-allow-overrides-from-cli [POP-1707] Load default configs from env vars and allow overrides from CLI
- Loading branch information
Showing
12 changed files
with
479 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Credentials, not read in by the app, will get replaced with an IAM profile for EKS node | ||
AWS_ACCESS_KEY_ID=x | ||
AWS_SECRET_ACCESS_KEY=x | ||
|
||
# General Environment Configuration | ||
SMPC__ENVIRONMENT=development | ||
|
||
# Service Configuration | ||
SMPC__SERVICE__SERVICE_NAME=smpcv2-server | ||
|
||
# Database Configuration | ||
SMPC__DATABASE__URL=postgres://user:password@localhost/dbname | ||
SMPC__DATABASE__MIGRATE=true | ||
SMPC__DATABASE__CREATE=false | ||
|
||
# AWS Configuration | ||
SMPC__AWS__REGION=eu-north-1 | ||
|
||
# Servers Configuration | ||
SMPC__SERVERS__CODES_ENGINE_PORT=4000 | ||
SMPC__SERVERS__MASKS_ENGINE_PORT=4001 | ||
SMPC__SERVERS__BATCH_CODES_ENGINE_PORT=4002 | ||
SMPC__SERVERS__BATCH_MASKS_ENGINE_PORT=4003 | ||
SMPC__SERVERS__PHASE_2_BATCH_PORT=4004 | ||
SMPC__SERVERS__PHASE_2_PORT=4005 | ||
|
||
# App configuration | ||
SMPC__PARTY_ID=0 | ||
SMPC__REQUESTS_QUEUE_URL=https://sqs.eu-north-1.amazonaws.com/654654380399/mpc1.fifo | ||
SMPC__RESULTS_TOPIC_ARN=arn:aws:sns:eu-north-1:654654380399:mpc-results-topic | ||
SMPC__PATH=/opt/dlami/nvme/ | ||
SMPC__KMS_KEY_IDS='["077788e2-9eeb-4044-859b-34496cfd500b", "896353dc-5ea5-42d4-9e4e-f65dd8169dee", "42bb01f5-8380-48b4-b1f1-929463a587fb"]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Credentials, not read in by the app, will get replaced with an IAM profile for EKS node | ||
AWS_ACCESS_KEY_ID=x | ||
AWS_SECRET_ACCESS_KEY=x | ||
|
||
# General Environment Configuration | ||
SMPC__ENVIRONMENT=development | ||
|
||
# Service Configuration | ||
SMPC__SERVICE__SERVICE_NAME=smpcv2-server | ||
|
||
# Database Configuration | ||
SMPC__DATABASE__URL=postgres://user:password@localhost/dbname | ||
SMPC__DATABASE__MIGRATE=true | ||
SMPC__DATABASE__CREATE=false | ||
|
||
# AWS Configuration | ||
SMPC__AWS__REGION=eu-north-1 | ||
|
||
# Servers Configuration | ||
SMPC__SERVERS__CODES_ENGINE_PORT=4000 | ||
SMPC__SERVERS__MASKS_ENGINE_PORT=4001 | ||
SMPC__SERVERS__BATCH_CODES_ENGINE_PORT=4002 | ||
SMPC__SERVERS__BATCH_MASKS_ENGINE_PORT=4003 | ||
SMPC__SERVERS__PHASE_2_BATCH_PORT=4004 | ||
SMPC__SERVERS__PHASE_2_PORT=4005 | ||
|
||
# App configuration | ||
SMPC__PARTY_ID=1 | ||
SMPC__REQUESTS_QUEUE_URL=https://sqs.eu-north-1.amazonaws.com/654654380399/mpc2.fifo | ||
SMPC__RESULTS_TOPIC_ARN=arn:aws:sns:eu-north-1:654654380399:mpc-results-topic | ||
SMPC__PATH=/opt/dlami/nvme/ | ||
SMPC__BOOTSTRAP_URL=10.15.32.27 | ||
SMPC__KMS_KEY_IDS='["077788e2-9eeb-4044-859b-34496cfd500b", "896353dc-5ea5-42d4-9e4e-f65dd8169dee", "42bb01f5-8380-48b4-b1f1-929463a587fb"]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Credentials, not read in by the app, will get replaced with an IAM profile for EKS node | ||
AWS_ACCESS_KEY_ID=x | ||
AWS_SECRET_ACCESS_KEY=x | ||
|
||
# General Environment Configuration | ||
SMPC__ENVIRONMENT=development | ||
|
||
# Service Configuration | ||
SMPC__SERVICE__SERVICE_NAME=smpcv2-server | ||
|
||
# Database Configuration | ||
SMPC__DATABASE__URL=postgres://user:password@localhost/dbname | ||
SMPC__DATABASE__MIGRATE=true | ||
SMPC__DATABASE__CREATE=false | ||
|
||
# AWS Configuration | ||
SMPC__AWS__REGION=eu-north-1 | ||
|
||
# Servers Configuration | ||
SMPC__SERVERS__CODES_ENGINE_PORT=4000 | ||
SMPC__SERVERS__MASKS_ENGINE_PORT=4001 | ||
SMPC__SERVERS__BATCH_CODES_ENGINE_PORT=4002 | ||
SMPC__SERVERS__BATCH_MASKS_ENGINE_PORT=4003 | ||
SMPC__SERVERS__PHASE_2_BATCH_PORT=4004 | ||
SMPC__SERVERS__PHASE_2_PORT=4005 | ||
|
||
# App configuration | ||
SMPC__PARTY_ID=2 | ||
SMPC__REQUESTS_QUEUE_URL=https://sqs.eu-north-1.amazonaws.com/654654380399/mpc3.fifo | ||
SMPC__RESULTS_TOPIC_ARN=arn:aws:sns:eu-north-1:654654380399:mpc-results-topic | ||
SMPC__PATH=/opt/dlami/nvme/ | ||
SMPC__BOOTSTRAP_URL=10.15.32.27 | ||
SMPC__KMS_KEY_IDS='["077788e2-9eeb-4044-859b-34496cfd500b", "896353dc-5ea5-42d4-9e4e-f65dd8169dee", "42bb01f5-8380-48b4-b1f1-929463a587fb"]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
*.db | ||
.vscode/ | ||
.idea/ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Check if username is provided as a parameter | ||
if [ -z "$1" ]; then | ||
echo "No username provided." | ||
echo "Usage: $0 <username>" | ||
exit 1 | ||
fi | ||
|
||
# Assign the provided username to a variable | ||
USER_NAME=$1 | ||
|
||
# Define the target directory | ||
TARGET_DIR="/home/ubuntu/${USER_NAME}" | ||
|
||
# Define the hosts, order is important, indices are used to identify .env files | ||
TARGET_HOSTS=( | ||
"[email protected]" | ||
"[email protected]" | ||
"[email protected]" | ||
) | ||
|
||
# Define the directories to exclude | ||
EXCLUDE_DIRS=(".idea" ".git" "target") | ||
|
||
# Create the exclude options for rsync | ||
EXCLUDE_OPTIONS=() | ||
for EXCLUDE_DIR in "${EXCLUDE_DIRS[@]}"; do | ||
EXCLUDE_OPTIONS+=("--exclude=$EXCLUDE_DIR") | ||
done | ||
|
||
# Get the name of the current working directory | ||
CURRENT_DIR_NAME=$(basename "$PWD") | ||
|
||
## Loop through each host using an index, starting with 1 | ||
for i in "${!TARGET_HOSTS[@]}"; do | ||
INDEX=$((i + 1)) | ||
HOST=${TARGET_HOSTS[$i]} | ||
echo "Syncing $CURRENT_DIR_NAME to $HOST:$TARGET_DIR (Target Host $INDEX)" | ||
|
||
## Make sure that the correct environment file is copied to the correct host | ||
cp .env.mpc$INDEX.dist .env | ||
|
||
## Sync the current directory to the target host | ||
rsync -avz --delete "${EXCLUDE_OPTIONS[@]}" "$PWD" "$HOST:$TARGET_DIR" | ||
if [ $? -eq 0 ]; then | ||
echo "Sync to $HOST completed successfully." | ||
else | ||
echo "Sync to $HOST failed." | ||
fi | ||
done |
Oops, something went wrong.