- Add profiles to docker-services to selectively run the additional "Prometheus" and "Grafana" services or not.

- Update Gradle.
This commit is contained in:
Lampros Smyrnaios 2023-04-22 16:50:33 +03:00
parent 68759e3023
commit 1b14a7e554
3 changed files with 14 additions and 3 deletions

View File

@ -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'

View File

@ -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

View File

@ -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.