start mucking about with a custom Factorio docker
This commit is contained in:
parent
2de66a7406
commit
aee68af5b3
3 changed files with 48 additions and 0 deletions
23
modules/mod/infra/factorioEvents.Dockerfile
Normal file
23
modules/mod/infra/factorioEvents.Dockerfile
Normal 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
|
||||
|
||||
|
||||
24
modules/mod/infra/kafka-pipe.sh
Normal file
24
modules/mod/infra/kafka-pipe.sh
Normal 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
|
||||
1
modules/mod/infra/kcat.conf
Normal file
1
modules/mod/infra/kcat.conf
Normal file
|
|
@ -0,0 +1 @@
|
|||
enable.idempotence=true
|
||||
Loading…
Add table
Add a link
Reference in a new issue