(sudo mkdir -p "$HOME"/tmp/config && sudo cp ./src/main/resources/application.yml "$HOME"/tmp/config)||true# This also replaces an existing "application.yml".
(sudo docker compose up --build -d &&echo -e "\nThe Urls_Controller docker-container started running.\n")|| handle_error "Could not build and/or run the 'urls_controller' docker container!"4
(sudo docker compose -f prometheus/docker-compose-prometheus.yml up --build -d &&echo -e "\nThe Prometheus and Grafana docker-containers started running.\n")|| handle_error "Could not build and/or run the 'prometheus' and/or 'grafana' docker containers!"5
echo -e "Waiting 20 seconds before getting the status..\n"
sleep 20
# 20 seconds are enough to check if there is an immediate fatal error with one of the docker images. This will cover the problematic configuration case for Prometheus and Grafana containers.
sudo docker logs -f urls_controller || handle_error "Could not get the logs of docker-container \"urls_controller\"!"7# Using "regex anchors" to avoid false-positives. Works even if the container is not running, thus showing the error-log.
# Use just the container-name and the "-f" parameter to indicate that we want to follow on logs updates, until we specify to unfollow them (with ctrl+c).
# This way we do not need to run the "docker logs" again and again, not checking the the container-id each time.