Merge webhook into teamspeak_fallback
This commit is contained in:
parent
8b5593e586
commit
09e886c712
8 changed files with 110 additions and 137 deletions
|
@ -1,19 +0,0 @@
|
||||||
services:
|
|
||||||
teamspeak:
|
|
||||||
image: teamspeak
|
|
||||||
restart: always
|
|
||||||
ports:
|
|
||||||
- 9987:9987/udp
|
|
||||||
- 10011:10011
|
|
||||||
- 30033:30033
|
|
||||||
environment:
|
|
||||||
TS3SERVER_DB_PLUGIN: ts3db_sqlite3
|
|
||||||
TS3SERVER_DB_SQLCREATEPATH: create_sqlite
|
|
||||||
TS3SERVER_LICENSE: accept
|
|
||||||
volumes:
|
|
||||||
- data:/var/ts3server/
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
data:
|
|
||||||
external: true
|
|
||||||
name: teamspeak_fallback_data
|
|
|
@ -5,15 +5,12 @@
|
||||||
- name: Deploy {{ svc.name }}
|
- name: Deploy {{ svc.name }}
|
||||||
vars:
|
vars:
|
||||||
svc: "{{ teamspeak_fallback_svc }}"
|
svc: "{{ teamspeak_fallback_svc }}"
|
||||||
|
compose: "{{ teamspeak_fallback_compose }}"
|
||||||
|
env: "{{ teamspeak_fallback_env }}"
|
||||||
|
yml: "{{ teamspeak_fallback_yml }}"
|
||||||
block:
|
block:
|
||||||
- name: Import tasks to create service directory
|
- name: Import prepare tasks for common service
|
||||||
ansible.builtin.import_tasks: tasks/steps/create-service-directory.yml
|
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
|
||||||
|
|
||||||
- name: Copy the docker-compose file
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: docker-compose.yml
|
|
||||||
dest: "{{ (service_path, 'docker-compose.yml') | path_join }}"
|
|
||||||
mode: "0644"
|
|
||||||
|
|
||||||
- name: Template the conditional-start script
|
- name: Template the conditional-start script
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
@ -21,6 +18,37 @@
|
||||||
dest: "{{ (service_path, 'conditional-start.sh') | path_join }}"
|
dest: "{{ (service_path, 'conditional-start.sh') | path_join }}"
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Set webhook config path
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
config_path: "{{ (service_path, 'config') | path_join }}"
|
||||||
|
|
||||||
|
- name: Create config directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ config_path }}"
|
||||||
|
state: directory
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Template main config
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: yml.j2
|
||||||
|
dest: "{{ (config_path, 'hooks.yml') | path_join }}"
|
||||||
|
mode: "0644"
|
||||||
|
register: cmd_result
|
||||||
|
|
||||||
|
- name: Set the docker force-recreate flag
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
docker_force_recreate: --force-recreate
|
||||||
|
when: cmd_result.changed # noqa: no-handler We need to handle the restart per service. Handlers don't support variables.
|
||||||
|
|
||||||
|
- name: Copy the teamspeak-fallback-db script
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: teamspeak-fallback-db
|
||||||
|
dest: "{{ (config_path, 'teamspeak-fallback-db') | path_join }}"
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Import start tasks for common service
|
||||||
|
ansible.builtin.import_tasks: tasks/start-common-service.yml
|
||||||
|
|
||||||
- name: Copy the system service
|
- name: Copy the system service
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: teamspeak-fallback.service.j2
|
src: teamspeak-fallback.service.j2
|
||||||
|
|
|
@ -6,12 +6,12 @@ do
|
||||||
then
|
then
|
||||||
if docker compose ps --services | grep teamspeak >/dev/null; then
|
if docker compose ps --services | grep teamspeak >/dev/null; then
|
||||||
echo "Stopping Server"
|
echo "Stopping Server"
|
||||||
docker compose down
|
docker compose down teamspeak
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if ! docker compose ps --services | grep teamspeak >/dev/null; then
|
if ! docker compose ps --services | grep teamspeak >/dev/null; then
|
||||||
echo "Starting Server"
|
echo "Starting Server"
|
||||||
docker compose up -d --pull=always
|
docker compose up -d --pull=always teamspeak
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
@ -2,5 +2,62 @@
|
||||||
teamspeak_fallback_check_server: ts.sneiso.eu
|
teamspeak_fallback_check_server: ts.sneiso.eu
|
||||||
teamspeak_fallback_check_port: 30033
|
teamspeak_fallback_check_port: 30033
|
||||||
|
|
||||||
|
teamspeak_fallback_webhook_token: "{{ vault_teamspeak_fallback.webhook_token }}"
|
||||||
|
|
||||||
|
teamspeak_fallback_user: 9987
|
||||||
|
teamspeak_fallback_group: 9987
|
||||||
|
|
||||||
teamspeak_fallback_svc:
|
teamspeak_fallback_svc:
|
||||||
name: teamspeak-fallback
|
name: teamspeak-fallback
|
||||||
|
domain: ts.serguzim.me
|
||||||
|
additional_domains:
|
||||||
|
- hook.serguzim.me
|
||||||
|
port: 9000
|
||||||
|
|
||||||
|
teamspeak_fallback_env:
|
||||||
|
TEAMSPEAK_USER: "{{ teamspeak_fallback_user }}"
|
||||||
|
TEAMSPEAK_GROUP: "{{ teamspeak_fallback_group }}"
|
||||||
|
|
||||||
|
teamspeak_fallback_yml:
|
||||||
|
- id: teamspeak-fallback-db
|
||||||
|
trigger-rule-mismatch-http-response-code: 400
|
||||||
|
execute-command: /config/teamspeak-fallback-db
|
||||||
|
pass-file-to-command:
|
||||||
|
- source: payload
|
||||||
|
name: data
|
||||||
|
envname: WEBHOOK_DATA
|
||||||
|
base64decode: true
|
||||||
|
trigger-rule:
|
||||||
|
and:
|
||||||
|
- match:
|
||||||
|
type: value
|
||||||
|
value: "{{ teamspeak_fallback_webhook_token }}"
|
||||||
|
parameter:
|
||||||
|
source: header
|
||||||
|
name: X-Webhook-Token
|
||||||
|
|
||||||
|
teamspeak_fallback_compose:
|
||||||
|
watchtower: true
|
||||||
|
image: ghcr.io/thecatlady/webhook
|
||||||
|
volumes:
|
||||||
|
- ./config:/config:ro
|
||||||
|
- data:/mnt/teamspeak_fallback_data
|
||||||
|
file:
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
command: ["-verbose", "-hooks=/config/hooks.yml"]
|
||||||
|
teamspeak:
|
||||||
|
image: teamspeak
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 9987:9987/udp
|
||||||
|
- 10011:10011
|
||||||
|
- 30033:30033
|
||||||
|
environment:
|
||||||
|
TS3SERVER_DB_PLUGIN: ts3db_sqlite3
|
||||||
|
TS3SERVER_DB_SQLCREATEPATH: create_sqlite
|
||||||
|
TS3SERVER_LICENSE: accept
|
||||||
|
volumes:
|
||||||
|
- data:/var/ts3server/
|
||||||
|
volumes:
|
||||||
|
data:
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
---
|
|
||||||
- name: Set common facts
|
|
||||||
ansible.builtin.import_tasks: tasks/set-default-facts.yml
|
|
||||||
|
|
||||||
- name: Deploy {{ svc.name }}
|
|
||||||
vars:
|
|
||||||
svc: "{{ webhook_svc }}"
|
|
||||||
compose: "{{ webhook_compose }}"
|
|
||||||
env: "{{ webhook_env }}"
|
|
||||||
yml: "{{ webhook_yml }}"
|
|
||||||
block:
|
|
||||||
- name: Import prepare tasks for common service
|
|
||||||
ansible.builtin.import_tasks: tasks/prepare-common-service.yml
|
|
||||||
|
|
||||||
- name: Set webhook config path
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
config_path: "{{ (service_path, 'config') | path_join }}"
|
|
||||||
|
|
||||||
- name: Create config directory
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ config_path }}"
|
|
||||||
state: directory
|
|
||||||
mode: "0755"
|
|
||||||
|
|
||||||
- name: Template main config
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: yml.j2
|
|
||||||
dest: "{{ (config_path, 'hooks.yml') | path_join }}"
|
|
||||||
mode: "0644"
|
|
||||||
register: cmd_result
|
|
||||||
|
|
||||||
- name: Set the docker force-recreate flag
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
docker_force_recreate: --force-recreate
|
|
||||||
when: cmd_result.changed # noqa: no-handler We need to handle the restart per service. Handlers don't support variables.
|
|
||||||
|
|
||||||
- name: Copy the teamspeak-fallback-db script
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: teamspeak-fallback-db
|
|
||||||
dest: "{{ (config_path, 'teamspeak-fallback-db') | path_join }}"
|
|
||||||
mode: "0755"
|
|
||||||
|
|
||||||
- name: Import start tasks for common service
|
|
||||||
ansible.builtin.import_tasks: tasks/start-common-service.yml
|
|
|
@ -1,45 +0,0 @@
|
||||||
---
|
|
||||||
webhook_teamspeak_fallback_db_token: "{{ vault_webhook.teamspeak_fallback_db_token }}"
|
|
||||||
webhook_teamspeak_user: 9987
|
|
||||||
webhook_teamspeak_group: 9987
|
|
||||||
|
|
||||||
webhook_svc:
|
|
||||||
name: webhook
|
|
||||||
domain: hook.serguzim.me
|
|
||||||
port: 9000
|
|
||||||
|
|
||||||
webhook_env:
|
|
||||||
TEAMSPEAK_USER: "{{ webhook_teamspeak_user }}"
|
|
||||||
TEAMSPEAK_GROUP: "{{ webhook_teamspeak_group }}"
|
|
||||||
|
|
||||||
webhook_yml:
|
|
||||||
- id: teamspeak-fallback-db
|
|
||||||
trigger-rule-mismatch-http-response-code: 400
|
|
||||||
execute-command: /config/teamspeak-fallback-db
|
|
||||||
pass-file-to-command:
|
|
||||||
- source: payload
|
|
||||||
name: data
|
|
||||||
envname: WEBHOOK_DATA
|
|
||||||
base64decode: true
|
|
||||||
trigger-rule:
|
|
||||||
and:
|
|
||||||
- match:
|
|
||||||
type: value
|
|
||||||
value: "{{ webhook_teamspeak_fallback_db_token }}"
|
|
||||||
parameter:
|
|
||||||
source: header
|
|
||||||
name: X-Webhook-Token
|
|
||||||
|
|
||||||
webhook_compose:
|
|
||||||
watchtower: true
|
|
||||||
image: ghcr.io/thecatlady/webhook
|
|
||||||
volumes:
|
|
||||||
- ./config:/config:ro
|
|
||||||
- teamspeak_fallback_data:/mnt/teamspeak_fallback_data
|
|
||||||
file:
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
command: ["-verbose", "-hooks=/config/hooks.yml"]
|
|
||||||
volumes:
|
|
||||||
teamspeak_fallback_data:
|
|
||||||
name: teamspeak_fallback_data
|
|
|
@ -440,14 +440,25 @@ services = {
|
||||||
"teamspeak_fallback" = {
|
"teamspeak_fallback" = {
|
||||||
name = "teamspeak_fallback"
|
name = "teamspeak_fallback"
|
||||||
host = "node003"
|
host = "node003"
|
||||||
dns = [{
|
dns = [
|
||||||
domain = "serguzim.me"
|
{
|
||||||
target = "ts"
|
domain = "serguzim.me"
|
||||||
}]
|
target = "ts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
domain = "serguzim.me"
|
||||||
|
target = "hook"
|
||||||
|
name = "teamspeak_fallback-hook"
|
||||||
|
alias = "teamspeak_fallback"
|
||||||
|
}
|
||||||
|
]
|
||||||
backup = [{
|
backup = [{
|
||||||
name = "teamspeak_fallback_data"
|
name = "teamspeak_fallback_data"
|
||||||
type = "docker"
|
type = "docker"
|
||||||
}]
|
}]
|
||||||
|
monitoring = {
|
||||||
|
group = "7-support"
|
||||||
|
}
|
||||||
auth = false
|
auth = false
|
||||||
database = false
|
database = false
|
||||||
s3 = false
|
s3 = false
|
||||||
|
@ -514,21 +525,6 @@ services = {
|
||||||
s3 = false
|
s3 = false
|
||||||
},
|
},
|
||||||
|
|
||||||
"webhook" = {
|
|
||||||
name = "webhook"
|
|
||||||
host = "node003"
|
|
||||||
dns = [{
|
|
||||||
domain = "serguzim.me"
|
|
||||||
target = "hook"
|
|
||||||
}]
|
|
||||||
monitoring = {
|
|
||||||
group = "7-support"
|
|
||||||
}
|
|
||||||
auth = false
|
|
||||||
database = false
|
|
||||||
s3 = false
|
|
||||||
},
|
|
||||||
|
|
||||||
"wiki_js" = {
|
"wiki_js" = {
|
||||||
name = "wiki_js"
|
name = "wiki_js"
|
||||||
host = "node003"
|
host = "node003"
|
||||||
|
|
Loading…
Reference in a new issue