Verified Commit 623cca83 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Experiments with docker

An attempt to make a docker that would work as the backend to running
the master without all the tedious work of setting it up. However, we
seem to have some problems with the docker, so it's postponed for now.
parent 7c2fc314
From debian:latest
Run apt-get update && apt-get -y upgrade && apt-get -y install git postgresql sudo
RUN git clone https://gitlab.labs.nic.cz/turris/ucollect
COPY initdb testdb dbconfig /
RUN chmod a+r initdb testdb dbconfig
RUN echo 'local all all trust' >/etc/postgresql/9.4/main/pg_hba.conf
RUN echo 'host all all 0.0.0.0/0 trust' >>/etc/postgresql/9.4/main/pg_hba.conf
Run /etc/init.d/postgresql start && sudo -u postgres psql -f testdb && ./initdb debug
#!/bin/sh
set -ex
cp ../src/master/dbscripts/{initdb,testdb,dbconfig} .
docker build . --build-arg http_proxy="$http_proxy" -t turris/ucollect-test-backend
#!/bin/sh
set -ex
docker run -it --rm -e http_proxy="$http_proxy" -p 5432:5432 turris/ucollect-test-backend:latest
......@@ -32,49 +32,8 @@ logger = logging.getLogger(name='bandwidth')
PROTO_ITEMS_PER_WINDOW = 3
PROTO_ITEMS_PER_BUCKET = 5
BUCKETS_CNT_PROTO2 = 37
BUCKET_MAP_PROTO2 = {
1: 0,
2: 1,
3: 2,
4: 3,
5: 4,
6: 5,
7: 6,
8: 7,
9: 8,
10: 9,
11: 10,
12: 11,
13: 12,
14: 13,
15: 14,
16: 15,
17: 16,
18: 17,
19: 18,
20: 19,
30: 20,
40: 21,
50: 22,
60: 23,
70: 24,
80: 25,
90: 26,
100: 27,
200: 28,
300: 29,
400: 30,
500: 31,
600: 32,
700: 33,
800: 34,
900: 35,
1000: 36
}
BUCKETS_CNT_PROTO3 = 40
BUCKET_MAP_PROTO3 = {
BUCKETS_CNT = 40
BUCKET_MAP = {
250: 0,
500: 1,
750: 2,
......@@ -170,16 +129,6 @@ def store_bandwidth(data, now):
continue
try:
## Choose data structures according to protocol version
BUCKET_MAP = None
BUCKETS_CNT = None
if cldata.version <= 2:
BUCKET_MAP = BUCKET_MAP_PROTO2
BUCKETS_CNT = BUCKETS_CNT_PROTO2
elif cldata.version >= 3:
BUCKET_MAP = BUCKET_MAP_PROTO3
BUCKETS_CNT = BUCKETS_CNT_PROTO3
in_time = [0] * BUCKETS_CNT
in_bytes = [0] * BUCKETS_CNT
out_time = [0] * BUCKETS_CNT
......
CREATE DATABASE ucollect;
CREATE USER ucollect WITH PASSWORD '12345';
GRANT ALL ON DATABASE ucollect TO ucollect;
CREATE USER cleaner;
CREATE USER updater;
CREATE USER jenkins;
CREATE USER archivist;
CREATE USER authenticator;
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