Add sqlite to teamspeak webhook and add "Backup" to servername

This commit is contained in:
Tobias Reisinger 2025-09-20 16:37:22 +02:00
parent 4dbec53d30
commit 1ddf34690c
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
5 changed files with 40 additions and 7 deletions

View file

@ -34,15 +34,16 @@ teamspeak_fallback_yml:
name: X-Webhook-Token
teamspeak_fallback_compose:
watchtower: update
image: ghcr.io/thecatlady/webhook
watchtower: false
image: "{{ (container_registry.public, 'services/webhook') | path_join }}"
volumes:
- ./config:/config:ro
- data:/mnt/teamspeak_fallback_data
file:
services:
app:
command: ["-verbose", "-hooks=/config/hooks.yml"]
build:
context: .
teamspeak:
image: teamspeak
restart: always

View file

@ -0,0 +1,22 @@
FROM golang:alpine AS builder
ENV WEBHOOK_VERSION 2.8.1
WORKDIR /go/src/github.com/adnanh/webhook
RUN apk add --update --no-cache -t build-deps curl gcc libc-dev libgcc
RUN curl -L -o webhook.tar.gz "https://github.com/adnanh/webhook/archive/${WEBHOOK_VERSION}.tar.gz" && \
tar -xzf webhook.tar.gz --strip 1 && \
go get -d && \
go build -ldflags="-s -w" -o /usr/local/bin/webhook
FROM alpine:3.20.1
RUN apk add --update --no-cache curl jq sqlite
COPY --from=builder /usr/local/bin/webhook /usr/local/bin/webhook
WORKDIR /config
EXPOSE 9000
ENTRYPOINT ["/usr/local/bin/webhook"]
CMD ["-verbose", "-hooks=/config/hooks.yml"]

View file

@ -1,4 +1,5 @@
#!/usr/bin/env sh
chown -R "${TEAMSPEAK_USER}:${TEAMSPEAK_GROUP}" /mnt/teamspeak_fallback_data
sqlite3 "$WEBHOOK_DATA" "UPDATE server_properties SET value='Vollidioten (Backup)' WHERE ident='virtualserver_name';"
install -o "${TEAMSPEAK_USER}" -g "${TEAMSPEAK_GROUP}" -m 644 "$WEBHOOK_DATA" "/mnt/teamspeak_fallback_data/ts3server.sqlitedb"

View file

@ -1,3 +1,5 @@
---
- name: Restart service {{ role_name }}
ansible.builtin.include_tasks: tasks/restart-service.yml
- name: Rebuild service {{ role_name }}
ansible.builtin.include_tasks: tasks/rebuild-service.yml

View file

@ -11,6 +11,13 @@
- name: Import prepare tasks for common service
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
- name: Copy the Dockerfile
ansible.builtin.copy:
src: Dockerfile
dest: "{{ (service_path, 'Dockerfile') | path_join }}"
mode: "0644"
notify: Rebuild service {{ role_name }}
- name: Template the conditional-start script
ansible.builtin.template:
src: conditional-start.sh.j2
@ -19,17 +26,17 @@
- name: Set webhook config path
ansible.builtin.set_fact:
config_path: "{{ (service_path, 'config') | path_join }}"
teamspeak_fallback_config_path: "{{ (service_path, 'config') | path_join }}"
- name: Create config directory
ansible.builtin.file:
path: "{{ config_path }}"
path: "{{ teamspeak_fallback_config_path }}"
state: directory
mode: "0755"
- name: Create main config
ansible.builtin.copy:
dest: "{{ (config_path, 'hooks.yml') | path_join }}"
dest: "{{ (teamspeak_fallback_config_path, 'hooks.yml') | path_join }}"
content: '{{ teamspeak_fallback_yml | to_nice_yaml }}'
mode: "0644"
notify: Restart service {{ role_name }}
@ -37,7 +44,7 @@
- name: Copy the teamspeak-fallback-db script
ansible.builtin.copy:
src: teamspeak-fallback-db
dest: "{{ (config_path, 'teamspeak-fallback-db') | path_join }}"
dest: "{{ (teamspeak_fallback_config_path, 'teamspeak-fallback-db') | path_join }}"
mode: "0755"
- name: Import start tasks for common service