Commit af41c827 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko

Merge branch 'ChargingStation' into 'master'

Charging station

See merge request !28
parents 5413d1bc 346d2ed0
Pipeline #188344 failed with stages
in 1 minute and 9 seconds
......@@ -6,24 +6,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:
......@@ -35,6 +23,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:
......@@ -61,22 +50,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
......@@ -5,6 +5,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
......@@ -3,45 +3,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/*;
}
FROM postgres:latest
COPY ./db-create-script.sql /docker-entrypoint-initdb.d/
\ No newline at end of file
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: area; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE area (
id integer NOT NULL,
minx double precision NOT NULL,
miny double precision NOT NULL,
minz double precision NOT NULL,
maxx double precision NOT NULL,
maxy double precision NOT NULL,
maxz double precision NOT NULL
);
ALTER TABLE area OWNER TO server;
--
-- Name: area_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE area_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE area_id_seq OWNER TO server;
--
-- Name: area_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE area_id_seq OWNED BY area.id;
--
-- Name: entry_node; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE entry_node (
sector_id bigint NOT NULL,
node_osm_id bigint NOT NULL
);
ALTER TABLE entry_node OWNER TO server;
--
-- Name: env_node; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE env_node (
id integer NOT NULL,
x double precision NOT NULL,
y double precision NOT NULL,
z double precision NOT NULL,
osmid bigint NOT NULL,
env_object_id integer NOT NULL,
isintersection smallint NOT NULL
);
ALTER TABLE env_node OWNER TO server;
--
-- Name: env_node_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE env_node_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE env_node_id_seq OWNER TO server;
--
-- Name: env_node_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE env_node_id_seq OWNED BY env_node.id;
--
-- Name: env_object; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE env_object (
id integer NOT NULL,
tag character varying(255) NOT NULL,
osmid bigint NOT NULL,
map_id integer NOT NULL
);
ALTER TABLE env_object OWNER TO server;
--
-- Name: env_object_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE env_object_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE env_object_id_seq OWNER TO server;
--
-- Name: env_object_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE env_object_id_seq OWNED BY env_object.id;
--
-- Name: map; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE map (
id integer NOT NULL,
mname character varying(255) NOT NULL,
src character varying(255) NOT NULL
);
ALTER TABLE map OWNER TO server;
--
-- Name: map_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE map_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE map_id_seq OWNER TO server;
--
-- Name: map_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE map_id_seq OWNED BY map.id;
--
-- Name: overlap_area; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE overlap_area (
id integer NOT NULL,
overlap_a integer NOT NULL,
overlap_b integer NOT NULL,
area_id integer NOT NULL
);
ALTER TABLE overlap_area OWNER TO server;
--
-- Name: overlap_area_id_seq; Type: SEQUENCE; Schema: public; Owner: server
--
CREATE SEQUENCE overlap_area_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE overlap_area_id_seq OWNER TO server;
--
-- Name: overlap_area_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: server
--
ALTER SEQUENCE overlap_area_id_seq OWNED BY overlap_area.id;
--
-- Name: path; Type: TABLE; Schema: public; Owner: server; Tablespace:
--
CREATE TABLE path (
sector_id bigint NOT NULL,
source bigint NOT NULL,
target bigint NOT NULL,
distance double precision
);
ALTER TABLE path OWNER TO server;
--
-- Name: scenario; Type: TABLE; Schema: public; Owner: server; Tablespace:
--