Single container, multiple pollers? #2041
-
Hi, We are thinking of the possibility to deploy Harvest as a container on an IoT Edge device. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
hi @frankvdbh - originally we ran multiple pollers in a single container, but we eventually moved away from that design because it didn't fit as well with the single-process-per-container model and meant you needed to restart all pollers when there was any kind of config/template, etc. change. We'll dig up the Dockerfile and share it with you. |
Beta Was this translation helpful? Give feedback.
-
@frankvdbh You can find the Dockerfile here. I have made some modifications to these files to ensure that they work with the latest code. Dockerfile FROM golang:alpine AS builder
RUN apk add --no-cache git curl && \
apk add --virtual build-dependencies build-base gcc bash
ARG INSTALL_DIR=/opt/harvest
ARG BUILD_DIR=/opt/home
ARG VERSION=2.0
ARG RELEASE=nightly
WORKDIR $BUILD_DIR
RUN mkdir -p $INSTALL_DIR
COPY . .
RUN make build VERSION=$VERSION RELEASE=$RELEASE && \
cp -a $BUILD_DIR/harvest.yml $INSTALL_DIR/harvest.yml.example && \
cp -aR bin $BUILD_DIR/conf $BUILD_DIR/grafana $BUILD_DIR/container/multiPoller/docker-entrypoint.sh $INSTALL_DIR && \
chmod +x $INSTALL_DIR/docker-entrypoint.sh
FROM alpine:latest
ARG INSTALL_DIR=/opt/harvest
RUN apk add --no-cache bash && \
mkdir -p $INSTALL_DIR
COPY --from=builder $INSTALL_DIR $INSTALL_DIR
WORKDIR $INSTALL_DIR
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["start", "--config", "./harvest.yml"] docker-entrypoint.sh #!/bin/bash
bin/harvest "$@"
`exec /bin/sleep infinity` docker-compose.yml version: "3.9"
services:
harvest:
image: harvest:latest
ports:
# Specify the port mappings for pollers to be exposed outside of the container.
- "12990:12990"
volumes:
- ${PWD}/harvest.yml:/opt/harvest/harvest.yml:ro
- harvest-logs:/var/log/harvest
restart: always
volumes:
harvest-logs:
name: harvest_logs Steps: Build Docker Image
Modify docker-compose.yml file for port mappings and start docker containers
Stop docker containers
|
Beta Was this translation helpful? Give feedback.
-
Many thanks!, we will check it out |
Beta Was this translation helpful? Give feedback.
@frankvdbh You can find the Dockerfile here.
I have made some modifications to these files to ensure that they work with the latest code.
Dockerfile