Add clickhouse config.
Update tasks. Add email config. Better docker-compose.
This commit is contained in:
parent
11a819ea2f
commit
7c674a8891
@ -1,10 +1,6 @@
|
||||
---
|
||||
# defaults file for plausible
|
||||
|
||||
# Docker user
|
||||
plausible_uid: docker
|
||||
plausible_gid: docker
|
||||
|
||||
# Email
|
||||
plausible_smtp_host:
|
||||
plausible_smtp_port: 587
|
||||
@ -32,4 +28,4 @@ plausible_base: "/mnt/plausible"
|
||||
plausible_config: "{{ plausible_base }}/config"
|
||||
plausible_db_data: "{{ plausible_base }}/db_data"
|
||||
plausible_event_data: "{{ plausible_base }}/event_data"
|
||||
plausible_geoip_database: "{{ plausible_base }}/geoip_data"
|
||||
plausible_geoip_database: "{{ plausible_base }}/geoip_data"
|
||||
|
14
files/clickhouse-config.xml.j2
Normal file
14
files/clickhouse-config.xml.j2
Normal 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>
|
8
files/clickhouse-user-config.xml.j2
Normal file
8
files/clickhouse-user-config.xml.j2
Normal file
@ -0,0 +1,8 @@
|
||||
<yandex>
|
||||
<profiles>
|
||||
<default>
|
||||
<log_queries>0</log_queries>
|
||||
<log_query_threads>0</log_query_threads>
|
||||
</default>
|
||||
</profiles>
|
||||
</yandex>
|
@ -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
|
||||
|
||||
|
@ -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: {}
|
4
templates/env.mail.conf.j2
Normal file
4
templates/env.mail.conf.j2
Normal 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 }}
|
Loading…
Reference in New Issue
Block a user