This commit is contained in:
crusader 2018-07-04 20:10:51 +09:00
parent 8c9b6497c0
commit 12cdd2436c
5 changed files with 77 additions and 0 deletions

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM alpine:3.7
# grab su-exec for easy step-down from root
RUN apk add --no-cache curl
COPY _docker/config/* /etc/overflow/config/
COPY _docker/bin/* /usr/local/overflow/bin/
COPY dist/consumer_metric /usr/local/overflow/bin/
RUN mkdir -p /var/overflow/logs; \
chmod +x /usr/local/overflow/bin/docker-entrypoint.sh /usr/local/overflow/bin/consumer_metric;
ENV TINI_VERSION='0.17.0'
# Use tini as subreaper in Docker container to adopt zombie processes
RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /bin/tini && chmod +x /bin/tini
EXPOSE 80
ENTRYPOINT ["/bin/tini", "--"]
CMD ["/usr/local/overflow/bin/docker-entrypoint.sh"]

View File

@ -0,0 +1,4 @@
#!/bin/sh
set -e
exec /usr/local/overflow/bin/consumer_metric -config-dir=/etc/overflow/config

View File

@ -0,0 +1,34 @@
{
"external": {
"grpc": {
"network": "tcp4",
"address": "central:9111"
},
"kafka": {
"consumers": {
"metric": {
"brokers": [
"kafka1:9092"
],
"groupID": "overflow-metric-group-id",
"topic": "overflow-metric-topic",
"minBytes": 10000,
"maxBytes": 1000000
}
}
},
"influxDB": {
"clientConfigs": {
"metric": {
"clientType": "http",
"address": "influxdb:18086"
}
},
"batchPointsConfigs": {
"metric": {
"database": "metric"
}
}
}
}
}

8
build.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
rm ./dist
CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags="-s" -o ./dist/consumer_metric
docker build -t docker.loafle.net/overflow/consumer_metric:1.0.0-SNAPSHOT .
docker push docker.loafle.net/overflow/consumer_metric:1.0.0-SNAPSHOT

10
docker-compose.yml Normal file
View File

@ -0,0 +1,10 @@
version: "3"
services:
consumer_metric:
image: docker.loafle.net/overflow/consumer_metric:1.0.0-SNAPSHOT
container_name: consumer_metric
hostname: consumer_metric
restart: always
volumes:
- /service/overflow/data/consumer_metric/opt/conf:/opt/conf