diff --git a/goatcounter/Dockerfile b/goatcounter/Dockerfile index ee7cd87..51b5784 100644 --- a/goatcounter/Dockerfile +++ b/goatcounter/Dockerfile @@ -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 diff --git a/goatcounter/entrypoint.sh b/goatcounter/entrypoint.sh index 29b085c..4409656 100755 --- a/goatcounter/entrypoint.sh +++ b/goatcounter/entrypoint.sh @@ -5,6 +5,7 @@ set -eu create_site () { goatcounter db create site \ + -createdb \ -vhost "$GOATCOUNTER_DOMAIN" \ -user.email "$GOATCOUNTER_EMAIL" \ -password "$GOATCOUNTER_PASSWORD" \ diff --git a/goatcounter/fly.toml b/goatcounter/fly.toml index ea43b5c..a000cc6 100644 --- a/goatcounter/fly.toml +++ b/goatcounter/fly.toml @@ -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 = [] diff --git a/goatcounter/goatcounter.sh b/goatcounter/goatcounter.sh index 7d686ed..35f82e3 100755 --- a/goatcounter/goatcounter.sh +++ b/goatcounter/goatcounter.sh @@ -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 \ No newline at end of file +goatcounter serve $OPTS diff --git a/static/Caddyfile b/static/Caddyfile index b5c1a75..45c75a5 100644 --- a/static/Caddyfile +++ b/static/Caddyfile @@ -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