diff options
-rw-r--r-- | plans/aaf/certservice/docker-compose.yml | 3 | ||||
-rwxr-xr-x | plans/aaf/certservice/scripts/ejbca-configuration.sh | 5 | ||||
-rw-r--r-- | plans/aaf/certservice/setup.sh | 22 | ||||
-rw-r--r-- | plans/aaf/certservice/teardown.sh | 2 |
4 files changed, 21 insertions, 11 deletions
diff --git a/plans/aaf/certservice/docker-compose.yml b/plans/aaf/certservice/docker-compose.yml index 384158ab..ae7ee878 100644 --- a/plans/aaf/certservice/docker-compose.yml +++ b/plans/aaf/certservice/docker-compose.yml @@ -11,12 +11,11 @@ services: volumes: - $SCRIPTS_PATH:/opt/primekey/scripts command: bash -c " - ./scripts/ejbca-configuration.sh & /opt/primekey/bin/start.sh " healthcheck: test: ["CMD-SHELL", "curl -kI https://localhost:8443/ejbca/publicweb/healthcheck/ejbcahealth"] - interval: 10s + interval: 20s timeout: 3s retries: 9 networks: diff --git a/plans/aaf/certservice/scripts/ejbca-configuration.sh b/plans/aaf/certservice/scripts/ejbca-configuration.sh index 7ec1fa3a..77f5c555 100755 --- a/plans/aaf/certservice/scripts/ejbca-configuration.sh +++ b/plans/aaf/certservice/scripts/ejbca-configuration.sh @@ -1,9 +1,5 @@ #!/bin/bash -waitForEjbcaStartUp() { - sleep $1 -} - configureEjbca() { ejbca.sh config cmp addalias --alias cmpRA ejbca.sh config cmp updatealias --alias cmpRA --key operationmode --value ra @@ -20,5 +16,4 @@ configureEjbca() { ejbca.sh ca getcacert --caname ManagementCA -f /dev/stdout > cacert.pem } -waitForEjbcaStartUp 45 configureEjbca diff --git a/plans/aaf/certservice/setup.sh b/plans/aaf/certservice/setup.sh index dde516ae..a89a1625 100644 --- a/plans/aaf/certservice/setup.sh +++ b/plans/aaf/certservice/setup.sh @@ -53,9 +53,23 @@ export SCRIPTS_PATH=${SCRIPTS_PATH} docker-compose up -d -AAFCERT_IP=`get-instance-ip.sh aafcert` -export AAFCERT_IP=${AAFCERT_IP} - +AAFCERT_IP='none' # Wait container ready -sleep 15 +for i in {1..9} +do + AAFCERT_IP=`get-instance-ip.sh aafcert` + RESP_CODE=$(curl -I -s -o /dev/null -w "%{http_code}" http://${AAFCERT_IP}:8080/actuator/health) + if [[ "$RESP_CODE" == '200' ]]; then + echo 'AAF Cert Service is ready' + export AAFCERT_IP=${AAFCERT_IP} + docker exec aafcert-ejbca /opt/primekey/scripts/ejbca-configuration.sh + break + fi + echo 'Waiting for AAF Cert Service to start up...' + sleep 30s +done +if [[ $AAFCERT_IP == 'none' ] || [ $AAFCERT_IP == '' ]]; then + echo "AAF Cert Service is not ready!" + exit 1 # Return error code +fi diff --git a/plans/aaf/certservice/teardown.sh b/plans/aaf/certservice/teardown.sh index 3f10eaeb..ab227596 100644 --- a/plans/aaf/certservice/teardown.sh +++ b/plans/aaf/certservice/teardown.sh @@ -15,5 +15,7 @@ # limitations under the License. # +docker-compose down + kill-instance.sh aafcert kill-instance.sh aafcert-ejbca
\ No newline at end of file |