From f6d155c5f3bef10d489b2e4b24f1fd6c0a4f75ff Mon Sep 17 00:00:00 2001 From: Amir Gumerov Date: Wed, 26 Aug 2026 03:46:09 +0300 Subject: [PATCH] initial commit --- add_service.sh | 30 ++++++++++++++++++++++++++++++ compose.yaml | 1 + service.template | 8 ++++++++ 3 files changed, 39 insertions(+) create mode 100644 add_service.sh create mode 100644 compose.yaml create mode 100644 service.template diff --git a/add_service.sh b/add_service.sh new file mode 100644 index 0000000..dc9380b --- /dev/null +++ b/add_service.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +if [ "$#" -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +SERVICE_NAME=$1 +SERVICE_PORT=$2 +TEMPLATE="service.template" +TARGET="compose.yaml" + +if [ ! -f "$TEMPLATE" ]; then + echo "Error: Template file '$TEMPLATE' not found!" + exit 1 +fi + +if [ ! -f "$TARGET" ]; then + echo "Error: Target file '$TARGET' not found!" + exit 1 +fi + +sed -e "s/{{SERVICE_NAME}}/$SERVICE_NAME/g" -e "s/{{SERVICE_PORT}}/$SERVICE_PORT/g" "$TEMPLATE" >> "$TARGET" + +echo "Service '$SERVICE_NAME' successfully added to $TARGET" + +docker compose create $SERVICE_NAME +docker compose start $SERVICE_NAME + +echo "docker container created and started" diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..9e4a3f5 --- /dev/null +++ b/compose.yaml @@ -0,0 +1 @@ +services: \ No newline at end of file diff --git a/service.template b/service.template new file mode 100644 index 0000000..d8758f2 --- /dev/null +++ b/service.template @@ -0,0 +1,8 @@ + {{SERVICE_NAME}}: + image: ghcr.io/gumerov-amir/tt5srv-docker + volumes: + - /srv/data/tt5srv/{{SERVICE_NAME}}:/data + ports: + - "{{SERVICE_PORT}}:10333/tcp" + - "{{SERVICE_PORT}}:10333/udp" + restart: unless-stopped