Simplify goatcounter + use js integration

main
mat ess 2022-09-04 15:24:44 -04:00
parent c78f4efc98
commit a08755200f
5 changed files with 19 additions and 27 deletions

View File

@ -1,21 +1,17 @@
FROM debian:bookworm-slim
FROM alpine:latest
WORKDIR /goatcounter
ENV GOATCOUNTER_VERSION 'v2.2.3'
ENV GOATCOUNTER_TAG 'dev'
ENV GOATCOUNTER_LISTEN '0.0.0.0:8080'
ENV GOATCOUNTER_DB 'sqlite+/data/goatcounter.sqlite3'
ENV GOATCOUNTER_SMTP ''
RUN apt-get update \
&& apt-get install -y ca-certificates ncat wget \
RUN apk add --no-cache ca-certificates wget bash \
&& update-ca-certificates --fresh
RUN wget "https://github.com/zgoat/goatcounter/releases/download/$GOATCOUNTER_VERSION/goatcounter-$GOATCOUNTER_TAG-linux-amd64.gz" \
RUN wget "https://github.com/arp242/goatcounter/releases/download/$GOATCOUNTER_VERSION/goatcounter-$GOATCOUNTER_TAG-linux-amd64.gz" \
&& gzip -d "goatcounter-$GOATCOUNTER_TAG-linux-amd64.gz" \
&& mv "goatcounter-$GOATCOUNTER_TAG-linux-amd64" /usr/bin/goatcounter \
&& chmod +x /usr/bin/goatcounter
&& mv "goatcounter-$GOATCOUNTER_TAG-linux-amd64" /usr/local/bin/goatcounter \
&& chmod +x /usr/local/bin/goatcounter
COPY goatcounter.sh ./
COPY entrypoint.sh /entrypoint.sh

View File

@ -5,6 +5,7 @@ set -eu
create_site ()
{
goatcounter db create site \
-createdb \
-vhost "$GOATCOUNTER_DOMAIN" \
-user.email "$GOATCOUNTER_EMAIL" \
-password "$GOATCOUNTER_PASSWORD" \

View File

@ -1,14 +1,16 @@
# fly.toml file generated for goatcounter-mat-services on 2022-08-27T22:27:36-04:00
# fly.toml file generated for goatcounter-mat-services on 2022-09-03T21:18:21-04:00
app = "goatcounter-mat-services"
kill_signal = "SIGINT"
kill_timeout = 5
[env]
GOATCOUNTER_DB = "sqlite+/data/goatcounter.sqlite3"
GOATCOUNTER_DEBUG = ""
GOATCOUNTER_DOMAIN = "stats.mat.services"
GOATCOUNTER_EMAIL = "mat@mat.services"
LOG_SOURCE_HOST = "static-mat-services.internal"
LOG_SOURCE_PORT = "514"
GOATCOUNTER_LISTEN = "0.0.0.0:8080"
GOATCOUNTER_SMTP = ""
[experimental]
allowed_public_ports = []

View File

@ -18,11 +18,4 @@ if [ -n "$GOATCOUNTER_DEBUG" ]; then
OPTS="$OPTS -debug all"
fi
ncat -l 9090 > /data/caddy.log &
goatcounter import \
-site=$GOATCOUNTER_DOMAIN \
-follow \
-format=combined \
/data/caddy.log &
goatcounter serve $OPTS
goatcounter serve $OPTS

View File

@ -20,10 +20,6 @@ http://static-mat-services.fly.dev {
file_server
}
log {
output stdout
}
header {
# disable FLoC tracking
Permissions-Policy interest-cohort=()
@ -40,15 +36,19 @@ http://static-mat-services.fly.dev {
# style-src 'unsafe-inline': syntax highlighting in codefences
# sandbox allow-popups: enable target="_blank" links to open in new tabs
Content-Security-Policy "default-src 'none';
img-src 'self';
img-src 'self' https://stats.mat.services;
style-src 'self' 'unsafe-inline';
font-src 'self';
script-src 'self';
script-src 'self' https://stats.mat.services;
form-action 'none';
frame-ancestors 'none';
base-uri 'none';
upgrade-insecure-requests;
sandbox allow-same-origin allow-popups allow-popups-to-escape-sandbox"
sandbox
allow-same-origin
allow-scripts
allow-popups
allow-popups-to-escape-sandbox"
}
# caching