Add clickhouse config.

Update tasks.
Add email config.
Better docker-compose.
This commit is contained in:
Laur Ivan 2022-09-22 07:50:00 +02:00
parent 11a819ea2f
commit 7c674a8891
6 changed files with 130 additions and 5 deletions

View File

@ -1,10 +1,6 @@
---
# defaults file for plausible
# Docker user
plausible_uid: docker
plausible_gid: docker
# Email
plausible_smtp_host:
plausible_smtp_port: 587

View File

@ -0,0 +1,14 @@
<yandex>
<logger>
<level>warning</level>
<console>true</console>
</logger>
<!-- Stop all the unnecessary logging -->
<query_thread_log remove="remove"/>
<query_log remove="remove"/>
<text_log remove="remove"/>
<trace_log remove="remove"/>
<metric_log remove="remove"/>
<asynchronous_metric_log remove="remove"/>
</yandex>

View File

@ -0,0 +1,8 @@
<yandex>
<profiles>
<default>
<log_queries>0</log_queries>
<log_query_threads>0</log_query_threads>
</default>
</profiles>
</yandex>

View File

@ -1,2 +1,54 @@
---
# tasks file for plausible
- name: Set up directories
ansible.builtin.file:
state: directory
path: "{{ item }}"
mode: 0755
with_items:
- "{{ plausible_volume_media }}"
- "{{ plausible_volume_certs }}"
- "{{ plausible_volume_geoip }}"
- "{{ plausible_volume_templates }}"
- "{{ plausible_volume_config }}"
- "{{ plausible_volume_redis }}"
- "~/plausible"
tags:
- configuration
become: false
- name: Set up the database directory.
ansible.builtin.file:
state: directory
path: "{{ item }}"
mode: 0755
owner: 70
with_items:
- "{{ plausible_volume_db }}"
tags:
- configuration
become: false
- name: Copy plausible docker-compose template.
ansible.builtin.template:
src: templates/docker-compose.yml.j2
dest: ~/plausible/docker-compose.yml
mode: '0640'
become: false
notify: Restart plausible
- name: Copy plausible configuration.
ansible.builtin.template:
src: templates/env.plausible.conf.j2
dest: "{{ plausible_volume_config }}/env.plausible.conf"
mode: '0640'
become: false
notify: Restart plausible
- name: Ensure plausible is running.
community.docker.docker_compose:
project_src: ~/plausible/
build: false
become: false

View File

@ -0,0 +1,51 @@
version: "3.3"
services:
mail:
image: bytemark/smtp
restart: always
networks:
- plausible
plausible_db:
image: postgres:12
restart: always
volumes:
- {{ plausible_db_data }}:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=postgres
networks:
- plausible
plausible_events_db:
image: clickhouse/clickhouse-server:22.6-alpine
restart: always
volumes:
- {{ plausible_event_data }}:/var/lib/clickhouse
- {{ plausible_config }}/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro
- {{ plausible_config }}/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro
ulimits:
nofile:
soft: 262144
hard: 262144
networks:
- plausible
plausible:
image: plausible/analytics:latest
restart: always
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh db init-admin && /entrypoint.sh run"
depends_on:
- plausible_db
- plausible_events_db
- mail
ports:
- {{ plausible_port }}:8000
env_file:
- {{ plausible_config }}/env.plausible.conf
volumes:
- {{ plausible_geoip_database }}:/geoip:ro
networks:
- plausible
networks:
plausible: {}

View File

@ -0,0 +1,4 @@
RELAY_HOST={{ plausible_smtp_host }}
RELAY_PORT={{ plausible_smtp_port }}
RELAY_USERNAME={{ plausible_smtp_username }}
RELAY_PASSWORD={{ plausible_smtp_password }}