CertService local starter
authorBogumil Zebek <bogumil.zebek@nokia.com>
Wed, 18 Mar 2020 06:09:48 +0000 (07:09 +0100)
committerZebek Bogumil <bogumil.zebek@nokia.com>
Wed, 18 Mar 2020 06:09:48 +0000 (07:09 +0100)
Issue-ID: AAF-1107
Signed-off-by: Zebek Bogumil <bogumil.zebek@nokia.com>
Change-Id: I7742fa622bd8acf4764137d98cad581781487103

certService/Makefile [new file with mode: 0644]
certService/README.md
certService/docker-compose.yml
certService/src/main/resources/scripts/ejbca-configuration.sh

diff --git a/certService/Makefile b/certService/Makefile
new file mode 100644 (file)
index 0000000..b1b63b4
--- /dev/null
@@ -0,0 +1,31 @@
+all: build start stop
+.PHONY: build
+
+build:
+       @echo "##### Build Cert Service images locally #####"
+       mvn clean install -P docker
+       @echo "##### DONE #####"
+start:
+       @echo "##### Start Cert Service #####"
+       docker-compose up -d
+       @echo "## Configure ejbca ##"
+       docker exec aafcert-ejbca /opt/primekey/scripts/ejbca-configuration.sh
+       @echo "##### DONE #####"
+stop:
+       @echo "##### Stop Cert Service #####"
+       docker-compose down
+       @echo "##### DONE #####"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index e48dad5..9f23504 100644 (file)
@@ -48,6 +48,8 @@ mvn clean install
 ### Building Docker image and install the package into local repository
 ```
 mvn clean install -P docker
+or
+make build
 ```   
 
 ### Running Docker container local
@@ -62,9 +64,14 @@ docker run -p 8080:8080 --name aaf-certservice-api --mount type=bind,source=/<ab
 
 ### Running Docker container from docker-compose with EJBCA
 Docker-compose uses a local image of certservice.
-Build a docker image locally before run docker compose command. See a section **Building Docker image and install the package into local repository**
-```
-docker-compose up
+Build a docker image locally before run docker compose command.
+```
+1. Build local image
+make build
+2. Start Cert Service with configured EJBCA
+make start
+3. Stop containers
+make stop
 ```
     
 ### Running with Helm
index 97d187e..2f4f4b4 100644 (file)
@@ -11,7 +11,6 @@ services:
     volumes:
       - ./src/main/resources/scripts/:/opt/primekey/scripts
     command: bash -c "
-      ./scripts/ejbca-configuration.sh &
       /opt/primekey/bin/start.sh
       "
     healthcheck:
index 705f40c..77f5c55 100755 (executable)
@@ -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 30
 configureEjbca