Commit 2b707b8f authored by Vaclav Sraier's avatar Vaclav Sraier

Merge branch 'server-docker' into 'master'

docker environment for local testing

See merge request netmetr!25
parents c7e13397 7270891a
Pipeline #42429 passed with stages
in 8 seconds
# This is an environment definition for docker deployment
RMBT_SECRET_KEY=rmbt_secret_key
RMBT_DB_USER=rmbt
RMBT_DB_PASSWORD=pgpass
RMBT_DB_HOST=pghost
TOMCAT_USER=admin
TOMCAT_PASSWORD=devpass
QOS_SERVER_NAME=qos.netmetr
SPEED_SERVER_NAME=speed.netmetr
The following third party libraries are required dependencies:
### Google Play Services ###
- see <http://developer.android.com/google/play-services/setup.html>.
- copy "extras/google/google_play_services/libproject" as "google-play-services_lib" into the source distribution of *Open-RMBT*.
### Android Support Library ###
- see <http://developer.android.com/tools/extras/support-library.html>
- copy as "RMBTAndroid/libs/android-support-v13.jar"
### Guava ###
- Apache 2.0. License
- available at <https://code.google.com/p/guava-libraries/>
- copy as "RMBTSharedCode/lib/guava-18.0.jar"
### dnsjava ###
- BSD License
- available at <http://www.xbill.org/dnsjava/>
- copy as "RMBTSharedCode/lib/dnsjava-2.1.4.jar"
### PostgreSQL JDBC Driver ###
- BSD License
- available at <http://jdbc.postgresql.org/>
- copy as "RMBTSharedCode/lib/postgresql-9.2-1002.jdbc4.jar"
### JSON in Java ###
- MIT License (+ "The Software shall be used for Good, not Evil.")
- available at <http://www.json.org/java/index.html>
- copy as "RMBTSharedCode/lib/org.json.jar" and "RMBTClient/lib/org.json.jar"
### Simple Logging Facade for Java (SLF4J) ###
- MIT License
- available at <http://www.slf4j.org/>
- copy as "RMBTAndroid/libs/slf4j-android-1.5.8.jar"
### JOpt Simple ###
- MIT License
- available at <http://pholser.github.com/jopt-simple/>
- copy as "RMBTClient/lib/jopt-simple-3.2.jar"
### Apache Commons ###
- Apache 2.0 License
- available at <http://commons.apache.org/>
- copy as:
- "RMBTClient/lib/commons-logging-1.1.1.jar"
- "RMBTClient/lib/org.apache.httpclient.jar"
- "RMBTClient/lib/org.apache.httpcore.jar"
- "RMBTControlServer/WebContent/WEB-INF/lib/commons-csv-1.0.jar"
- "RMBTControlServer/WebContent/WEB-INF/lib/commons-io-2.4.jar"
### Restlet Framework ###
- Version: 2.1
- Licenses:
- Apache 2.0
- LGPL license version 3.0
- LGPL license version 2.1
- CDDL license version 1.0 or
- EPL license version 1.0
- available at <http://restlet.org/>
- copy as:
- "RMBTControlServer/WebContent/WEB-INF/lib/org.restlet.jar"
- "RMBTControlServer/WebContent/WEB-INF/lib/org.restlet.ext.json.jar"
- "RMBTControlServer/WebContent/WEB-INF/lib/org.restlet.ext.servlet.jar"
- "RMBTMapServer/WebContent/WEB-INF/lib/org.restlet.jar"
- "RMBTMapServer/WebContent/WEB-INF/lib/org.restlet.ext.json.jar"
- "RMBTMapServer/WebContent/WEB-INF/lib/org.restlet.ext.servlet.jar"
### PostGIS/ODBC ###
- Version: 2.1
- Licenses:
- GPL license version 2.0 (for PostGIS)
- LGPL license version 2.1 (for PostGIS/JDBC)
- available at <http://postgis.net/>
- copy as:
- "RMBTMapServer/WebContent/WEB-INF/lib/postgis.jar"
\ No newline at end of file
......@@ -39,97 +39,8 @@ The following Eclipse projects are distributed in this release:
Dependencies
---------------
The following third party libraries are required dependencies:
See [DEPENDENCIES.md](DEPENDENCIES.md)
### Google Play Services ###
# Local testing setup using Docker
- see <http://developer.android.com/google/play-services/setup.html>.
- copy "extras/google/google_play_services/libproject" as "google-play-services_lib" into the source distribution of *Open-RMBT*.
### Android Support Library ###
- see <http://developer.android.com/tools/extras/support-library.html>
- copy as "RMBTAndroid/libs/android-support-v13.jar"
### Guava ###
- Apache 2.0. License
- available at <https://code.google.com/p/guava-libraries/>
- copy as "RMBTSharedCode/lib/guava-18.0.jar"
### dnsjava ###
- BSD License
- available at <http://www.xbill.org/dnsjava/>
- copy as "RMBTSharedCode/lib/dnsjava-2.1.4.jar"
### PostgreSQL JDBC Driver ###
- BSD License
- available at <http://jdbc.postgresql.org/>
- copy as "RMBTSharedCode/lib/postgresql-9.2-1002.jdbc4.jar"
### JSON in Java ###
- MIT License (+ "The Software shall be used for Good, not Evil.")
- available at <http://www.json.org/java/index.html>
- copy as "RMBTSharedCode/lib/org.json.jar" and "RMBTClient/lib/org.json.jar"
### Simple Logging Facade for Java (SLF4J) ###
- MIT License
- available at <http://www.slf4j.org/>
- copy as "RMBTAndroid/libs/slf4j-android-1.5.8.jar"
### JOpt Simple ###
- MIT License
- available at <http://pholser.github.com/jopt-simple/>
- copy as "RMBTClient/lib/jopt-simple-3.2.jar"
### Apache Commons ###
- Apache 2.0 License
- available at <http://commons.apache.org/>
- copy as:
- "RMBTClient/lib/commons-logging-1.1.1.jar"
- "RMBTClient/lib/org.apache.httpclient.jar"
- "RMBTClient/lib/org.apache.httpcore.jar"
- "RMBTControlServer/WebContent/WEB-INF/lib/commons-csv-1.0.jar"
- "RMBTControlServer/WebContent/WEB-INF/lib/commons-io-2.4.jar"
### Restlet Framework ###
- Version: 2.1
- Licenses:
- Apache 2.0
- LGPL license version 3.0
- LGPL license version 2.1
- CDDL license version 1.0 or
- EPL license version 1.0
- available at <http://restlet.org/>
- copy as:
- "RMBTControlServer/WebContent/WEB-INF/lib/org.restlet.jar"
- "RMBTControlServer/WebContent/WEB-INF/lib/org.restlet.ext.json.jar"
- "RMBTControlServer/WebContent/WEB-INF/lib/org.restlet.ext.servlet.jar"
- "RMBTMapServer/WebContent/WEB-INF/lib/org.restlet.jar"
- "RMBTMapServer/WebContent/WEB-INF/lib/org.restlet.ext.json.jar"
- "RMBTMapServer/WebContent/WEB-INF/lib/org.restlet.ext.servlet.jar"
### PostGIS/ODBC ###
- Version: 2.1
- Licenses:
- GPL license version 2.0 (for PostGIS)
- LGPL license version 2.1 (for PostGIS/JDBC)
- available at <http://postgis.net/>
- copy as:
- "RMBTMapServer/WebContent/WEB-INF/lib/postgis.jar"
See [docker/README.md](docker/README.md)
......@@ -50,6 +50,9 @@ processResources << {
if (project.hasProperty('RMBT_DB_PASSWORD')) {
contextXmlContent = contextXmlContent.replaceAll(/DB_PASSWORD/, RMBT_DB_PASSWORD)
}
if (project.hasProperty('RMBT_DB_HOST')) {
contextXmlContent = contextXmlContent.replaceAll(/localhost/, RMBT_DB_HOST)
}
generatedContextXmlFile.write(contextXmlContent, 'UTF-8')
File configurationFile = file("${project.buildDir}/resources/main/at/alladin/rmbt/res/Configuration.properties");
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
INSERT INTO settings (key, lang, value) VALUES ('url_statistics', 'cs', 'http://www.netmetr.cz/statistiky.html');
INSERT INTO settings (key, lang, value) VALUES ('url_statistics', 'en', 'http://www.netmetr.cz/statistiky.html');
INSERT INTO public.settings (uid, key, lang, value) VALUES (4, 'url_ipv4_check', NULL, 'https://control-4.netmetr.cz/RMBTControlServer/ip');
INSERT INTO public.settings (uid, key, lang, value) VALUES (5, 'url_ipv6_check', NULL, 'https://control-6.netmetr.cz/RMBTControlServer/ip');
INSERT INTO public.settings (uid, key, lang, value) VALUES (6, 'threshold_upload', NULL, '2000;1000');
INSERT INTO public.settings (uid, key, lang, value) VALUES (7, 'threshold_download', NULL, '10000;2000');
INSERT INTO public.settings (uid, key, lang, value) VALUES (8, 'rmbt_geo_distance_detail_limit', NULL, '3000');
INSERT INTO public.settings (uid, key, lang, value) VALUES (9, 'rmbt_geo_accuracy_button_limit', NULL, '2000');
INSERT INTO public.settings (uid, key, lang, value) VALUES (11, 'rmbt_geo_accuracy_detail_limit', NULL, '10000');
INSERT INTO public.settings (uid, key, lang, value) VALUES (12, 'rmbt_num_pings', NULL, '10');
INSERT INTO public.settings (uid, key, lang, value) VALUES (13, 'rmbt_num_threads', NULL, '3');
INSERT INTO public.settings (uid, key, lang, value) VALUES (14, 'rmbt_duration', NULL, '5');
INSERT INTO public.settings (uid, key, lang, value) VALUES (15, 'control_ipv6_only', NULL, 'control-6.netmetr.cz');
INSERT INTO public.settings (uid, key, lang, value) VALUES (16, 'control_ipv4_only', NULL, 'control-4.netmetr.cz');
INSERT INTO public.settings (uid, key, lang, value) VALUES (2, 'url_statistics', 'cs', 'https://www.netmetr.cz/cs/statistiky_app.html');
INSERT INTO public.settings (uid, key, lang, value) VALUES (3, 'url_statistics', 'en', 'https://www.netmetr.cz/en/stats_app.html');
UPDATE provider SET map_filter = false;
INSERT INTO provider (uid, name, mcc_mnc, shortname, map_filter) VALUES (37, 'T-Mobile Czech Republic a.s.', '230-01', 'T-Mobile CZ', true);
......
This diff is collapsed.
This diff is collapsed.
CREATE TABLE test_type (
id integer NOT NULL UNIQUE,
description varchar(25) NOT NULL
);
INSERT INTO test_type VALUES (1, 'FULL_TEST');
INSERT INTO test_type VALUES (2, 'SIGNAL_ONLY');
ALTER TABLE test ADD test_type_id integer NOT NULL DEFAULT 1;
ALTER TABLE test ADD CONSTRAINT foreign_test_type FOREIGN KEY (test_type_id) REFERENCES test_type(id);
GRANT ALL PRIVILEGES ON TABLE test_type TO rmbt;
ALTER TABLE test_server ADD COLUMN IF NOT EXISTS 'key' varchar default NULL;
\ No newline at end of file
......@@ -41,6 +41,9 @@ processResources << {
if (project.hasProperty('RMBT_DB_PASSWORD')) {
contextXmlContent = contextXmlContent.replaceAll(/DB_PASSWORD/, RMBT_DB_PASSWORD)
}
if (project.hasProperty('RMBT_DB_HOST')) {
contextXmlContent = contextXmlContent.replaceAll(/localhost/, RMBT_DB_HOST)
}
generatedContextXmlFile.write(contextXmlContent, 'UTF-8')
String revisionProperties = "git.describe=" + getVersionNameFromGit() + "\n"
......
......@@ -51,6 +51,9 @@ processResources << {
if (project.hasProperty('RMBT_DB_PASSWORD')) {
contextXmlContent = contextXmlContent.replaceAll(/DB_PASSWORD/, RMBT_DB_PASSWORD)
}
if (project.hasProperty('RMBT_DB_HOST')) {
contextXmlContent = contextXmlContent.replaceAll(/localhost/, RMBT_DB_HOST)
}
generatedContextXmlFile.write(contextXmlContent, 'UTF-8')
String revisionProperties = "git.describe=" + getVersionNameFromGit() + "\n"
......
......@@ -198,7 +198,7 @@ var RMBTWebsocketTestConfig = (function () {
this.product = "Chrome";
this.client = "RMBTws";
this.timezone = 'Europe/Vienna'; // TODO:
this.controlServerURL = "https://netmetr-new.labs.nic.cz/RMBTControlServer";
this.controlServerURL = "https://localhost:8080/RMBTControlServer";
this.controlServerRegistrationResource = "/testRequest";
this.controlServerResultResource = "/result";
this.controlServerDataCollectorResource = "/requestDataCollector";
......
#!/bin/bash
cd $(git rev-parse --show-toplevel)
# environment definition
source .env
# compile server
build() {
cd $1
shift
set -x
gradle clean build $@
set +x
cd ..
}
build RMBTControlServer -PRMBT_SECRET_KEY="$RMBT_SECRET_KEY" -PRMBT_DB_USERNAME="$RMBT_DB_USER" -PRMBT_DB_PASSWORD="$RMBT_DB_PASSWORD" -PRMBT_DB_HOST="$RMBT_DB_HOST"
build RMBTStatisticServer -PRMBT_DB_USERNAME="$RMBT_DB_USER" -PRMBT_DB_PASSWORD="$RMBT_DB_PASSWORD" -PRMBT_DB_HOST="$RMBT_DB_HOST"
build RMBTMapServer -PRMBT_DB_USERNAME="$RMBT_DB_USER" -PRMBT_DB_PASSWORD="$RMBT_DB_PASSWORD" -PRMBT_DB_HOST="$RMBT_DB_HOST"
build RMBTQoSServer
version: '2.2'
services:
postgres:
hostname: postgres.netmetr
mem_limit: 512m
cpus: 0.25
build:
context: ./
dockerfile: docker/postgres/Dockerfile
args:
- SPEED_SERVER_NAME
- QOS_SERVER_NAME
- RMBT_SECRET_KEY
environment:
- POSTGRES_PASSWORD=${RMBT_DB_PASSWORD}
- POSTGRES_USER=${RMBT_DB_USER}
- QOS_SERVER_NAME
- SPEED_SERVER_NAME
control:
hostname: control.netmetr
mem_limit: 512m
cpus: 0.25
build:
context: ./
dockerfile: docker/control/Dockerfile
args:
- TOMCAT_USER
- TOMCAT_PASSWORD
links:
- "postgres:${RMBT_DB_HOST}"
environment:
- JPDA_ADDRESS=5005
- JPDA_TRANSPORT=dt_socket
depends_on:
- postgres
command: ["/usr/local/tomcat/bin/catalina.sh", "jpda", "run"]
qos:
hostname: qos.netmetr
mem_limit: 512m
cpus: 0.25
build:
context: ./
dockerfile: docker/qos/Dockerfile
depends_on:
- control
speed:
hostname: speed.netmetr
mem_limit: 64m
cpus: 0.05
build:
context: ./
dockerfile: docker/speed/Dockerfile
args:
- RMBT_SECRET_KEY
depends_on:
- control
# Local testing setup using Docker
All commands and files are referenced root of the NetMetr repository.
* first, all Java servers must be compiled
* Java8 required, otherwise it fails
* to compile, run `bash build_servers.sh`
* build and run containers with `docker-compose up`
* NOTE: PostgreSQL initialization runs AFTER the server starts. Exactly at the moment, when all other servers are expecting the database to communicate. If you run `docker-compose up postgres` beforehand, the database will initialize. Then you can stop it (Ctrl-C) and run all the containers at once - `docker-compose up`. This way, the dabase will be already initialized so that other services (mainly control server) don't complain
* To communicate with the containers, you need to know their IP address (no ports in docker are exported). By default, DNS is expected to resolve hostnames. See section DNS bellow.
* configuration is in `.env` file
## Servers
### PostgreSQL
* hostname - `postgres.netmetr`
* requires these extensions
* quantile
* postgis
* currently running Postgres 9.5 with Postgis 2.5
* needs to run init scripts on first run
* initialize and enable extensions
* initialize all tables the server will be using
* ports
* 5432 - postgres, can be used to connect pgAdmin (credentials in `.env` file)
### Control
* hostname - `control.netmetr`
* runs Tomcat8 with 3 Serverlet apps
* is remotely debuggable through exported port 5005
* connects to the database
* credentials for Tomcat administration are in file `docker/control/tomcat-users.xml`
* ports
* 5005 - remote java debugger
* 80 - http
### Speed
* hostname - `speed.netmetr`
* runs single C program
* requires a certificate - when building, new self-signed is created
* ports
* 8081 - RMBT noSSL
### QoS
* hostname - `qos.netmetr`
* runs single Java server (directly, no application server required)
* requires a certificate to run
* this server has SSL disabled, so we don't need now
## DNS
* to access services running in the containers, use [dns-proxy-server](https://github.com/mageddo/dns-proxy-server/releases)
* download release binary and run it with `sudo` (and hope you haven't just downloaded malware :) )
* you can then use hostnames to access the servers
* the containers should not care about this and they should work without it, but you won't be able to connect to them without it
FROM tomcat:8-jre8
ARG TOMCAT_USER
ARG TOMCAT_PASSWORD
# Redirect Tomcat output to the stdout to make development easier
RUN ln -s /dev/stdout /usr/local/tomcat/logs/catalina.out
RUN ln -s /dev/stdout /usr/local/tomcat/logs/catalina.err
# Reconfigure Tomcat to allow access to the manager app
COPY docker/control/tomcat-users.xml /usr/local/tomcat/conf/tomcat-users.xml
RUN sed -i 's/%%USER%%/'$TOMCAT_USER'/g; s/%%PASSWORD%%/'$TOMCAT_PASSWORD'/g' /usr/local/tomcat/conf/tomcat-users.xml
COPY docker/control/manager-context.xml /usr/local/tomcat/webapps/manager/META-INF/context.xml
# Change Tomcat HTTP port to 80
RUN sed -i 's_port="8080" protocol="HTTP/1.1"_port="80" protocol="HTTP/1.1"_g' /usr/local/tomcat/conf/server.xml
# Install web apps
RUN rm -r /usr/local/tomcat/webapps/ROOT /usr/local/tomcat/webapps/docs /usr/local/tomcat/webapps/examples
COPY RMBTStatisticServer/build/libs/RMBTStatisticServer.war /usr/local/tomcat/webapps/
COPY RMBTMapServer/build/libs/RMBTMapServer.war /usr/local/tomcat/webapps/
COPY RMBTControlServer/build/libs/RMBTControlServer.war /usr/local/tomcat/webapps/
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Context antiResourceLocking="false" privileged="true" >
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>
\ No newline at end of file
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary. It is
strongly recommended that you do NOT use one of the users in the commented out
section below since they are intended for use with the examples web
application.
-->
<!--
NOTE: The sample user and role entries below are intended for use with the
examples web application. They are wrapped in a comment and thus are ignored
when reading this file. If you wish to configure these users for use with the
examples web application, do not forget to remove the <!.. ..> that surrounds
them. You will also need to set the passwords to something appropriate.
-->
<!--
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
<user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
<user username="role1" password="<must-be-changed>" roles="role1"/>
-->
<role rolename="manager-gui" />
<role rolename="manager-script" />
<role rolename="admin-gui" />
<user username="%%USER%%" password="%%PASSWORD%%" roles="manager-gui,manager-script,admin-gui" />
</tomcat-users>
FROM mdillon/postgis:9.5
RUN apt-get update && apt-get install -y pgxnclient make gcc postgresql-server-dev-9.5 && pgxn install quantile
#RUN apt-get install -y --no-install-recommends postgresql-9.5-postgis-2.5
RUN mv /docker-entrypoint-initdb.d/postgis.sh /docker-entrypoint-initdb.d/00_postgis.sh
ADD docker/postgres/init_roles.sh /docker-entrypoint-initdb.d/05_init_roles.sh
ADD docker/postgres/init_tables.sh /docker-entrypoint-initdb.d/06_init_tables.sh
RUN mkdir /init_sql
ADD RMBTControlServer/db/rmbt_schema.sql /init_sql/10_rmbt.sql
ADD RMBTControlServer/db/rmbt_init_data.sql /init_sql/11_rmbt_init.sql
ARG QOS_SERVER_NAME
ARG SPEED_SERVER_NAME
ARG RMBT_SECRET_KEY
RUN sed -i 's/SPEED_SERVER_NAME/'$SPEED_SERVER_NAME'/g' /init_sql/11_rmbt_init.sql
RUN sed -i 's/QOS_SERVER_NAME/'$QOS_SERVER_NAME'/g' /init_sql/11_rmbt_init.sql
RUN sed -i 's/RMBT_SECRET_KEY/'$RMBT_SECRET_KEY'/g' /init_sql/11_rmbt_init.sql
ADD RMBTControlServer/db/qos_texts-en.sql /init_sql/12_qos_texts-en.sql
ADD RMBTControlServer/db/qos_texts-cs.sql /init_sql/13_qos_texts-cs.sql
ADD RMBTControlServer/db/qos_tests.sql /init_sql/14_qos_tests.sql
ADD RMBTControlServer/db/rmbt_settings.sql /init_sql/15_rmbt_settings.sql
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
-- CREATE USER rmbt;
-- CREATE DATABASE rmbt;
-- GRANT ALL PRIVILEGES ON DATABASE rmbt TO rmbt;
CREATE ROLE rmbt_group_read_only WITH NOLOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
CREATE ROLE rmbt_web_admin WITH NOLOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
CREATE ROLE rmbt_group_control WITH NOLOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
GRANT rmbt_group_read_only TO rmbt_group_control;
CREATE USER qosadmin WITH LOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
CREATE USER rmbt_control WITH LOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
CREATE USER rmbt_read_only WITH LOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
GRANT rmbt_group_read_only TO rmbt_read_only;
GRANT rmbt_web_admin TO qosadmin;
GRANT rmbt_group_control TO rmbt_control;
EOSQL
#!/bin/bash
set -e
echo "Initializing tables in DB $POSTGRES_DB"
psql_rmbt() {
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB"
}
echo "CREATE EXTENSION IF NOT EXISTS quantile" | psql_rmbt
#psql_rmbt < `pg_config --sharedir`/extension/quantile--1.1.5.sql
echo "CREATE EXTENSION IF NOT EXISTS hstore;" | psql_rmbt
echo 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp";' | psql_rmbt
for f in /init_sql/*; do
echo "Processing file $f"
cat "$f" | psql_rmbt
done
\ No newline at end of file
FROM ubuntu
RUN apt-get update && apt-get install -y default-jre-headless && apt-get clean
RUN useradd -m netztest
RUN mkdir -p /home/netztest/qos_server
WORKDIR /home/netztest/qos_server
ADD RMBTQoSServer/qos_server.sh .
ADD RMBTQoSServer/config.properties .
RUN sed -i 's/server.ssl=true/server.ssl=false/g' config.properties
RUN cat config.properties | sed -e 's/^server\.ip/#server.ip/g' > config.properties.new; mv config.properties.new config.properties
ADD RMBTQoSServer/build/libs/RMBTQoSServer.jar .
RUN mkdir -p /var/run/netztest/ && touch /var/run/netztest/qos_server.pid
RUN mkdir -p /var/log/qos
RUN mkdir -p /var/www/rmbt/qostest/
ADD RMBTQoSServer/assets/ /var/www/rmbt/qostest/
CMD ["/usr/bin/java","-jar","RMBTQoSServer.jar"]
FROM ubuntu:latest
ARG RMBT_SECRET_KEY
RUN apt-get update && apt-get install -y openssl make gcc libssl-dev
RUN mkdir /code
WORKDIR /code
RUN openssl req -x509 -nodes -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -subj '/CN=localhost'
COPY RMBTServer/ /code
RUN echo "#define RMBT_SECRETKEY \"$RMBT_SECRET_KEY\"" > secret.h
CMD ["/usr/bin/make","run"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment