Add plausible analytics

This commit is contained in:
Jake Howard 2020-07-21 20:55:44 +01:00
parent 74d40ac915
commit 9ee4e1c14b
Signed by: jake
GPG Key ID: 57AFB45680EDD477
6 changed files with 94 additions and 0 deletions

View File

@ -37,6 +37,7 @@
- netdata
- home-assistant
- intersect-docker
- plausible
- hosts: grimes
roles:

View File

@ -0,0 +1,43 @@
version: "2.3"
services:
plausible:
image: plausible/analytics:latest
depends_on:
- db
- clickhouse
expose:
- 8080 # https://github.com/plausible/analytics/pull/237
labels:
- traefik.enable=true
- traefik.http.routers.plausible.rule=Host(`plausible.theorangeone.net`)
- traefik.http.routers.plausible.tls.certresolver=le
environment:
- PORT=8080
- SECRET_KEY_BASE={{ secret_key }}
- SIGNING_SALT={{ signing_salt }}
- DATABASE_URL=postgres://plausible:plausible@db:5432/plausible
- DISABLE_REGISTRATION=true
- DISABLE_SUBSCRIPTION=true
- CLICKHOUSE_DATABASE_HOST=clickhouse
- CLICKHOUSE_DATABASE_NAME=plausible
- HOST=plausible.theorangeone.net
- SCHEME=https
clickhouse:
image: yandex/clickhouse-server:latest
volumes:
- ./clickhouse:/var/lib/clickhouse
ulimits:
nofile:
soft: 262144
hard: 262144
db:
image: postgres:12-alpine
restart: unless-stopped
volumes:
- ./postgres:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=plausible
- POSTGRES_USER=plausible

View File

@ -0,0 +1,4 @@
- name: restart plausible
shell:
chdir: /opt/plausible
cmd: "{{ docker_update_command }}"

View File

@ -0,0 +1,17 @@
- name: Create install directory
file:
path: /opt/plausible
state: directory
owner: "{{ docker_user.name }}"
mode: "{{ docker_compose_directory_mask }}"
become: true
- name: Install compose file
template:
src: files/docker-compose.yml
dest: /opt/plausible/docker-compose.yml
mode: "{{ docker_compose_file_mask }}"
owner: "{{ docker_user.name }}"
validate: /usr/bin/docker-compose -f %s config
notify: restart plausible
become: true

View File

@ -0,0 +1,21 @@
secret_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
39336333353061326461306663306661393465646536323664353933643030623561393732323438
3162376361386238623238323765376261303431643530660a646234653266326264336636343264
38396537646661386435353134663033336133646233343334356364663136373233623436383862
6139326335313830370a623737303837643630613535363534613663343163353330626131376435
61346534303264643065663763653837396530333166336364346234663031616565666163323631
64626666626466333131353264313166313139623865393833393766636466383139323463313263
36376337623437346465346665633732333264333662363632623235326262626339366434396563
64326232306534656161343638316166313763333834393065323965626465663136356332636463
62343466396637643466373561316665333238393964306232353239303062653432303466666638
62623038393639393339303661633039306463306364656339656164313033643536356266363939
613233393837653836633837373339653934
signing_salt: !vault |
$ANSIBLE_VAULT;1.1;AES256
35366665313061333735636265386535663830666531376365323033353338653536633334646566
3065393638663934623237336561633365303664613863350a326661393439393532316666653134
61353939626433396530636665636439313966636130386365396535326239366331646664383562
3763326533373266620a376230613664633332663065393561656565653634366130323534633865
35336236653664373131343364373637653261303030663239333534653432386438343162393866
3563353137633338623239346538643662393537313932386366

View File

@ -156,3 +156,11 @@ resource "cloudflare_record" "theorangeonenet_rng" {
type = "A"
ttl = 1
}
resource "cloudflare_record" "theorangeonenet_plausible" {
zone_id = cloudflare_zone.theorangeonenet.id
name = "plausible"
value = vultr_server.casey.main_ip
type = "A"
ttl = 1
}