start mucking about with a custom Factorio docker

This commit is contained in:
Adam 2021-10-25 23:23:55 +02:00
parent 2de66a7406
commit aee68af5b3
3 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,23 @@
ARG factorioVersion=1.1.42
FROM factoriotools/factorio:$factorioVersion
#RUN apk add --update \
# curl \
# kafkacat \
# ;
ENV KCAT_CONFIG="/kcat.conf"
RUN apt-get update && apt-get install -y \
kafkacat \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /
COPY kafka-pipe.sh kafka-pipe.sh

View file

@ -0,0 +1,24 @@
#!/usr/bin/bash
# Pipe Docker logs from a Factorio server to a Kafka topic
echo "Piping logs from $FACTORIO_SERVER_CONTAINER_NAME to $KAFKA_HOST"
# generate some distinctive key for messages from this server
SERVER_HASH=openssl dgst -sha3-512 "$CONFIG/server-settings.json"
trap endProcess SIGINT
endProcess() {
echo "Exiting Factorio Events Kafka Pipe"
exit
}
while :; do
sed -n -e 's/^FactorioEvent: //p' |
kafkacat -F "$KCAT_PROP_FILE"
echo "Error - retrying in 10 seconds"
sleep 10
done

View file

@ -0,0 +1 @@
enable.idempotence=true