CertService local starter
Issue-ID: AAF-1107
Signed-off-by: Zebek Bogumil <bogumil.zebek@nokia.com>
Change-Id: I7742fa622bd8acf4764137d98cad581781487103
diff --git a/certService/Makefile b/certService/Makefile
new file mode 100644
index 0000000..b1b63b4
--- /dev/null
+++ b/certService/Makefile
@@ -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 #####"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/certService/README.md b/certService/README.md
index e48dad5..9f23504 100644
--- a/certService/README.md
+++ b/certService/README.md
@@ -48,6 +48,8 @@
### 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 @@
### 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**
+Build a docker image locally before run docker compose command.
```
-docker-compose up
+1. Build local image
+make build
+2. Start Cert Service with configured EJBCA
+make start
+3. Stop containers
+make stop
```
### Running with Helm
diff --git a/certService/docker-compose.yml b/certService/docker-compose.yml
index 97d187e..2f4f4b4 100644
--- a/certService/docker-compose.yml
+++ b/certService/docker-compose.yml
@@ -11,7 +11,6 @@
volumes:
- ./src/main/resources/scripts/:/opt/primekey/scripts
command: bash -c "
- ./scripts/ejbca-configuration.sh &
/opt/primekey/bin/start.sh
"
healthcheck:
diff --git a/certService/src/main/resources/scripts/ejbca-configuration.sh b/certService/src/main/resources/scripts/ejbca-configuration.sh
index 705f40c..77f5c55 100755
--- a/certService/src/main/resources/scripts/ejbca-configuration.sh
+++ b/certService/src/main/resources/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 @@
ejbca.sh ca getcacert --caname ManagementCA -f /dev/stdout > cacert.pem
}
-waitForEjbcaStartUp 30
configureEjbca