diff --git a/docker-compose.yml b/docker-compose.yml index 84b961a..73b2d97 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,7 @@ version: '3.3' services: urls_controller: + profiles: ["onlyController", "all"] image: 'pdf_aggregation_service/urls_controller:latest' ports: - '1880:1880' @@ -21,6 +22,7 @@ services: context: . prometheus: + profiles: ["all"] image: 'prom/prometheus:latest' ports: - '9090:9090' @@ -31,6 +33,7 @@ services: - urls_controller grafana: + profiles: ["all"] image: 'grafana/grafana:latest' ports: - '3000:3000' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c85a1f..37aef8d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/installAndRun.sh b/installAndRun.sh index d1e801e..9671184 100755 --- a/installAndRun.sh +++ b/installAndRun.sh @@ -26,7 +26,7 @@ if [[ justInstall -eq 1 && shouldRunInDocker -eq 1 ]]; then justInstall=0 fi -gradleVersion="8.1" +gradleVersion="8.1.1" if [[ justInstall -eq 0 ]]; then @@ -48,11 +48,19 @@ if [[ justInstall -eq 0 ]]; then gradle clean build if [[ shouldRunInDocker -eq 1 ]]; then + + runPrometheusAndGrafanaContainers=0 + echo -e "\nBuilding the docker image and running the containers..\n" sudo docker --version || handle_error "Docker was not found!" 3 (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 mkdir -p "$HOME"/logs || true - (sudo docker compose up --build -d && echo -e "\nThe Urls_Controller, Prometheus and Grafana docker-containers started running.\nWaiting 65 seconds before getting their status..\n") || handle_error "Could not list docker containers!" 4 + + if [[ runPrometheusAndGrafanaContainers -eq 1 ]]; then + (sudo docker compose --profile all up --build -d && echo -e "\nThe Urls_Controller, Prometheus and Grafana docker-containers started running.\nWaiting 65 seconds before getting their status..\n") || handle_error "Could not list docker containers!" 4 + else + (sudo docker compose --profile onlyController up --build -d && echo -e "\nThe Urls_Controller docker-container started running.\nWaiting 65 seconds before getting its status..\n") || handle_error "Could not list docker containers!" 4 + fi # Run in "detached mode" -d (in the background). sleep 65 sudo docker ps -a || handle_error "Could not get the status of docker-containers!" 5 # Using -a to get the status of failed containers as well.