The microservice provides a hello world
endpoint which prints out an input environment variable. The service has been built with Quarkus.
Endpoints:
http://localhost:8081/hello
which prints out an input environment variable.http://localhost:8081/q/metrics/application
provides metrics information.
The documentation covers three topics:
- Run the microservice locally
- Run the microservice as a container
- Build and push a new container image for the microservice to a container registry
git clone https://github.com/ibm/operator-sample-go.git
cd operator-sample-go/simple-microservice
export GREETING_MESSAGE=World
mvn clean quarkus:dev
open http://localhost:8081/hello
open http://localhost:8081/q/metrics/application
git clone https://github.com/ibm/operator-sample-go.git
cd operator-sample-go/simple-microservice
export REPOSITORY_URL=nheidloff
podman build -t $REPOSITORY_URL/simple-microservice .
podman run -i --rm -p 8081:8081 -e GREETING_MESSAGE=World $REPOSITORY_URL/simple-microservice
open http://localhost:8081/hello
git clone https://github.com/ibm/operator-sample-go.git
cd operator-sample-go/simple-microservice
Step 3: Use environment .env
file for environment variable definition
code ../versions.env
source ../versions.env
Example configuration:
# Definition of the used container registry
export REGISTRY='quay.io'
# Definition of the repository inside the container registry
export ORG=tsuedbroecker
# container image names including the tag
export IMAGE_MICROSERVICE='simple-microservice:v1.0.11'
podman build -t "$REGISTRY/$ORG/$IMAGE_MICROSERVICE" .
echo "$REGISTRY/$ORG/$IMAGE_MICROSERVICE"
podman push "$REGISTRY/$ORG/$IMAGE_MICROSERVICE"