Commit 2f6e9c3c authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

Resolve "Improve Help scripts under services"

parent 9756234d
Loading
Loading
Loading
Loading
+52 −12
Original line number Original line Diff line number Diff line
@@ -14,7 +14,8 @@
  - [Using Curl](#using-curl)
  - [Using Curl](#using-curl)
  - [Using PostMan](#using-postman)
  - [Using PostMan](#using-postman)
- [Important urls:](#important-urls)
- [Important urls:](#important-urls)
  - [Mongo DB Dashboard](#mongo-db-dashboard)
  - [Mongo CAPIF's DB Dashboard](#mongo-capifs-db-dashboard)
  - [Mongo Register's DB Dashboard](#mongo-registers-db-dashboard)
- [FAQ Documentation](#faq-documentation)
- [FAQ Documentation](#faq-documentation)
- [CAPIF Release 0](#capif-release-0)
- [CAPIF Release 0](#capif-release-0)


@@ -61,7 +62,13 @@ This will build and run all services using docker images, including mongodb and


Nginx deployed by default use **capifcore** hostname, but can add a parameter when run.sh is executed setting a different hostname, for example,
Nginx deployed by default use **capifcore** hostname, but can add a parameter when run.sh is executed setting a different hostname, for example,
```
```
./run.sh openshift.evolved-5g.eu
./run.sh -c openshift.evolved-5g.eu
```

Also you can run monitoring just using option -m true, for example:
```
./run.sh -m true
./run.sh -m true -c openshift.evolved-5g.eu
```
```


If you want to check if all CAPIF services are running properly in local machine after execute run.sh, we can use:
If you want to check if all CAPIF services are running properly in local machine after execute run.sh, we can use:
@@ -70,31 +77,54 @@ If you want to check if all CAPIF services are running properly in local machine
```
```
This shell script will return 0 if all services are running properly.
This shell script will return 0 if all services are running properly.


When we need to stop CAPIF services, we can use next bash script:
When we need to stop all CAPIF services, we can use next bash script:
```
```
./clean_capif_docker_services.sh
./clean_capif_docker_services.sh -a
```
```


or also the next script:
NOTE: You can use different flags if you only want to stop some of them, please check help using
```
./stop.sh
```
```
./clean_capif_docker_services.sh -h

Usage: clean_capif_docker_services.sh <options>
       -c : clean capif services
       -v : clean vault service
       -r : clean register service
       -m : clean monitoring service
       -a : clean all services
       -h : show this help
``````


This shell script will remove and clean all CAPIF services started previously with run.sh
This shell script will remove and clean all CAPIF services started previously with run.sh


On the other hand you can check logs using show_logs.sh script, please check options:
```
./show_logs.sh
You must specify an option before run script.
Usage: ./show_logs.sh <options>
       -c : Show capif services
       -v : Show vault service
       -r : Show register service
       -m : Show monitoring service
       -a : Show all services
       -f : Follow log output
       -h : Show this help
```
You can also use option -f in order to live follow log output

### Run All CAPIF Services locally with Docker images and deploy monitoring stack
### Run All CAPIF Services locally with Docker images and deploy monitoring stack
It is now possible to deploy a monitoring stack for CAPIF with Grafana, Prometheus, FluentBit, Loki, Cadvisor, Tempo and Opentelemetry.
It is now possible to deploy a monitoring stack for CAPIF with Grafana, Prometheus, FluentBit, Loki, Cadvisor, Tempo and Opentelemetry.


To deploy CAPIF together with the monitoring stack, it is only necessary to execute the following.
To deploy CAPIF together with the monitoring stack, it is only necessary to execute the following.


```
```
./run.sh --m true
./run.sh -m true
```
```


After they have been built, the different panels can be consulted in Grafana at the url
After they have been built, the different panels can be consulted in Grafana at the url


```
```
http:<0.0.0.0>:3000
http://localhost:3000
```
```


By default, the monitoring option is set to false. Once up, all data sources and dashboards are automatically provisioned
By default, the monitoring option is set to false. Once up, all data sources and dashboards are automatically provisioned
@@ -142,14 +172,24 @@ Also you have here the [POSTMAN Collection](docs/testing_with_postman/CAPIF.post


# Important urls:
# Important urls:


## Mongo DB Dashboard
## Mongo CAPIF's DB Dashboard
```
```
http://0.0.0.0:8082/ (if accessed from localhost) 
http://localhost:8082/ (if accessed from localhost) 


or
or


http://<Mongo Express Host IP>:8082/ (if accessed from another host)
http://<Mongo CAPIF Express Host IP>:8082/ (if accessed from another host)
```
```

## Mongo Register's DB Dashboard
```
http://localhost:8083/ (if accessed from localhost) 

or

http://<Mongo Register Express Host IP>:8083/ (if accessed from another host)
```

# FAQ Documentation
# FAQ Documentation


Frequently asked questions can be found here: [FAQ Directory]
Frequently asked questions can be found here: [FAQ Directory]
+60 −23
Original line number Original line Diff line number Diff line
#!/bin/bash


# docker-compose -f "docker-compose-capif.yml" down  --rmi all --remove-orphans
help() {
# docker network rm capif-network
  echo "Usage: $1 <options>"

  echo "       -c : Clean capif services"
# status=$?
  echo "       -v : Clean vault service"
# if [ $status -eq 0 ]; then
  echo "       -r : Clean register service"
#     echo "*** All Capif services are cleaned ***"
  echo "       -m : Clean monitoring service"
# else
  echo "       -a : Clean all services"
#     echo "*** Some Capif services failed on clean ***"
  echo "       -h : show this help"
# fi
  exit 1
}


# exit $status
if [[ $# -lt 1 ]]
then
  echo "You must specify an option before run script."
  help
fi


#!/bin/bash
FILES=()
echo "${FILES[@]}"


# Verificar el parámetro proporcionado
# Read params
if [[ $# -eq 0 || "$1" == "capif" ]]; then
while getopts "cvrahm" opt; do
  FILES=("docker-compose-capif.yml")
  case $opt in
elif [[ "$1" == "all" ]]; then
    c)
  FILES=("docker-compose-capif.yml" "docker-compose-vault.yml" "docker-compose-register.yml" "../monitoring/docker-compose.yml" "docker-compose-backoffice.yml")
      echo "Remove Capif services"
else
      FILES+=("docker-compose-capif.yml")
  echo "Parámetro inválido. Uso: ./script.sh [capif|all]"
      ;;
    v)
      echo "Remove vault service"
      FILES+=("docker-compose-vault.yml")
      ;;
    r)
      echo "Remove register service"
      FILES+=("docker-compose-register.yml")
      ;;
    m)
      echo "Remove monitoring service"
      FILES+=("../monitoring/docker-compose.yml")
      ;;
    a)
      echo "Remove all services"
      FILES=("docker-compose-capif.yml" "docker-compose-vault.yml" "docker-compose-register.yml" "../monitoring/docker-compose.yml")
      ;;
    h)
      help
      ;;
    \?)
      echo "Not valid option: -$OPTARG" >&2
      help
      exit 1
      exit 1
fi
      ;;
    :)
      echo "The -$OPTARG option requires an argument." >&2
      help
      exit 1
      ;;
  esac
done
echo "after check"
echo "${FILES[@]}"


# Recorrer los archivos Docker Compose y ejecutar docker-compose down
for FILE in "${FILES[@]}"; do
for FILE in "${FILES[@]}"; do
  echo "Ejecutando 'docker-compose down' para el archivo $FILE"
  echo "Executing 'docker-compose down' for file $FILE"
  docker-compose -f "$FILE" down --rmi all
  docker-compose -f "$FILE" down --rmi all
  status=$?
  status=$?
    if [ $status -eq 0 ]; then
    if [ $status -eq 0 ]; then
@@ -37,4 +74,4 @@ done


docker network rm capif-network
docker network rm capif-network


echo "Operación completada."
echo "Clean complete."
+18 −7
Original line number Original line Diff line number Diff line
#!/bin/bash
#!/bin/bash


help() {
  echo "Usage: $1 <options>"
  echo "       -c : Setup different hostname for capif"
  echo "       -m : Clean monitoring service"
  echo "       -h : show this help"
  exit 1
}

HOSTNAME=capifcore
HOSTNAME=capifcore
MONITORING_STATE=false
MONITORING_STATE=false
DEPLOY=all
DEPLOY=all
@@ -20,21 +28,24 @@ else
fi
fi


# Read params
# Read params
while getopts ":h:m:" opt; do
while getopts ":c:m:h" opt; do
  case $opt in
  case $opt in
    h)
    c)
      HOSTNAME="$OPTARG"
      HOSTNAME="$OPTARG"
      ;;
      ;;
    m)
    m)
      MONITORING_STATE="$OPTARG"
      MONITORING_STATE="$OPTARG"
      ;;
      ;;
    h)
      help
      ;;  
    \?)
    \?)
      echo "Opción no válida: -$OPTARG" >&2
      echo "Not valid option: -$OPTARG" >&2
      exit 1
      help
      ;;
      ;;
    :)
    :)
      echo "La opción -$OPTARG requiere un argumento." >&2
      echo "The -$OPTARG option requires an argument." >&2
      exit 1
      help
      ;;
      ;;
  esac
  esac
done
done

services/show_logs.sh

0 → 100755
+81 −0
Original line number Original line Diff line number Diff line
#!/bin/bash

help() {
  echo "Usage: $0 <options>"
  echo "       -c : Show capif services"
  echo "       -v : Show vault service"
  echo "       -r : Show register service"
  echo "       -m : Show monitoring service"
  echo "       -a : Show all services"
  echo "       -f : Follow log output"
  echo "       -h : Show this help"
  exit 1
}

if [[ $# -lt 1 ]]
then
  echo "You must specify an option before run script."
  help
fi

FILES=()
echo "${FILES[@]}"
FOLLOW=""

# Read params
while getopts "cvrahmf" opt; do
  case $opt in
    c)
      echo "Show Capif services"
      FILES+=("-f docker-compose-capif.yml")
      ;;
    v)
      echo "Show vault service"
      FILES+=("-f docker-compose-vault.yml")
      ;;
    r)
      echo "Show register service"
      FILES+=("-f docker-compose-register.yml")
      ;;
    m)
      echo "Show monitoring service"
      FILES+=("-f ../monitoring/docker-compose.yml")
      ;;
    a)
      echo "Show all services"
      FILES=("-f docker-compose-capif.yml" -f "docker-compose-vault.yml" -f "docker-compose-register.yml" -f "../monitoring/docker-compose.yml")
      ;;
    f)
      echo "Setup follow logs"
      FOLLOW="-f"
      ;;
    h)
      help
      ;;
    ?)
      echo "Not valid option: -$OPTARG" >&2
      help
      exit 1
      ;;
    :)
      echo "The -$OPTARG option requires an argument." >&2
      help
      exit 1
      ;;
    \*)
      echo "Not valid parameter $opt"
      help
      exit 1
      ;;
  esac
done

if [[ $1 =~ ^- ]]
then
  echo "${FILES[@]}"
else
  help
fi

docker compose ${FILES[@]} logs ${FOLLOW}
Loading