Skip to content

Commit

Permalink
feat: local-environment deployment option 4 for external benchmarking…
Browse files Browse the repository at this point in the history
… node support
  • Loading branch information
skylar-simoncelli authored Nov 15, 2024
1 parent b4a250b commit 8641cbb
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 11 deletions.
56 changes: 56 additions & 0 deletions dev/local-environment/modules/partner-chains-external-node.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

partner-chains-node-1:
container_name: partner-chains-node-1
image: ${PARTNER_CHAINS_NODE_IMAGE}
network_mode: "host"
platform: linux/amd64
volumes:
- shared-volume:/shared
- partner-chains-node-1-data:/data
environment:
DB_SYNC_POSTGRES_CONNECTION_STRING: "postgres://postgres:${POSTGRES_PASSWORD}@127.0.0.1:${POSTGRES_PORT}/cexplorer"
SIDECHAIN_BLOCK_BENEFICIARY: "0000000000000000000000000000000000000000000000000000000000000001"
CHAIN_ID: "0"
GENESIS_COMMITTEE_UTXO: "781cb948a37c7c38b43872af9b1e22135a94826eafd3740260a6db0a303885d8#0"
GOVERNANCE_AUTHORITY: "e8c300330fe315531ca89d4a2e7d0c80211bc70b473b1ed4979dff2b"
CARDANO_SECURITY_PARAMETER: "5"
CARDANO_ACTIVE_SLOTS_COEFF: "0.4"
MC__FIRST_EPOCH_NUMBER: "0"
MC__FIRST_SLOT_NUMBER: "0"
MC__EPOCH_DURATION_MILLIS: "120000"
THRESHOLD_NUMERATOR: "2"
THRESHOLD_DENOMINATOR: "3"
BLOCK_STABILITY_MARGIN: "0"
MINIMUM_MC_EPOCH: "0"
MC__FIRST_EPOCH_TIMESTAMP_MILLIS: ""
COMMITTEE_CANDIDATE_ADDRESS: ""
D_PARAMETER_POLICY_ID: ""
PERMISSIONED_CANDIDATES_POLICY_ID: ""
NATIVE_TOKEN_POLICY_ID: ""
NATIVE_TOKEN_ASSET_NAME: ""
ILLIQUID_SUPPLY_VALIDATOR_ADDRESS: ""
command:
- "--alice"
- "--chain=/shared/chain-spec.json"
- "--node-key=0000000000000000000000000000000000000000000000000000000000000001"
- "--bootnodes=/ipv4/<INSERT_IPV4_ADDRESS>/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp"
- "--bootnodes=/ipv4/<INSERT_IPV4_ADDRESS>/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp"
- "--bootnodes=/ipv4/<INSERT_IPV4_ADDRESS>/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp"
- "--base-path=/data"
- "--unsafe-rpc-external"
- "--rpc-port=9933"
- "--rpc-cors=all"
- "--prometheus-port=9615"
- "--prometheus-external"
- "--state-pruning=archive"
- "--blocks-pruning=archive"
ports:
- "30333:30333"
- "9933:9933"
- "9615:9615"
restart: always
deploy:
resources:
limits:
cpus: ${CPU_PARTNER_CHAINS_NODE:-}
memory: ${MEM_PARTNER_CHAINS_NODE:-}
34 changes: 23 additions & 11 deletions dev/local-environment/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,10 @@ choose_deployment_option() {
echo "1) Include only Cardano testnet"
echo "2) Include Cardano testnet with Kupo and Ogmios"
echo "3) Include Cardano testnet, Kupo, Ogmios, DB-Sync and Postgres"
read -p "Enter your choice (1/2/3): " deployment_option
echo "4) Deploy a single Partner Chains node with network_mode: "host" for external connections (adjust partner-chains-external-node.txt before running this script)"
read -p "Enter your choice (1/2/3/4): " deployment_option
else
deployment_option=4
deployment_option=0
fi
echo
}
Expand Down Expand Up @@ -424,7 +425,17 @@ create_docker_compose() {
cat ./modules/db-sync.txt >> docker-compose.yml
cat ./modules/postgres.txt >> docker-compose.yml
;;
*)
4)
echo -e "Including all services with external partner chain node.\n"
cat ./modules/cardano.txt >> docker-compose.yml
cat ./modules/ogmios.txt >> docker-compose.yml
cat ./modules/kupo.txt >> docker-compose.yml
cat ./modules/db-sync.txt >> docker-compose.yml
cat ./modules/postgres.txt >> docker-compose.yml
cat ./modules/partner-chains-external-node.txt >> docker-compose.yml
cat ./modules/pc-contracts-cli.txt >> docker-compose.yml
;;
0)
echo -e "Including all services.\n"
cat ./modules/cardano.txt >> docker-compose.yml
cat ./modules/ogmios.txt >> docker-compose.yml
Expand All @@ -434,6 +445,10 @@ create_docker_compose() {
cat ./modules/partner-chains-nodes.txt >> docker-compose.yml
cat ./modules/pc-contracts-cli.txt >> docker-compose.yml
;;
*)
echo "Invalid deployment option selected."
exit 1
;;
esac
if [ "$tests_enabled" == "yes" ]; then
echo -e "Including tests.\n"
Expand All @@ -445,24 +460,23 @@ create_docker_compose() {

parse_arguments() {
non_interactive=0
deployment_option=4
deployment_option=0
postgres_password=""
overrides="no"
tests_enabled="no"

# Parse arguments
while [[ $# -gt 0 ]]; do
case "$1" in
-n|--non-interactive)
non_interactive=1
shift
;;
-d|--deployment-option)
if [[ -n "$2" && "$2" =~ ^[123]$ ]]; then
if [[ -n "$2" && "$2" =~ ^[1-4]$ ]]; then
deployment_option="$2"
shift 2
else
echo "Error: Invalid deployment option '$2'. Valid options are 1, 2, or 3."
echo "Error: Invalid deployment option '$2'. Valid options are 1, 2, 3, or 4."
exit 1
fi
;;
Expand Down Expand Up @@ -497,7 +511,7 @@ parse_arguments() {
echo "Usage: $0 [OPTION]..."
echo "Initialize and configure the Docker environment."
echo " -n, --non-interactive Run with no interactive prompts and accept sensible default configuration settings."
echo " -d, --deployment-option Specify one of the custom deployment options (1, 2, or 3)."
echo " -d, --deployment-option Specify one of the custom deployment options (1, 2, 3, or 4)."
echo " -p, --postgres-password Set a specific password for PostgreSQL (overrides automatic generation)."
echo " -o, --overrides Enable custom artifact overrides from artifacts in ./configurations/pc-contracts-cli/ (PC and PCSC)."
echo " -i, --node-image Specify a custom Partner Chains Node image."
Expand All @@ -516,7 +530,6 @@ parse_arguments() {
esac
done

# Export variables for use in other functions
export non_interactive
export deployment_option
export postgres_password
Expand All @@ -525,7 +538,6 @@ parse_arguments() {
export tests_enabled
}


main() {
parse_arguments "$@"

Expand All @@ -547,7 +559,7 @@ main() {
configure_artifact_overrides "interactive"
resource_limits_setup

if [ "$deployment_option" -eq 4 ]; then
if [ "$deployment_option" -eq 0 ]; then
choose_deployment_option
fi

Expand Down

0 comments on commit 8641cbb

Please sign in to comment.