-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
95 lines (70 loc) · 2.4 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
FROM python:3.8.3-slim
LABEL maintainer="[email protected]"
LABEL Description="Grebe is forwarder Data-like string message from RabbitMQ to Clickhouse." Vendor="TAC" Version="1.2.0"
RUN mkdir /grebe
ADD README.md grebe.py requirements.txt /grebe/
ADD grebe /grebe/grebe
WORKDIR /grebe
RUN apt-get update && apt-get -y upgrade \
&& apt-get install -y --no-install-recommends gcc g musl-dev \
&& pip install -r requirements.txt \
&& apt-get clean \
&& apt-get autoclean \
&& apt-get autoremove \
&& rm -rf /tmp/* /var/tmp/* \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/apt/lists/*
################
# Environments #
################
# Queue name to subscribe on RabbitMQ
ENV MQ_QNAME ''
# RabbitMQ host
ENV MQ_HOST ''
# RabbitMQ port
ENV MQ_PORT 5672
# Clickhouse host
ENV DB_HOST ''
# Clickhouse port by native connection
ENV DB_PORT 9500
# Clickhouse DB name to store data
ENV DB_NAME "default"
# Schema store location
ENV SCHEMA_STORE local
# Path to source settings file as local file. If this parameter skipped, source settings will be create on DB
ENV LOCAL_SOURCE_SETTINGS_FILE ""
# Timezone string will be used as default offset in parsing source string if it has no offset
ENV TZ_STR "UTC"
# Port number of grebe Web API. It is disabled if this value is 0 or not provided.
ENV API_PORT 0
# Schema DB directory path when schema-sotre is local
ENV LOCAL_SCHEMA_DIR /schemas
# Log level [DEBUG, INFO, WARN, ERROR]
ENV LOG_LEVEL INFO
# Log format by 'logging' package
ENV LOG_FORMAT "[%(levelname)s] %(asctime)s | %(pathname)s(L%(lineno)s) | %(message)s"
# Log file name
ENV LOG_FILE greabe.log
# Count of file files kept
ENV LOG_FILE_COUNT 1000
# Size of each log file
ENV LOG_FILE_SIZE 1000000
# Max count of retry to processing messge
ENV RETRY_MAX_COUNT 3
RUN mkdir /logs /schemas
VOLUME /logs
VOLUME /schemas
ENTRYPOINT python ./grebe.py ${MQ_QNAME} \
-mh ${MQ_HOST} -mp ${MQ_PORT} \
-dh ${DB_HOST} -dp ${DB_PORT} -dn ${DB_NAME} \
--schema-store ${SCHEMA_STORE}\
--local-schema-dir ${LOCAL_SCHEMA_DIR}\
--local-source-settings-file "${LOCAL_SOURCE_SETTINGS_FILE}" \
--tz "${TZ_STR}" \
--api-port ${API_PORT} \
--log-level ${LOG_LEVEL} \
--log-file /logs/`cat /etc/hostname`/${LOG_FILE} \
--log-format "${LOG_FORMAT}" \
--log-file-count ${LOG_FILE_COUNT}\
--log-file-size ${LOG_FILE_SIZE}\
--retry-max-count ${RETRY_MAX_COUNT}