+if [[ $(docker image ls -q $SPLITTER) == "" || "$1" = "build" ]]
+then
+ echo "Building image $SPLITTER"
+ mvn -f splitter/pom.xml clean package docker:build
+else
+ echo -n "Using existing image for $SPLITTER: "
+ docker image ls --format json $SPLITTER | jq -r '(.ID + " - " + .CreatedSince)'
+fi
+
+if [[ $(docker image ls -q $COUNTER) == "" || "$1" = "build" ]]
+then
+ echo "Building image $COUNTER"
+ mvn -f counter/pom.xml clean package docker:build
+else
+ echo -n "Using existing image for $COUNTER: "
+ docker image ls --format json $COUNTER | jq -r '(.ID + " - " + .CreatedSince)'
+fi
+
+if [[ $(docker image ls -q $TOP10) == "" || "$1" = "build" ]]
+then
+ echo "Building image $TOP10"
+ mvn -f top10/pom.xml clean package docker:build
+else
+ echo -n "Using existing image for $TOP10: "
+ docker image ls --format json $TOP10 | jq -r '(.ID + " - " + .CreatedSince)'
+fi
+
+if [[ $(docker image ls -q $QUERY) == "" || "$1" = "build" ]]
+then
+ echo "Building image $QUERY"
+ mvn -f query/pom.xml clean package docker:build
+else
+ echo -n "Using existing image for $QUERY: "
+ docker image ls --format json $QUERY | jq -r '(.ID + " - " + .CreatedSince)'
+fi
+
+if [[ $(docker image ls -q $POPULAR) == "" || "$1" = "build" ]]
+then
+ echo "Building image $POPULAR"
+ mvn -f popular/pom.xml clean package docker:build
+else
+ echo -n "Using existing image for $POPULAR: "
+ docker image ls --format json $POPULAR | jq -r '(.ID + " - " + .CreatedSince)'
+fi
+
+
+docker compose up setup
+
+echo "Starting the service 'users'..."
+docker compose up -d users
+while [ "$(http users.localhost/actuator/health 2> /dev/null | jq -r .status 2> /dev/null)" != "UP" ]; do echo "Waiting for service users..."; sleep 1; done
+http -v post users.localhost username=bart firstName=Bart lastName=Simpson sex=MALE
+http -v post users.localhost username=nerd firstName=Jane lastName=Doe sex=FEMALE
+http -v post users.localhost username=riddler firstName=Rumpel lastName=Stilzchen sex=MALE
+
+echo "Starting the other instances..."
+docker compose up -d recorder
+docker compose up -d splitter
+docker compose up -d counter
+docker compose up -d top10
+docker compose up -d query
+
+echo "Starting the simulated users..."
+docker compose up -d bart nerd riddler