initial commit
This commit is contained in:
30
add_service.sh
Normal file
30
add_service.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$#" -ne 2 ]; then
|
||||||
|
echo "Usage: $0 <service_name> <port>"
|
||||||
|
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"
|
||||||
1
compose.yaml
Normal file
1
compose.yaml
Normal file
@ -0,0 +1 @@
|
|||||||
|
services:
|
||||||
8
service.template
Normal file
8
service.template
Normal file
@ -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
|
||||||
Reference in New Issue
Block a user