project re-organisation, and rename

This commit is contained in:
Adam 2021-12-01 16:57:46 +01:00
parent 53862ef1b5
commit 633e898f3c
52 changed files with 525 additions and 387 deletions

View file

@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=factorio-infra

View file

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

View file

@ -0,0 +1,39 @@
version: "3.9"
services:
factorio-server:
image: factoriotools/factorio:1.1.48
# logging:
# driver: "json-file"
container_name: "factorio-server"
restart: "unless-stopped"
networks:
- "factorio-events-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:
kafka-nw:
name: "kafka-nw"
external: true
factorio-events-nw:
name: "factorio-events-nw"

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