Alter 2 files

Add .gitlab-ci.yml
Add README.md
This commit is contained in:
akp 2025-01-07 00:16:29 +00:00
parent df285bde49
commit d2f90cf82a
No known key found for this signature in database
GPG key ID: CF8D58F3DEB20755
2 changed files with 39 additions and 0 deletions

20
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,20 @@
workflow:
rules:
- if: '$CI_COMMIT_BRANCH == "build"'
stages:
- build
default:
image: docker
services:
- docker:dind
buildAndPush:
stage: build
before_script:
- "echo $CI_REGISTRY_PASSWORD | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin"
- "docker info"
script:
- "docker build . --file Dockerfile --tag ${CI_REGISTRY_IMAGE}:latest --tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}"
- "docker push --all-tags $CI_REGISTRY_IMAGE"

19
README.md Normal file
View file

@ -0,0 +1,19 @@
# goatcounter-forwarder
This is small Go app designed to sit between the Caddy webserver and [Goatcounter](https://github.com/arp242/goatcounter) to record pageviews as they happen.
The `forward_auth` directive is (ab)used to send a copy of each request to goatcounter-forwarder that then extracts all relevant information from the request and enqueues it for submission to a Goatcounter instance.
It's configured with environment variables:
* `GCFWD_HTTP_ADDRESS`: the HTTP address that goatcounter-forwarder should listen on (default `127.0.0.1:7000`)
* `GCFWD_INSTANCE_ADDR`: the address of the Goatcounter instance to report statistics for (required)
* `GCFWD_TOKEN`: a Goatcounter API token with pageview reporting access (required)
Once setup and running, it can be added to your Caddy config as so:
```
forward_auth <goatcounter-forwarder address> {
uri /
}
```