From 05d414f7ca0352ce0d9614cf992af31a462bfbe8 Mon Sep 17 00:00:00 2001 From: Olivier Bretteville Date: Fri, 20 Jun 2025 08:52:06 +0200 Subject: [PATCH 1/3] resources/checkPorts.sh to check if all needed ports are available --- resources/checkPorts.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 resources/checkPorts.sh diff --git a/resources/checkPorts.sh b/resources/checkPorts.sh new file mode 100644 index 00000000..1a72ddd6 --- /dev/null +++ b/resources/checkPorts.sh @@ -0,0 +1,38 @@ +#! /bin/bash +# +# Tries to open all ports specified in docker-compose.yml to see if they are available +# + +if [ $# -ge 1 ]; then + DCOMPOSE=$1 +else + DCOMPOSE=$(realpath $(dirname $0)/..)/config/dev/cab-standalone/docker-compose.yml +fi +if [ ! -r "$DCOMPOSE" ]; then + echo "Usage: $0 [ ]" + echo "Can't open $DCOMPOSE" + exit 1 +fi +which docker >/dev/null +if [ $? -ne 0 ]; then + echo "Usage: $0 [ ]" + echo "Can't find docker command" + exit 2 +fi + +PORTS=$(sed -e 's/#.*//' $DCOMPOSE | egrep "[ '\"][0-9]+:[0-9]+" | sed -e 's/^[^0-9]*//' -e 's/:.*//'i | sort -nu | tr '\n' ' ' ) +echo "Ports used for InteractiveAI: $PORTS" +NOK=0 +for port in $PORTS; do + docker run -p $port:80 hello-world >/dev/null + if [ $? -ne 0 ]; then + let NOK=$NOK+1 + fi +done +if [ $NOK -eq 0 ]; then + echo "All is fine: all ports used by InteractiveAI are available" +else + echo "Check your counfiguration: $NOK port(s) used by InteractiveAI are already used" + echo "InteractiveAI can't run on this platform with this $DCOMPOSE ports configuration" +fi +exit $NOK From 5e448a7b83211d40f15c4af865b0acdf4d11c4ff Mon Sep 17 00:00:00 2001 From: Olivier Bretteville Date: Fri, 20 Jun 2025 08:52:40 +0200 Subject: [PATCH 2/3] Troubleshooting documentation updated --- docs/troubleshooting.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 142a6d68..4e818862 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -3,6 +3,39 @@ Are you having issues with setting up your environment? Here are some tips that might help. +## Ports already in use + +InteractiveAI uses about twenty ports on server. If a port needed for InteractiveAI is already in use, InteractiveAI will fail (with messages in logs but the can be missed). +The script `resources/checkPorts.sh` tests the availability of each port specified in `config/dev/cab-standalone/docker-compose.yml` and write a diagnosis on console. + +It it succeeds: +``` +brettevi@PCAlien:~/Projets/InteractiveAI$ ./resources/checkPorts.sh +Ports used for InteractiveAI: 89 3200 5000 5100 5200 5400 5433 5434 5436 5437 5438 5500 12002 12100 12102 12103 12104 27017 +All is fine: all ports used by InteractiveAI are available +``` + +If it fails: +``` +brettevi@PCAlien:~/Projets/InteractiveAI$ ./resources/checkPorts.sh +Ports used for InteractiveAI: 89 3200 5000 5100 5200 5400 5433 5434 5436 5437 5438 5500 12002 12100 12102 12103 12104 27017 +docker: Error response from daemon: driver failed programming external connectivity on endpoint stoic_williams (b69f8285b2ec63145267ad7ea04969cf58dc423528729c7c3f07b5d5c3ccc342): Bind for 0.0.0.0:89 failed: port is already allocated. +... +docker: Error response from daemon: driver failed programming external connectivity on endpoint zen_feistel (f3047f6ae4ebf5e78dc034137d24a832e2ff60490424ba8ba4ae2531d2222142): Bind for 0.0.0.0:12104 failed: port is already allocated. +docker: Error response from daemon: driver failed programming external connectivity on endpoint keen_swanson (82f2ac17d11057767379dc0f492b5a9b8fd7620fb562e8107e9ce1453e548052): Bind for 0.0.0.0:27017 failed: port is already allocated. +Check your counfiguration: 18 port(s) used by InteractiveAI are already used +InteractiveAI can't run on this platform with this /home/brettevi/Projets/InteractiveAI/config/dev/cab-standalone/docker-compose.yml ports configuration +``` + +This command may also be used with a specific docker-compose.yml file. For example, to test Powergrid simulator ports availability, one can use: +``` +brettevi@PCAlien:~/Projets/InteractiveAI$ ./resources/checkPorts.sh usecases_examples/PowerGrid/docker-compose.yml +Ports used for InteractiveAI: 5150 +docker: Error response from daemon: driver failed programming external connectivity on endpoint funny_rhodes (6291f43617a7798a833fdeee05c32c75c2d0bf765eac5dc3b8fe08b7255e57a1): Bind for 0.0.0.0:5150 failed: port is already allocated. +Check your counfiguration: 1 port(s) used by InteractiveAI are already used +InteractiveAI can't run on this platform with this usecases_examples/PowerGrid/docker-compose.yml ports configuration +``` + ## EoL Sequence Configuration errors. Some users may encounter issues if their system is automatically converting end of line sequence from LF to CRLF. From 8a7fcffd1bbc26d909431f5e0f47e427c18d0847 Mon Sep 17 00:00:00 2001 From: eahmouck Date: Mon, 28 Jul 2025 15:19:52 +0200 Subject: [PATCH 3/3] Update scripts to use docker compose V2 instead of old docker-compose --- README.md | 33 ++++++++++--------- config/dev/cab-standalone/docker-compose.sh | 2 +- .../cab-standalone/nginx-cors-permissive.conf | 2 +- .../dev/cab-standalone/nginx-kubernetes.conf | 2 +- config/dev/cab-standalone/nginx.conf | 2 +- config/dev/cab-standalone/stopOpfab.sh | 2 +- .../docker-compose.bash | 2 +- config/dev/recommendation-service/nginx.conf | 2 +- docs/troubleshooting.md | 2 +- resources/README.md | 2 +- usecases_examples/PowerGrid/README.md | 4 +-- 11 files changed, 29 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 5cab8a5e..fe622d82 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ The platform uses the project **OperatorFabric** for notification management. ### Prerequisites - [Git (version 2.40.1)](https://git-scm.com/) -- [Docker (version 24.0.2)](https://www.docker.com/) -- [Docker Compose (version 1.25.0 or later)](https://www.docker.com/) +- [Docker Engine (version 27)](https://www.docker.com/) +- [Docker Compose V2](https://www.docker.com/) ### Setting Up the Environment @@ -63,7 +63,7 @@ Below are the steps to start all services. For other methods, please consult the ### Running All Services (Dev Mode) -1. Set-up environement variables +1. **Set-up environement variables** `VITE_POWERGRID_SIMU`, `VITE_RAILWAY_SIMU` , `VITE_ATM_SIMU` are the simulators' endpoints. @@ -79,31 +79,34 @@ export VITE_ATM_SIMU=http://[Service url]:[Service port] > **_NOTE:_** For this step, you should already have a running simulator. If not, you can use the simulator we provided as an example. For this, please follow the tutorial provided in InteractiveAI/usecases_examples/PowerGrid/ then set the VITE_POWERGRID_SIMU variable to http://YOUR_SERVER_ADDRESS:5100/ > > -2. Run InteractiveAI assistant +2. **Run InteractiveAI assistant** ```sh cd config/dev/cab-standalone ./docker-compose.sh ``` > **_NOTE:_** You will see the word cab (Cockpit Assistant Bidirectionnel) on most files in the project. Note that it was the initial project name of InteractiveAI. Might be updated later. -3. Setting up Keycloak `Frontend URL` - * **Access Keycloak Interface**: +3. **Setting up Keycloak `Frontend URL`** + * Access Keycloak Interface: - Ensure that your Keycloak instance is running and accessible. - Open a web browser and navigate to the Keycloak admin console, typically available at `http://localhost:89/auth/admin`. - * **Login to Keycloak Admin Console**: + * Login to Keycloak Admin Console: - Log in to the Keycloak admin console using your administrator credentials (`admin:admin` by default) - * **Navigate to Client Settings**: + * Configure frontendUrl: + - On the Keycloak admin console, locate and click on the "Realm Settings" section. + - In the Frontend URL setting, add the URL of your Assistant Platform frontend as a valid redirect URI. This URL is typically where your frontend application is hosted. For example, if your frontend is hosted locally for development purposes, you might add `http://localhost:3200/*`. + - After adding the frontend URL, save the changes to update the client settings. + * Configure Valid Redirect URIs: - On the Keycloak admin console, locate and click on the "Clients" section. - Select the client representing your Assistant Platform application. - * **Configure FrontendUrl**: - Within the client settings, look for the "Valid Redirect URIs" or similar configuration field. - - Add the URL of your Assistant Platform frontend as a valid redirect URI. This URL is typically where your frontend application is hosted. For example, if your frontend is hosted locally for development purposes, you might add `http://localhost:3200/*`. - - Ensure that the frontend URL you specify matches the actual URL where your frontend application is accessible. - * **Save Changes**: - - After adding the frontend URL, save the changes to update the client settings. + - Add the URL of your Assistant Platform frontend, it should match the one used in the frontendUrl setting. + - After adding the Valid Redirect URIs, save the changes to update the client settings. + + +4. **Load resources** -4. Load resources -**WARINING:** You need to restart the frontend after updating the URL on keycloak do it before loading the resources. +**WARNING:** You need to restart the frontend after updating the URL on keycloak do it before loading the resources. ```sh docker restart frontend ``` diff --git a/config/dev/cab-standalone/docker-compose.sh b/config/dev/cab-standalone/docker-compose.sh index 281eeeec..bac36288 100644 --- a/config/dev/cab-standalone/docker-compose.sh +++ b/config/dev/cab-standalone/docker-compose.sh @@ -44,4 +44,4 @@ fi echo "HOST_IP=${HOST_IP}" >> .env cat .env -docker-compose up -d +docker compose up -d diff --git a/config/dev/cab-standalone/nginx-cors-permissive.conf b/config/dev/cab-standalone/nginx-cors-permissive.conf index 3a6979ac..87c4e5f5 100644 --- a/config/dev/cab-standalone/nginx-cors-permissive.conf +++ b/config/dev/cab-standalone/nginx-cors-permissive.conf @@ -1,4 +1,4 @@ -# docker-compose DNS used to resolved keycloak services +# docker compose DNS used to resolved keycloak services resolver 127.0.0.11 ipv6=off; server { listen 80; diff --git a/config/dev/cab-standalone/nginx-kubernetes.conf b/config/dev/cab-standalone/nginx-kubernetes.conf index 0a47b524..3a331ce7 100644 --- a/config/dev/cab-standalone/nginx-kubernetes.conf +++ b/config/dev/cab-standalone/nginx-kubernetes.conf @@ -1,4 +1,4 @@ -# docker-compose DNS used to resolved users service +# docker compose DNS used to resolved users service # resolver 127.0.0.11 ipv6=off; # Log format to have msec in time + request processing time diff --git a/config/dev/cab-standalone/nginx.conf b/config/dev/cab-standalone/nginx.conf index bf718b7e..2631ed6b 100644 --- a/config/dev/cab-standalone/nginx.conf +++ b/config/dev/cab-standalone/nginx.conf @@ -1,4 +1,4 @@ -# docker-compose DNS used to resolved users service +# docker compose DNS used to resolved users service resolver 127.0.0.11 ipv6=off; # Log format to have msec in time + request processing time diff --git a/config/dev/cab-standalone/stopOpfab.sh b/config/dev/cab-standalone/stopOpfab.sh index 354ca1f4..43ca918a 100644 --- a/config/dev/cab-standalone/stopOpfab.sh +++ b/config/dev/cab-standalone/stopOpfab.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker-compose down -v \ No newline at end of file +docker compose down -v \ No newline at end of file diff --git a/config/dev/recommendation-service/docker-compose.bash b/config/dev/recommendation-service/docker-compose.bash index 1a4adccf..72e6e5db 100644 --- a/config/dev/recommendation-service/docker-compose.bash +++ b/config/dev/recommendation-service/docker-compose.bash @@ -25,4 +25,4 @@ fi echo "HOST_IP=${HOST_IP}" > .env -docker-compose -f "docker-compose-recommendation-service.yml" up --build +docker compose -f "docker-compose-recommendation-service.yml" up --build diff --git a/config/dev/recommendation-service/nginx.conf b/config/dev/recommendation-service/nginx.conf index 5cbc5a0c..b9ad9014 100644 --- a/config/dev/recommendation-service/nginx.conf +++ b/config/dev/recommendation-service/nginx.conf @@ -1,4 +1,4 @@ -# docker-compose DNS used to resolved keycloak services +# docker compose DNS used to resolved keycloak services resolver 127.0.0.11 ipv6=off; server { listen 80; diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 4e818862..c3c82cea 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -51,6 +51,6 @@ The .env should contain: HOST_IP= ``` -If the IP_Address is not your network IP address, please set it manually and run the system using native docker-compose commands. +If the IP_Address is not your network IP address, please set it manually and run the system using native docker compose commands. > **_NOTE:_** You are welcome to contribute with any issue that you encounter during setup. \ No newline at end of file diff --git a/resources/README.md b/resources/README.md index a1bbec0f..57e2b630 100644 --- a/resources/README.md +++ b/resources/README.md @@ -82,7 +82,7 @@ pip install -r requirements-app.txt 3. For the Docker environment, use the provided docker-compose.yml and Dockerfile. ``` cd PowerGrid -docker-compose up -d --build +docker compose up -d --build ``` # 2 Run the simulator diff --git a/usecases_examples/PowerGrid/README.md b/usecases_examples/PowerGrid/README.md index fb782d0f..2355bbee 100644 --- a/usecases_examples/PowerGrid/README.md +++ b/usecases_examples/PowerGrid/README.md @@ -68,7 +68,7 @@ pip install -r requirements-consol.txt 2. Launch the InteractiveAI event listener server, compatible with the console simulator. ```commandline -docker-compose up -d --build api +docker compose up -d --build api ``` The launched API might be accessible at this address: @@ -88,7 +88,7 @@ pip install -r requirements-app.txt **2. Launch the whole all in one web app simulator through docker on a computer (BEST APPROACH):** ```commandline -docker-compose up -d --build app +docker compose up -d --build app ``` The launched app might be accessible at this address: