-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
77 additions
and
3 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
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,27 @@ | ||
version: '3.8' | ||
services: | ||
backend: | ||
image: sha256:4e7f93853238619bc97207db356730e5d6b1f50b80f270d91e623b5867d26943 | ||
container_name: backend | ||
secrets: | ||
- CORE_MAESTRO_API_KEY | ||
- MAESTRO_API_KEY | ||
- SERVER_API_KEY | ||
environment: | ||
SERVER_CONFIG: | | ||
coreProvider: | ||
maestroToken: <<CORE_MAESTRO_API_KEY>> | ||
turboSubmit: false | ||
networkId: "mainnet" # supported: mainner ot preprod | ||
logging: | ||
- type: {tag: stderr} | ||
severity: "Debug" # Debug, Info, Warning or Error | ||
verbosity: V2 # Available: `V0`, `V1`, `V2`, `V3` and `V4` (See katip docs for details) | ||
port: 8082 | ||
maestroToken: <<MAESTRO_API_KEY>> | ||
serverApiKey: <<SERVER_API_KEY>> | ||
restart: always | ||
secrets: | ||
CORE_MAESTRO_API_KEY: { file: ./secrets/core_maestro_api_key } | ||
MAESTRO_API_KEY: { file: ./secrets/maesto_api_key } | ||
SERVER_API_KEY: { file: ./secrets/server_api_key } |
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,49 @@ | ||
#!/bin/bash | ||
echo "======[geniusyield-server]======" | ||
echo "Startup checks...." | ||
# Check if SERVER_CONFIG environment variable is set | ||
if [ -z "$SERVER_CONFIG" ]; then | ||
echo "Error: SERVER_CONFIG environment variable is not set." >&2 | ||
exit 1 # Exit code 1 for unset variable | ||
fi | ||
if [ -z "$CORE_MAESTRO_API_KEY" ]; then | ||
echo "Error: CORE_MAESTRO_API_KEY environment variable is not set." >&2 | ||
exit 1 # Exit code 1 for unset variable | ||
fi | ||
if [ -z "$MAESTRO_API_KEY" ]; then | ||
echo "Error: MAESTRO_API_KEY environment variable is not set." >&2 | ||
exit 1 # Exit code 1 for unset variable | ||
fi | ||
if [ -z "$SERVER_API_KEY" ]; then | ||
echo "Error: SERVER_API_KEY environment variable is not set." >&2 | ||
exit 1 # Exit code 1 for unset variable | ||
fi | ||
|
||
# Check if yq is installed | ||
if ! command -v yq &> /dev/null; then | ||
echo "Error: yq is not installed. Please install yq to validate YAML content." >&2 | ||
exit 2 # Exit code 2 for yq not installed | ||
fi | ||
|
||
# Attempt to parse SERVER_CONFIG as YAML | ||
echo "$SERVER_CONFIG" | yq eval . - > /dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
echo "Error: SERVER_CONFIG does not contain a valid YAML document." >&2 | ||
exit 3 # Exit code 3 for invalid YAML content | ||
fi | ||
|
||
# If the script reaches this point, SERVER_CONFIG is both set and valid | ||
echo "SERVER_CONFIG is set and contains a valid YAML document." | ||
echo "====================================" | ||
echo "Replace placeholders...." | ||
export SERVER_CONFIG=$(echo "$SERVER_CONFIG" | sed "s%<<CORE_MAESTRO_API_KEY>>%$CORE_MAESTRO_API_KEY%g") | ||
export SERVER_CONFIG=$(echo "$SERVER_CONFIG" | sed "s%<<MAESTRO_API_KEY>>%$MAESTRO_API_KEY%g") | ||
export SERVER_CONFIG=$(echo "$SERVER_CONFIG" | sed "s%<<SERVER_API_KEY>>%$SERVER_API_KEY%g") | ||
echo "[OK] Done. Replaced placeholders." | ||
echo "====================================" | ||
# TODO: remove | ||
echo $SERVER_CONFIG | ||
echo "====================================" | ||
echo "Starting geniusyield-server..." | ||
set -x | ||
cabal run geniusyield-server -- serve |