mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
add example network
add ability to specify RPC password during config generation
This commit is contained in:
parent
329caa20b7
commit
ebce04a8b1
96
docker/src/bash/example-mini-network.sh
Executable file
96
docker/src/bash/example-mini-network.sh
Executable file
@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env bash
|
||||
NODE_LIST=("dockerNode1" "dockerNode2" "dockerNode3")
|
||||
NETWORK_NAME=mininet
|
||||
|
||||
mkdir cordapps
|
||||
rm -f cordapps/*
|
||||
|
||||
wget -O cordapps/finance-contracts.jar https://ci-artifactory.corda.r3cev.com/artifactory/list/corda-dev/net/corda/corda-finance-contracts/4.0-SNAPSHOT/corda-finance-contracts-4.0-SNAPSHOT.jar
|
||||
wget -O cordapps/finance-workflows.jar https://ci-artifactory.corda.r3cev.com/artifactory/list/corda-dev/net/corda/corda-finance-workflows/4.0-SNAPSHOT/corda-finance-workflows-4.0-SNAPSHOT.jar
|
||||
wget -O cordapps/confidential-identities.jar https://ci-artifactory.corda.r3cev.com/artifactory/list/corda-dev/net/corda/corda-confidential-identities/4.0-SNAPSHOT/corda-confidential-identities-4.0-SNAPSHOT.jar
|
||||
|
||||
rm keystore
|
||||
|
||||
keytool -genkey -noprompt \
|
||||
-alias alias1 \
|
||||
-dname "CN=totally_not_r3, OU=ID, O=definitely_not_r3, L=LONDON, S=LONDON, C=GB" \
|
||||
-keystore keystore \
|
||||
-storepass password \
|
||||
-keypass password \
|
||||
-keyalg EC \
|
||||
-keysize 256 \
|
||||
-sigalg SHA256withECDSA
|
||||
|
||||
jarsigner -keystore keystore -storepass password -keypass password cordapps/finance-workflows.jar alias1
|
||||
jarsigner -keystore keystore -storepass password -keypass password cordapps/finance-contracts.jar alias1
|
||||
jarsigner -keystore keystore -storepass password -keypass password cordapps/confidential-identities.jar alias1
|
||||
|
||||
for NODE in ${NODE_LIST[*]}
|
||||
do
|
||||
echo Building ${NODE} directory
|
||||
rm -rf ${NODE}
|
||||
mkdir ${NODE}
|
||||
mkdir ${NODE}/config
|
||||
mkdir ${NODE}/certificates
|
||||
mkdir ${NODE}/logs
|
||||
mkdir ${NODE}/persistence
|
||||
|
||||
done
|
||||
|
||||
docker rm -f netmap
|
||||
docker network rm ${NETWORK_NAME}
|
||||
|
||||
docker network create --attachable ${NETWORK_NAME}
|
||||
docker run -d \
|
||||
-p 18080:8080 \
|
||||
-p 10200:10200 \
|
||||
--name netmap \
|
||||
-e PUBLIC_ADDRESS=netmap \
|
||||
--network="${NETWORK_NAME}" \
|
||||
roastario/notary-and-network-map:latest
|
||||
|
||||
let EXIT_CODE=255
|
||||
while [ ${EXIT_CODE} -gt 0 ]
|
||||
do
|
||||
sleep 2
|
||||
echo "Waiting for network map to start"
|
||||
curl -s http://localhost:18080/network-map > /dev/null
|
||||
let EXIT_CODE=$?
|
||||
done
|
||||
|
||||
for NODE in ${NODE_LIST[*]}
|
||||
do
|
||||
wget -O ${NODE}/certificates/network-root-truststore.jks http://localhost:18080/truststore
|
||||
docker rm -f ${NODE}
|
||||
docker run \
|
||||
-e MY_LEGAL_NAME="O=${NODE},L=Berlin,C=DE" \
|
||||
-e MY_PUBLIC_ADDRESS="${NODE}" \
|
||||
-e NETWORKMAP_URL="http://netmap:8080" \
|
||||
-e DOORMAN_URL="http://netmap:8080" \
|
||||
-e NETWORK_TRUST_PASSWORD="trustpass" \
|
||||
-e MY_EMAIL_ADDRESS="${NODE}@r3.com" \
|
||||
-e MY_RPC_PORT="1100"$(echo ${NODE} | sed 's/[^0-9]*//g') \
|
||||
-e RPC_PASSWORD="testingPassword" \
|
||||
-v $(pwd)/${NODE}/config:/etc/corda \
|
||||
-v $(pwd)/${NODE}/certificates:/opt/corda/certificates \
|
||||
-v $(pwd)/${NODE}/logs:/opt/corda/logs \
|
||||
--name ${NODE} \
|
||||
--network="${NETWORK_NAME}" \
|
||||
corda/corda-zulu-4.0-rc02:latest config-generator --generic
|
||||
|
||||
docker rm -f ${NODE}
|
||||
docker run -d \
|
||||
--memory=2048m \
|
||||
--cpus=2 \
|
||||
-v $(pwd)/${NODE}/config:/etc/corda \
|
||||
-v $(pwd)/${NODE}/certificates:/opt/corda/certificates \
|
||||
-v $(pwd)/${NODE}/logs:/opt/corda/logs \
|
||||
-v $(pwd)/${NODE}/persistence:/opt/corda/persistence \
|
||||
-v $(pwd)/cordapps:/opt/corda/cordapps \
|
||||
-p "1100"$(echo ${NODE} | sed 's/[^0-9]*//g'):"1100"$(echo ${NODE} | sed 's/[^0-9]*//g') \
|
||||
-p "222$(echo ${NODE} | sed 's/[^0-9]*//g')":"222$(echo ${NODE} | sed 's/[^0-9]*//g')" \
|
||||
-e CORDA_ARGS="--sshd --sshd-port=222$(echo ${NODE} | sed 's/[^0-9]*//g')" \
|
||||
--name ${NODE} \
|
||||
--network="${NETWORK_NAME}" \
|
||||
corda/corda-zulu-4.0-rc02:latest
|
||||
done
|
@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
die() {
|
||||
printf '%s\n' "$1" >&2
|
||||
exit 1
|
||||
@ -15,7 +14,8 @@ show_help(){
|
||||
}
|
||||
|
||||
function generateTestnetConfig() {
|
||||
RPC_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) \
|
||||
: ${RPC_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)}
|
||||
RPC_PASSWORD=${RPC_PASSWORD} \
|
||||
DB_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) \
|
||||
MY_PUBLIC_ADDRESS=${MY_PUBLIC_ADDRESS} \
|
||||
MY_P2P_PORT=${MY_P2P_PORT} \
|
||||
@ -36,8 +36,8 @@ function generateGenericCZConfig(){
|
||||
if [[ ! -f ${CERTIFICATES_FOLDER}/${TRUST_STORE_NAME} ]]; then
|
||||
die "Network Trust Root file not found"
|
||||
fi
|
||||
|
||||
RPC_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) \
|
||||
: ${RPC_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)}
|
||||
RPC_PASSWORD=${RPC_PASSWORD} \
|
||||
DB_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) \
|
||||
MY_PUBLIC_ADDRESS=${MY_PUBLIC_ADDRESS} \
|
||||
MY_P2P_PORT=${MY_P2P_PORT} \
|
||||
|
@ -7,4 +7,4 @@ if [[ ${JVM_ARGS} == *"Xmx"* ]]; then
|
||||
echo "WARNING: the use of the -Xmx flag is not recommended within docker containers. Use the --memory option passed to the container to limit heap size"
|
||||
fi
|
||||
|
||||
java -Djava.security.egd=file:/dev/./urandom -Dcapsule.jvm.args="${JVM_ARGS}" -jar /opt/corda/bin/corda.jar --base-directory=/opt/corda --config-file=/etc/corda/node.conf
|
||||
java -Djava.security.egd=file:/dev/./urandom -Dcapsule.jvm.args="${JVM_ARGS}" -jar /opt/corda/bin/corda.jar --base-directory=/opt/corda --config-file=/etc/corda/node.conf ${CORDA_ARGS}
|
Loading…
Reference in New Issue
Block a user