Commit 9a16b69a authored by Jean Meurice's avatar Jean Meurice

PowerTrain merge

parents d21b5ce6 af41c827
Pipeline #189833 failed with stages
in 24 minutes and 1 second

Too many changes to show.

To preserve performance only 64 of 64+ files are displayed.

......@@ -12,24 +12,12 @@ stages:
- windows
- linux
#masterJobLinux:
# stage: linux
# image: maven:3-jdk-8
# before_script:
# - apt-get update
# - apt-get install -y openjfx
# script:
# - mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean deploy --settings settings.xml
# - cat target/site/jacoco/index.html
# - mvn package sonar:sonar -s settings.xml
# only:
# - master
masterJobWindowsRpc:
stage: windows
script:
- cd rpc
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean deploy --settings ..\settings.xml
- mvn package sonar:sonar --settings ..\settings.xml -DskipTests
tags:
- Windows10
only:
......@@ -41,6 +29,7 @@ masterJobWindowsRestful:
- cd restful
# TODO: we have to skip tests for now, because most tests require a running instance of zookeeper
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean deploy --settings ..\settings.xml -DskipTests
- mvn package sonar:sonar --settings ..\settings.xml -DskipTests
tags:
- Windows10
only:
......@@ -67,22 +56,32 @@ branchJobWindowsRestful:
except:
- master
#BranchJobLinux:
# tags:
# - docker
# stage: linux
# image: maven:3-jdk-8
# before_script:
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# script:
## - apt-get update
## - apt-get install -y openjfx
# - cd restful
# - ./run_test.sh
## - docker tag rmi-server:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
## - docker tag rmi-server:latest $CI_REGISTRY_IMAGE:latest
## - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
## - docker push $CI_REGISTRY_IMAGE:latest
# # - mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean install --settings settings.xml
# except:
# - master
# run tests
branchJobLinux:
tags:
- docker
stage: linux
script:
- cd docker
- ./build.sh
- ./run_test.sh
except:
- master
# build, test and publish docker images
masterJobLinux:
tags:
- docker
stage: linux
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- cd docker
- ./build.sh
- ./run_test.sh
- docker tag rpc-server:latest $CI_REGISTRY_IMAGE:rpc
- docker tag restful-server:latest $CI_REGISTRY_IMAGE:restful
- docker push $CI_REGISTRY_IMAGE:rpc
- docker push $CI_REGISTRY_IMAGE:restful
only:
- master
......@@ -4,6 +4,47 @@
Server repository contains a project binding all modules for running the _simulator_ together with _visualization_ using client/server architecture. The project is based on _SmartFoxServer_ development kit and therefore has to be deployed on running _SmartFoxServer 2X_ server. To provide accessible web application, the _visualization_ project has to be built to _.war_ file and then deployed as a web application on the embedded in SFS _Jetty_ server.
# Server 2.0
## Install
```bash
$ mvn clean install -DskipTests -settings=../settings.xml
```
After installation, the executables can be found in restful/target and rpc/target directory.
To use them, please refer to corresponding instructions:
[rpc](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/simulators/server/blob/master/rpc/README.md)
and
[restful](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/simulators/server/blob/master/restful/README.md)
## Docker(optional)
Build the docker images:
```bash
$ cd docker
$ ./build.sh
```
Test:
```bash
$ cd docker
$ ./run_test.sh
```
README of [restful](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/simulators/server/blob/master/restful/README.md)
includes instructions of how to use docker to run this project.
## Just have a look
If you don't want to compile the whole project and just want to have a taste of this project,
you can simply run:
```bash
$ cd docker
$ docker-compose up
```
This will start a pure backend application. Now you can use the
[RESTful API](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/simulators/server/blob/master/restful/README.md)
to play with the simulation.
API doc can be found at [127.0.0.1:8090/swagger-ui.html](127.0.0.1:8090/swagger-ui.html)
To try it with visualization, download
[visualization project](https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/simulators/visualization),
uncomment the `nginx` part of `docker/docker-compose.yml`, comment or remove the `ports` field of `server`.
# Portable version
A portable version for Windows of the SmartFoxServer based simulator together with a portable PostgreSQL database is available as [archive](https://github.com/MontiSim/server/releases/download/portable/distributed-simulator.zip). Running the portable version can be done by running the `start-script.bat` file, provided in the archive.
......
FROM maven:3-jdk-8 AS montisim-server-builder
WORKDIR /app
COPY . .
RUN apt-get update && \
apt-get install -y --no-install-recommends metis && \
rm -rf /var/lib/apt/lists/* && \
mvn install -s settings.xml -DskipTests && \
cp rpc/target/rpc-*-jar-with-dependencies.jar rpc/target/rpc.jar && \
find restful/target -regex '.*restful-[0-9.]+\.jar' | \
xargs -i cp {} restful/target/restful.jar
#!/usr/bin/env bash
CURR_DIR=$(pwd)
cd ..
docker build -f "${CURR_DIR}/Dockerfile" -t montisim-server-builder .
cd rpc
./build.sh
cd ../restful
./build.sh
......@@ -9,45 +9,59 @@ version: "3"
services:
zoo1:
image: zookeeper
image: zookeeper:3.4
restart: always
hostname: zoo1
ports:
- 2181:2181
environment:
ZOO_MY_ID: 1
ZOO_SERVERS: server.1=0.0.0.0:2888:3888
web:
image: montisim-server
ports:
- 5001:5001
depends_on:
- rmi-server
- rpc-server
volumes:
- ../research/web:/app
rmi-server:
image: rmi-server:latest
image: registry.git.rwth-aachen.de/monticore/embeddedmontiarc/simulators/rmimodelserver:latest
depends_on:
- zoo1
# ports:
# - 10101:10101
restart: always
# hostname: rmi-server
environment:
ZOO_SERVERS: zoo1
ZOO_SERVERS: zoo1:2181
entrypoint:
- java
- -cp
- rmi-model-server.jar
- -Djava.rmi.server.codebase=file:rmi-model-server.jar
- -Djava.rmi.server.useLocalHostname
- rwth.rmi.model.server.RMIServer
- "10101"
- autopilots
- no_time
- os=linux
rpc-server:
image: rpc-server:latest
image: registry.git.rwth-aachen.de/monticore/embeddedmontiarc/simulators/server:rpc
depends_on:
- zoo1
# ports:
# - 6000:6000
# - 8787:8787
restart: always
environment:
ZOO_SERVERS: zoo1
volumes:
- ../rpc/target:/app
ZOO_SERVERS: zoo1:2181
# uncomment below to enable multi-sector trajectory re-planning
# SIM_SERVER: server
# SIM_PORT: 8090
server:
image: registry.git.rwth-aachen.de/monticore/embeddedmontiarc/simulators/server:restful
depends_on:
- zoo1
ports:
- 8090:8090
restart: always
environment:
ZOO_SERVERS: zoo1:2181
# nginx:
# image: nginx:1.17
# ports:
# - 8090:8090
# restart: always
# volumes:
# - ./nginx.conf:/etc/nginx/nginx.conf:ro
# # edit line below to use visualization
# - /path/to/visualization/src/main/webapp:/app
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
client_max_body_size 50m;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
# montisim-server-restful backend
server {
listen 8090;
server_name 127.0.0.1;
root /app;
add_header Access-Control-Allow-Origin * always;
add_header Access-Control-Allow-Methods '*' always;
location / {
proxy_pass http://server:8090;
}
}
# include servers/*;
}
......@@ -32,8 +32,8 @@ SIMULATOR_DIR="${CURR_DIR}/../rpc"
# prepare docker image for rpc-server
#cd $SIMULATOR_DIR
#mvn clean install -s ../settings.xml -DskipTests
#./build.sh
# mvn clean install -s ../settings.xml -DskipTests
#../restful/build.sh
# create network
docker network create simulation-network
......@@ -43,6 +43,7 @@ docker run \
--network="simulation-network" \
-d \
--name=zookeeper \
-e "ZOO_MAX_CLIENT_CNXNS=1024" \
zookeeper:latest
# start autopilot server(RMIServer)
......@@ -53,7 +54,7 @@ docker run \
-e "ZOO_SERVERS=zookeeper" \
registry.git.rwth-aachen.de/monticore/embeddedmontiarc/simulators/rmimodelserver:latest \
java -cp rmi-model-server.jar -Djava.rmi.server.codebase=file:rmi-model-server.jar \
-Djava.rmi.server.hostname=localhost rwth.rmi.model.server.RMIServer 10101 autopilots no_time os_linux
-Djava.rmi.server.useLocalHostname rwth.rmi.model.server.RMIServer 10101 autopilots no_time os_linux
docker run \
--network="simulation-network" \
......@@ -62,19 +63,19 @@ docker run \
--name=rpc-server \
rpc-server:latest
cd $CURR_DIR
docker build -t server-test-runner -f TestDockerfile ..
docker run --rm --network="simulation-network" -e "ZOO_SERVERS=zookeeper" server-test-runner sh -c "cd restful && mvn test -s ../settings.xml"
# build simulator
#cd $SIMULATOR_DIR
#mvn install -s ../settings.xml -DskipTests
cd ${CURR_DIR}
#docker build -t server-test-runner -f ./docker/TestDockerfile .
docker run \
--rm --network="simulation-network" \
-e "ZOO_SERVERS=zookeeper" \
montisim-server-builder sh -c "cd restful && mvn test -s ../settings.xml" \
2>&1 | tee result.txt
#cd "${SIMULATOR_DIR}/target"
# start rpc-server(remote simulator)
#java -cp "rpc-1.0.0-SNAPSHOT-jar-with-dependencies.jar:." server.rpc.RpcServer 6000 > /dev/null &
dockerCleanUp
#cd $CURR_DIR
#mvn test -s ../settings.xml
tail -10 result.txt | grep "BUILD SUCCESS"
# code=0 if "BUILD SUCCESS" is found in the end of result.txt
code=$?
echo $code
exit $code
dockerCleanUp
#!/usr/bin/env bash
# This script re-compile all *.fmu files in the current directory using
# current available c++ compiler. This makes the fmu files compatible with
# the host OS.
# For example if you have .fmu files exported from ModelicaEditor running
# in Windows but you need linux version. To make these .fmu files compatible
# with linux, you should:
# 1. import and re-export the Windows version .fmu files using linux ModelicaEditor
# 2. copy this script in the same directory where the re-exported .fmu files are located
# 3. run this script with ./recompile_fmu.sh
# 4. all .fmu files should be re-compiled and compatible with linux
tmp_dir=./unzip_dir
function compile() {
filename="$1"
unzip $filename -d $tmp_dir
cd ${tmp_dir}/sources && ./configure && make
cd ../..
zip -r $filename $tmp_dir
rm -rf $tmp_dir
echo "$filename"
}
for f in ./*.fmu; do
compile "$f"
done
#!/usr/bin/env bash
# This script re-compile all *.fmu files in the current directory using
# current available c++ compiler. This makes the fmu files compatible with
# the host OS.
# For example if you have .fmu files exported from ModelicaEditor running
# in Windows but you need linux version. To make these .fmu files compatible
# with linux, you should:
# 1. import and re-export the Windows version .fmu files using linux ModelicaEditor
# 2. copy this script in the same directory where the re-exported .fmu files are located
# 3. run this script with ./recompile_fmu.sh
# 4. all .fmu files should be re-compiled and compatible with linux
tmp_dir=./unzip_dir
function compile() {
filename="$1"
unzip $filename -d $tmp_dir
cd ${tmp_dir}/sources && ./configure && make
cd ../..
zip -r $filename $tmp_dir
rm -rf $tmp_dir
echo "$filename"
}
for f in ./*.fmu; do
compile "$f"
done
******************************************************************************
MontiCAR Modeling Family, www.se-rwth.de
Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
All rights reserved.
This project is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this project. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8" ?>
<!--
(c) https://github.com/MontiCore/monticore
The license generally applicable for this project
can be found under https://github.com/MontiCore/monticore.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<?xml version="1.0" encoding="UTF-8"?>
<!-- (c) https://github.com/MontiCore/monticore -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>server</artifactId>
<groupId>montisim</groupId>
<version>2.0.1</version>
<packaging>jar</packaging>
<artifactId>server</artifactId>
<groupId>montisim-server</groupId>
<version>${revision}</version>
<packaging>pom</packaging>
<!--<modules>-->
<!--<module>rpc</module>-->
<!--<module>restful</module>-->
<!--</modules>-->
<modules>
<module>rpc</module>
<module>restful</module>
</modules>
<properties>
<montisim.commons.version>1.0.10</montisim.commons.version>
<montisim.simulation.version>2.0.3</montisim.simulation.version>
<montisim.controller.version>1.0.4</montisim.controller.version>
<montisim.rmimodelserver.version>1.1.4</montisim.rmimodelserver.version>
<montisim.simlang.version>1.0.1</montisim.simlang.version>
<properties>
<revision>2.2.1</revision>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<smartfox.version>2.13</smartfox.version>
<smartfox.version>2.13</smartfox.version>
<montisim.version>1.0.1</montisim.version>
<!-- .. Plugins ....................................................... -->
<!-- .. Plugins ....................................................... -->
<assembly.plugin>2.5.4</assembly.plugin>
<!-- <compiler.plugin>3.3</compiler.plugin> -->
<compiler.plugin>3.3</compiler.plugin>
<source.plugin>2.4</source.plugin>
<shade.plugin>2.4.3</shade.plugin>
<jacoco.plugin>0.8.1</jacoco.plugin>
<!-- Deployment properties -->
<project.name>ServerExtension</project.name>
<config.file>config.properties</config.file>
<config.dir>main/resources</config.dir>
<!-- Deployment properties -->
<project.name>ServerExtension</project.name>
<config.file>config.properties</config.file>
<config.dir>main/resources</config.dir>
<wagon.provider.version>2.6</wagon.provider.version>
<wagon.provider.version>2.6</wagon.provider.version>
<java.version>1.8</java.version>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</properties>
<!-- ================================================================================ -->
<!-- External additional maven repositories -->
<!-- ================================================================================ -->
<!-- ================================================================================ -->
<!-- External additional maven repositories -->
<!-- ================================================================================ -->
<repositories>
<repository>
<repository>
<id>jboss-public-repository</id>
<name>JBoss Public Maven Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
......@@ -70,16 +62,16 @@
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repository>
<!-- In Project (temporal) -->
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/libs</url>
</repository>
</repositories>
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/libs</url>
</repository>
</repositories>
<dependencies>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
......@@ -101,104 +93,13 @@
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- SFS -->
<dependency>
<groupId>sfs</groupId>
<artifactId>sfs2x</artifactId>
<version>${smartfox.version}</version>
</dependency>
<dependency>
<groupId>sfs</groupId>
<artifactId>sfs2x-core</artifactId>
<version>${smartfox.version}</version>
</dependency>
<!-- MontiSim -->
<dependency>
<groupId>montisim</groupId>
<artifactId>commons</artifactId>
<version>${montisim.commons.version}</version>
</dependency>
<dependency>
<groupId>montisim-controller</groupId>
<artifactId>library</artifactId>
<version>${montisim.controller.version}</version>
</dependency>
<dependency>
<groupId>montisim-controller</groupId>
<artifactId>control</artifactId>
<version>${montisim.controller.version}</version>
</dependency>
<dependency>
<groupId>montisim-controller</groupId>
<artifactId>navigation</artifactId>
<version>${montisim.controller.version}</version>
</dependency>
<dependency>
<groupId>montisim-simulation</groupId>
<artifactId>environment</artifactId>
<version>${montisim.simulation.version}</version>
</dependency>
<dependency>
<groupId>montisim-simulation</groupId>
<artifactId>vehicle</artifactId>
<version>${montisim.simulation.version}</version>
</dependency>
<dependency>
<groupId>montisim-simulation</groupId>
<artifactId>sensors</artifactId>
<version>${montisim.simulation.version}</version>
</dependency>
<dependency>
<groupId>montisim-simulation</groupId>
<artifactId>bus</artifactId>
<version>${montisim.simulation.version}</version>
</dependency>
<dependency>
<groupId>montisim-simulation</groupId>
<artifactId>network</artifactId>
<version>${montisim.simulation.version}</version>
</dependency>
<dependency>
<groupId>montisim-simulation</groupId>
<artifactId>simulator</artifactId>
<version>${montisim.simulation.version}</version>
</dependency>
<!-- RMI -->
<dependency>
<groupId>montisim</groupId>
<artifactId>rmi-model-server</artifactId>
<version>${montisim.rmimodelserver.version}</version>
</dependency>
<!-- Autopilot -->
<dependency>
<groupId>montisim</groupId>
<artifactId>example-autopilot-ema</artifactId>
<version>0.0.5</version>
</dependency>
<!-- SimLong -->
<dependency>
<groupId>de.monticore.lang.montisim</groupId>
<artifactId>SimLang</artifactId>
<version>${montisim.simlang.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.montisim</groupId>
<artifactId>Util</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.montisim</groupId>
<artifactId>Weather</artifactId>
<version>1.0.1</version>
</dependency>
<!--Unit test-->
<dependency>
<groupId>commons-pool</groupId>
......@@ -215,189 +116,25 @@
<artifactId>sqlite-jdbc</artifactId>
<version>3.23.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
<scope>compile</scope>