Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #82 from opfab/develop
Browse files Browse the repository at this point in the history
1.3.1.RELEASE

Signed-off-by: OUESLATI Wyem Ext <wyem.oueslati@rte-france.com>
  • Loading branch information
woueslati authored Oct 8, 2021
2 parents 9c1379f + df37473 commit 3328210
Show file tree
Hide file tree
Showing 148 changed files with 4,159 additions and 1,858 deletions.
1 change: 0 additions & 1 deletion LETSCO_SHORT_VERSION

This file was deleted.

1 change: 1 addition & 0 deletions LETSCO_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.3.1.RELEASE
1 change: 0 additions & 1 deletion OPFAB_FULL_VERSION

This file was deleted.

1 change: 1 addition & 0 deletions OPFAB_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.10.0.RELEASE
35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To use Let's Coordinate, you need a linux OS with the following:

**Please note**:
* It is highly recommended to use [sdkman](https://sdkman.io/) (v5.11.0 or grater) and [nvm](https://github.com/nvm-sh/nvm) (v14.11.0 or grater) to manage *Maven*, *Java*, *NPM* and *Node JS* tools versions (with sdkman and nvm, the previously mentioned tools will be automatically installed later).
* The required OperatorFabric version is **2.8.0.RELEASE** (configured by default to be used with the current version of Let's Coordinate 1.3.0.RELEASE)
* The required OperatorFabric version is **2.10.0.RELEASE** (configured by default to be used with the current version of Let's Coordinate 1.3.1.RELEASE)

## 2. Setup and run Let's Coordinate

Expand All @@ -37,7 +37,7 @@ git clone https://github.com/opfab/letscoordinate.git

#### 2.2. Create test branch

Before starting Let's Coordinate, it's recommended to create a test branch from the latest stable release (1.3.0.RELEASE in our case).
Before starting Let's Coordinate, it's recommended to create a test branch from the latest stable release (1.3.1.RELEASE in our case).
To do this, you first need to make sure that you have the latest tag list from your remote repository:

```
Expand All @@ -47,7 +47,7 @@ git fetch --all --tags
Then, you can create the test branch:

```
git checkout tags/1.3.0.RELEASE -b test-letsco-1.3.0.RELEASE
git checkout tags/1.3.1.RELEASE -b test-letsco-1.3.1.RELEASE
```

#### 2.3. Run Let's Coordinate
Expand Down Expand Up @@ -75,27 +75,32 @@ source ./load_environment.sh
To start Let's Coordinate, position your self in the "*bin*" directory and execute the following commands:

```
./server.sh -f start
./server.sh --build start
```

The ```-f``` option (or ```--first-init```, which is equivalent to the options ```--build``` and ```--init``` together) is required while testing the project for the first time.
It allows to:
* install the OperatorFabric required dependencies,
* build and deploy the Let's Coordinate docker images locally,
* send bundles and configurations to the OperatorFabric server,
* initialize the OperatorFabric database with required data (users, groups, perimeters, entities, ...)
This command (with ```--build``` or ```-b``` option) allows to:
* install the OperatorFabric required dependencies
* build and deploy the Let's Coordinate docker images locally

**Please note**: With Ubuntu operation system, it is highly recommended to run the 2 scripts separately (the script ```./server.sh --build start``` and then ```./server.sh --init start```).
When the first command is executed correctly, please run the following command:

For next usage of the *server.sh* script, the *--first-init* option is not necessary.
```
./server.sh --init start
```

This command (with ```--init``` or ```-i``` option) allows to:
* send bundles and configuration files to the OperatorFabric server,
* initialize the OperatorFabric database with required data (users, groups, perimeters, entities, ...)

For next usage of the ```server.sh``` script, the ```--build``` and ```--init``` options are not necessary.

To be sure that all the services are correctly started, you can try the following command:

```
./server.sh status
```

To see more about the server.sh commands and options, please try:
To see more about the ```server.sh``` commands and options, please try:
```
./server.sh --help
```
Expand Down Expand Up @@ -137,7 +142,9 @@ Feel free to test the other json samples from the directory "*util/messages_mode
- Click on *POST /letsco/api/v1/upload/save*
- Click on *Try it out*
- Copy the previous generated token (see section 3.1) and past it in the *Authorization* field (be sure that the copied text starts with the "Bearer" keyword!)
- Click the "*Browse...*" button and choose the file "*util/messages_models/json/rsc_kpi_report/kpi_use_cases.json*".
- Click on the "*Browse...*" button and choose the file "*util/messages_models/json/rsc_kpi_report/kpi_use_cases_service_a.json*".
- Click on *Execute*
- Click again on the "*Browse...*" button and choose the file "*util/messages_models/json/rsc_kpi_report/kpi_use_cases_service_b.json*".
- Click on *Execute*
- Connect to OpFab ([http://localhost/ui/](http://localhost/ui/)) with the username **user.test** and password **test**.
- Select the *"RSC KPI Report"* menu.
Expand Down
8 changes: 2 additions & 6 deletions bin/build_snapshot_docker_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ mvn clean package -DskipTests=true

# build docker images for letsco-api
cd ${LC_HOME}/dockerfiles/back
./build_docker_image.sh ${LC_VERSION}.snapshot

# build docker images for letsco-data-provider
cd ${LC_HOME}/dockerfiles/data-provider
./build_docker_image.sh ${LC_VERSION}.snapshot
./build_docker_image.sh --tag=${LC_VERSION}

# build docker images for letsco-front
cd ${LC_HOME}/dockerfiles/front
./build_docker_image.sh ${LC_VERSION}.snapshot
./build_docker_image.sh --tag=${LC_VERSION}
55 changes: 43 additions & 12 deletions bin/config/templates/common.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,65 @@
# SPDX-License-Identifier: MPL-2.0
# This file is part of the Let’s Coordinate project.

management:
endpoints:
web:
exposure:
include: '*'
server:
forward-headers-strategy: framework
spring:
rabbitmq:
host: rabbitmq
port: 5672
username: guest
password: guest
security:
provider-url: http://keycloak:8080
provider-realm: dev
oauth2:
resourceserver:
jwt:
jwk-set-uri: http://keycloak:8080/auth/realms/dev/protocol/openid-connect/certs
jwk-set-uri: ${spring.security.provider-url}/auth/realms/${spring.security.provider-realm}/protocol/openid-connect/certs
data:
mongodb:
database: operator-fabric
uri: mongodb://root:password@mongodb:27017/operator-fabric?authSource=admin&authMode=scram-sha1
security:
basic:
enabled: false

operatorfabric:
security:
oauth2:
client-id: opfab-client
jwt:
login-claim: preferred_username
expire-claim: exp
businessLogActivated: true
servicesUrls:
users: "http://${DOCKER_IP}:2103"

### activate the following if you want to the groups or entities to come from the token and not mongo DB
# security:
# jwt:

### activate the folLowing if you want the entities of the user to come from the token and not mongoDB
### entitiesIdClaim is the name of the field in the token
# entitiesIdClaim : entitiesId
# gettingEntitiesFromToken: true
###

### activate the following if you want the groups of the user to come from the token and not mongoDB
# groups:
# mode: JWT
# rolesClaim:
# rolesClaimStandard:
# - path: "ATTR1"
# - path: "ATTR2"
# rolesClaimStandardArray:
# - path: "resource_access/opfab-client/roles"
# rolesClaimStandardList:
# - path: "groups"
# separator: ";"
# rolesClaimCheckExistPath:
# - path: "resource_access/AAA"
# roleValue: "roleAAA"
# - path: "resource_access/BBB"
# roleValue: "roleBBB"
###
message: common message
management:
endpoints:
web:
exposure:
include: '*'
7 changes: 4 additions & 3 deletions bin/config/templates/web-ui.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
"display": "PUBLICATION"
},
"hideAckFilter": false,
"hideAckAllCardsFeature": false
"hideAckAllCardsFeature": false,
"secondsBeforeLttdForClockDisplay": 1209600
},
"notify": false,
"subscription": {
Expand Down Expand Up @@ -172,12 +173,12 @@
"operatorfabric": {
"name": "OperatorFabric",
"rank": 0,
"version": "2.8.0.RELEASE"
"version": "2.10.0.RELEASE"
},
"letscoordinate": {
"name": "Let's Coordinate OS",
"rank": 1,
"version": "1.3.0.RELEASE"
"version": "1.3.1.RELEASE"
}
},
"infos": {
Expand Down
13 changes: 2 additions & 11 deletions bin/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ services:
command: ['--default-time-zone=+00:00', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
letsco-api:
container_name: letsco-api
image: letscoordinate/letsco-api:latest
image: letscoordinate/backend:${LC_VERSION}
depends_on:
- mariadb
- kafka
Expand All @@ -65,18 +65,9 @@ services:
- TZ=Europe/Paris
- OPFAB_PROCESS_WITH_FILENAME=true
restart: always
letsco-data-provider:
container_name: letsco-data-provider
image: letscoordinate/letsco-data-provider:latest
depends_on:
- kafka
user: ${USER_ID}:${USER_GID}
ports:
- 8082:8082
restart: always
letsco-front:
container_name: letsco-front
image: letscoordinate/letsco-front:latest
image: letscoordinate/frontend:${LC_VERSION}
depends_on:
- letsco-api
# user: ${USER_ID}:${USER_GID}
Expand Down
4 changes: 2 additions & 2 deletions bin/load_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
export LC_HOME=$(realpath $DIR/..)
export LC_VERSION=$(cat "$LC_HOME/LETSCO_SHORT_VERSION")
export OF_VERSION=$(cat "$LC_HOME/OPFAB_FULL_VERSION")
export LC_VERSION=$(cat "$LC_HOME/LETSCO_VERSION")
export OF_VERSION=$(cat "$LC_HOME/OPFAB_VERSION")

echo -e "\033[0;32mPREPARING ENVIRONMENT VARIABLES...\033[0m"
echo
Expand Down
4 changes: 3 additions & 1 deletion bin/server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function helpCommand() {
echo -e "\t\t\t (useful with start and restart commands)"
echo -e "\t-f, --first-init: equivalent to using --build and --init options together"
echo -e "\t\t\t (useful with start and restart commands)"
echo -e "\t-h, --help\t: get help on a command\n"
echo -e "\t-h, --help\t: display help\n"
echo -e "Commands:"
echo -e "\tstart\t\t: start the server"
echo -e "\trestart\t\t: stop and start the server"
Expand Down Expand Up @@ -87,6 +87,8 @@ function initIfAsked() {
sudo chown -R $USER:$USER ${LC_HOME}/opfab/operatorfabric-getting-started/server/businessconfig-storage
cd ${LC_HOME}/opfab/prepare-opfab-env/web-ui-config
./send-processes-groups.sh
cd ${LC_HOME}/opfab/prepare-opfab-env/monitoringConfig
./loadMonitoringConfig.sh monitoringConfig.json
echo
fi
}
Expand Down
60 changes: 52 additions & 8 deletions dockerfiles/back/build_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,59 @@
# SPDX-License-Identifier: MPL-2.0
# This file is part of the Let’s Coordinate project.

if [ ! -z $1 ]; then
tag=$1
echo "Tag: ${tag}"
function helpCommand() {
echo -e "\nThis script allows the generation and the publication of the \"letscoordinate/backend\" images\n"
echo -e "Usage:"
echo -e "\tbuild_docker_image.sh [OPTIONS]\n"
echo -e "Options:"
echo -e "\t--tag\t\t: provide the tag for which the docker images will be generated"
echo -e "\t\t\t (this option is required)"
echo -e "\t--push, -p\t: publish the docker images"
echo -e "\t\t\t (when this option is provided, the generated docker images will be pushed to dockerhub)"
echo -e "\t--help, -h\t: display help\n"
echo -e "Usage samples:"
echo -e "\t./build_docker_image.sh --tag=1.3.1.SNAPSHOT"
echo -e "\t./build_docker_image.sh --tag=1.3.1.RELEASE --push"
echo -e "\t./build_docker_image.sh --help\n"
}

### PROCESSING STARTS HEAR! ###

tag=NOT_DEFINED
push=false

while [[ $# -gt 0 ]]
do
key="$1"

if [[ ${key} =~ ^'--tag='.* ]]; then
tag=${key#*'--tag='}
elif [[ ${key} == '--push' || ${key} == '-p' ]]; then
push=true
elif [[ ${key} == '--help' || ${key} == '-h' ]]; then
helpCommand
exit 0
else
echo "You must specify a tag"
exit 1
echo 'Unknown param found! (will be ignored) =>' ${key}
fi
shift
done

if [ -z "${tag}" ] || [ "${tag}" = "NOT_DEFINED" ]; then
echo 'You should provide a valid tag!'
exit 1;
fi

echo 'TAG:' ${tag}

cp -r ${LC_HOME}/letsco-api/target/letsco-api-${tag}-exec.jar ${LC_HOME}/dockerfiles/back/letsco-api.jar

cp -r ${LC_HOME}/letsco-api/target/letsco-api-${LC_VERSION}*-exec.jar ${LC_HOME}/dockerfiles/back/letsco-api.jar
echo 'Build letscoordinate/backend docker images (latest and '${tag}')'
docker build --tag=letscoordinate/backend:latest -f ./Dockerfile .
docker build --tag=letscoordinate/backend:${tag} -f ./Dockerfile .

docker build --tag=letscoordinate/letsco-api:latest -f ./Dockerfile .
#docker build --tag=letscoordinate/letsco-api:${tag} -f ./Dockerfile .
if [ ${push} == true ]; then
echo 'Push letscoordinate/backend docker images (latest and '${tag}')'
docker push letscoordinate/backend:latest
docker push letscoordinate/backend:${tag}
fi
23 changes: 0 additions & 23 deletions dockerfiles/data-provider/build_docker_image.sh

This file was deleted.

Loading

0 comments on commit 3328210

Please sign in to comment.