Skip to content

Commit

Permalink
Add more empty necessary empty folders with .gitignore. Also generate…
Browse files Browse the repository at this point in the history
… generate_firewall_pki.sh script which will automatically copy the created certs to the correct path.
  • Loading branch information
henrikr3 committed Jan 28, 2020
1 parent 63c193d commit 034d7b2
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 9 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# Comment the following row when you are making changes to values.yaml structure, but make sure you do not commit any of the user defined values!
helm/values.yaml

helm/output/

corda-pki-generator/pki-firewall/certs

*.jar
Expand Down
41 changes: 41 additions & 0 deletions corda-pki-generator/copy_certs_to_helm_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

set -eux

ABS_PATH=$(readlink -f "$0")
DIR=$(dirname "$ABS_PATH")

checkStatus () {
local status=$1
if [ $status -eq 0 ]
then
echo "."
else
echo "The previous step failed"
exit 1
fi
return 0
}

ensureFileExistsAndCopy () {
FROM=$1
TO=$2
if [ -f "$FROM" ]
then
if [ ! -f "$TO" ]
then
cp -f $FROM $TO
else
echo "Existing certificate already existed, skipping copying as a safe-guard: $TO"
exit 1
fi
else
echo "File did not exist, probably an issue with certificate creation: $FROM"
exit 1
fi
}

ensureFileExistsAndCopy $DIR/pki-firewall/certs/trust.jks $DIR/../helm/files/certificates/firewall_tunnel/trust.jks
ensureFileExistsAndCopy $DIR/pki-firewall/certs/float.jks $DIR/../helm/files/certificates/firewall_tunnel/float.jks
ensureFileExistsAndCopy $DIR/pki-firewall/certs/bridge.jks $DIR/../helm/files/certificates/firewall_tunnel/bridge.jks

23 changes: 23 additions & 0 deletions corda-pki-generator/generate_firewall_pki.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -eux

ABS_PATH=$(readlink -f "$0")
DIR=$(dirname "$ABS_PATH")

checkStatus () {
local status=$1
if [ $status -eq 0 ]
then
echo "."
else
echo "The previous step failed"
exit 1
fi
return 0
}

$DIR/pki-firewall/generate_pki.sh
checkStatus $?
$DIR/copy_certs_to_helm_files.sh
checkStatus $?
2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ checkStatus () {
return 0
}

source $DIR/helm/helm_compile.sh
$DIR/helm/helm_compile.sh
checkStatus $?
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ ensureFileExistsAndCopy () {
then
cp -f $FROM $TO
else
echo "File did not exist, probably an issue with initial-registration: $FROM"
echo "Existing certificate already existed, skipping copying as a safe-guard: $TO"
exit 1
fi
else
echo "Existing certificate already existed, skipping copying as a safe-guard: $TO"
echo "File did not exist, probably an issue with initial-registration: $FROM"
exit 1
fi
}
Expand Down
2 changes: 2 additions & 0 deletions helm/output/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
8 changes: 4 additions & 4 deletions one-time-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ checkStatus () {
return 0
}

source $DIR/docker-images/build_docker_images.sh
$DIR/docker-images/build_docker_images.sh
checkStatus $?
source $DIR/docker-images/push_docker_images.sh
$DIR/docker-images/push_docker_images.sh
checkStatus $?
source $DIR/corda-pki-generator/pki-firewall/generate_pki.sh
$DIR/corda-pki-generator/pki-firewall/generate_pki.sh
checkStatus $?
source $DIR/helm/initial_registration/initial_registration.sh
$DIR/helm/initial_registration/initial_registration.sh
checkStatus $?

0 comments on commit 034d7b2

Please sign in to comment.