Files
mozimo.in/ansible/roles/analytics/tasks/main.yaml
T
2026-09-06 16:34:23 +00:00

45 lines
1.5 KiB
YAML

---
# Self-hosted first-party analytics (Vince — Plausible-protocol, single
# binary). Only reachable on the docker network:
# - Caddy proxies /stats/* on the www host here (prefix stripped), serving
# the tracker script and event API first-party;
# - Caddy publishes the dashboard on {{ stats_host }}.
#
# The image's ENTRYPOINT is the bare /vince binary (prints help and exits
# with no args), so the container MUST be given the `serve` command.
- name: Pull Vince image
docker_image:
name: "{{ vince_image }}"
source: pull
state: present
force_source: "{{ vince_image_force_update | default(false) }}"
- name: Ensure Vince data directory exists
file:
path: "{{ host_directory }}/vince_data"
state: directory
owner: "1000"
group: "1000"
- name: Create Vince container
docker_container:
name: "{{ vince_container }}"
image: "{{ vince_image }}"
command: serve
state: started
restart_policy: "unless-stopped"
env:
VINCE_DATA: /data
VINCE_LISTEN: "0.0.0.0:{{ vince_port }}"
# serve (re)creates the admin account from these on every boot —
# the env file is the source of truth, like the PocketBase superuser.
VINCE_ADMIN_NAME: "{{ vince_admin_name }}"
VINCE_ADMIN_PASSWORD: "{{ vince_admin_password }}"
# create the tracked site on startup (CSV list)
VINCE_DOMAINS: "{{ vince_site_domain }}"
VINCE_URL: "https://{{ stats_host }}"
volumes:
- "{{ host_directory }}/vince_data:/data"
networks:
- name: "{{ docker_network }}"