- more tidying up

- setting up distribution plugin
- using more variables for mod config
This commit is contained in:
Adam 2021-12-02 00:54:15 +01:00
parent afbfeda616
commit 7091f7648d
34 changed files with 293 additions and 169 deletions

View file

@ -0,0 +1,3 @@
# Do not edit manually. This file was created with task 'updateEnv'
COMPOSE_PROJECT_NAME=kafkatorio
FACTORIO_VERSION=1.1.48

View file

@ -0,0 +1 @@
factorio-server

View file

@ -0,0 +1,37 @@
version: "3.9"
services:
factorio-server:
image: factoriotools/factorio:${FACTORIO_VERSION}
# logging:
# driver: "json-file"
container_name: "factorio-server"
restart: "unless-stopped"
networks:
- "kafkatorio-nw"
ports:
- "34197:34197/udp" # factorio
- "27015:27015/tcp" # rcon
volumes:
- "./factorio-server:/factorio"
# logging:
# driver: "mickyg/kafka-logdriver:latest"
# options:
# KAFKA_BROKER_ADDR: "kafka-kraft"
# LOG_TOPIC: "dockerlogs-factorio-server"
# LOG_TAG: "factorio-server"
# environment:
# RCON_PORT: 27715
# environment:
# - PUID=1000
# - PGID=1000
# - UPDATE_MODS_ON_START=true
# - USERNAME=FactorioUsername
# - TOKEN=FactorioToken
networks:
kafkatorio-nw:
name: "kafkatorio-nw"
external: true

View file

@ -0,0 +1,25 @@
ARG factorioVersion=1.1.42
FROM factoriotools/factorio:$factorioVersion
# In progress
# The intention is to remove kafka-pipe and have a
# pre-preared Factorio Docker container than can
# just run, without needing an additional
# container with kcat.
#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