Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 11 additions & 144 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository_owner }}/tinyauth-analytics
images: ghcr.io/${{ github.repository_owner }}/analytics

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -34,7 +34,7 @@ jobs:
with:
platforms: linux/amd64
labels: ${{ steps.meta.outputs.labels }}
tags: ghcr.io/${{ github.repository_owner }}/tinyauth-analytics
tags: ghcr.io/${{ github.repository_owner }}/analytics
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
build-args: |
VERSION=${{ github.ref_name }}
Expand All @@ -53,54 +53,6 @@ jobs:
if-no-files-found: error
retention-days: 1

image-build-dashboard:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository_owner }}/tinyauth-analytics-dashboard

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Build and push
uses: docker/build-push-action@v7
id: build
with:
platforms: linux/amd64
labels: ${{ steps.meta.outputs.labels }}
tags: ghcr.io/${{ github.repository_owner }}/tinyauth-analytics-dashboard
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
context: ./dashboard
build-args: |
VERSION=${{ github.ref_name }}

- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"

- name: Upload digest
uses: actions/upload-artifact@v7
with:
name: dashboard-digests-linux-amd64
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1

image-build-arm:
runs-on: ubuntu-24.04-arm
steps:
Expand All @@ -111,7 +63,7 @@ jobs:
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository_owner }}/tinyauth-analytics
images: ghcr.io/${{ github.repository_owner }}/analytics

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -129,7 +81,7 @@ jobs:
with:
platforms: linux/arm64
labels: ${{ steps.meta.outputs.labels }}
tags: ghcr.io/${{ github.repository_owner }}/tinyauth-analytics
tags: ghcr.io/${{ github.repository_owner }}/analytics
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
build-args: |
VERSION=${{ github.ref_name }}
Expand All @@ -148,54 +100,6 @@ jobs:
if-no-files-found: error
retention-days: 1

image-build-arm-dashboard:
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository_owner }}/tinyauth-analytics-dashboard

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Build and push
uses: docker/build-push-action@v7
id: build
with:
platforms: linux/arm64
labels: ${{ steps.meta.outputs.labels }}
tags: ghcr.io/${{ github.repository_owner }}/tinyauth-analytics-dashboard
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
context: ./dashboard
build-args: |
VERSION=${{ github.ref_name }}

- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"

- name: Upload digest
uses: actions/upload-artifact@v7
with:
name: dashboard-digests-linux-arm64
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1

image-merge:
runs-on: ubuntu-latest
needs:
Expand Down Expand Up @@ -223,53 +127,16 @@ jobs:
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository_owner }}/tinyauth-analytics
tags: |
type=semver,pattern={{version}},prefix=v
type=semver,pattern={{major}},prefix=v
type=semver,pattern={{major}}.{{minor}},prefix=v

- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf 'ghcr.io/${{ github.repository_owner }}/tinyauth-analytics@sha256:%s ' *)

image-merge-dashboard:
runs-on: ubuntu-latest
needs:
- image-build-dashboard
- image-build-arm-dashboard
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: dashboard-digests-*
merge-multiple: true

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository_owner }}/tinyauth-analytics-dashboard
images: ghcr.io/${{ github.repository_owner }}/analytics
flavor: |
prefix=v,onlatest=false
tags: |
type=semver,pattern={{version}},prefix=v
type=semver,pattern={{major}},prefix=v
type=semver,pattern={{major}}.{{minor}},prefix=v
type=semver,pattern={{version}}
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}

- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf 'ghcr.io/${{ github.repository_owner }}/tinyauth-analytics-dashboard@sha256:%s ' *)
$(printf 'ghcr.io/${{ github.repository_owner }}/analytics@sha256:%s ' *)
10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# data
data

# debug
__debug_*

# build out
tinyauth-analytics
/analytics

# benchmarks
bench
# data
/analytics.db*
/data
19 changes: 0 additions & 19 deletions .vscode/launch.json

This file was deleted.

5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ COPY go.sum ./
RUN go mod download

COPY ./cache.go ./
COPY ./dashboard.html ./
COPY ./dashboard_handler.go ./
COPY ./favicon.ico ./
COPY ./health_handler.go ./
COPY ./instances_handler.go ./
COPY ./main.go ./
COPY ./rate_limiter.go ./
COPY ./database ./database
COPY ./queries ./queries

RUN CGO_ENABLED=0 go build -o analytics -ldflags "-s -w -X main.version=${VERSION}"

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2025 steveiliop56
Copyright 2026 steveiliop56

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

A simple server to transparently collect version information from Tinyauth instances.

## How does it work
## How it works

Every Tinyauth instance runs a goroutine (unless you choose to opt-out) that does a "heartbeat" every 12 hours indicating the instance is still alive. The heartbeat contains the UUID generated by Tinyauth on start up and the version information. The server stores them in the SQLite database alongside with the last seen date. When you request all the instances, the server responds with an array containing the versions, UUIDs and last seen dates.
Every Tinyauth instance runs a goroutine (unless you choose to opt-out) that does a "heartbeat" every 12 hours indicating the instance is still "alive". The heartbeat contains the UUID generated by Tinyauth on start up and the version information. The server stores them in the SQLite database alongside with the last seen date. When you request all the instances, the server responds with an array containing the versions, UUIDs and last seen dates.
Comment thread
steveiliop56 marked this conversation as resolved.

## Running

The central information server is hosted at `https://api.tinyauth.app` and all instance information can be requested from the `/v1/instances/all` endpoint. But, if you like, you can run your own server for your own projects, you can do so by simply cloning the repository and running:
The central information server is hosted at `https://api.tinyauth.app` and all instance information can be requested from the `/v1/instances/all` endpoint or be seen visually on the `/dashboard` page. If you like, you can run your own server for your own projects. This can be done by cloning the repository and running:

```sh
docker compose up -d
Expand All @@ -26,11 +26,12 @@ The server is configured using environment variables, the following options are
| `RATE_LIMIT_COUNT` | number | Maximum number of requests per minute per IP. | `3` |
| `CORS_ALLOWED_ORIGINS` | string/array | Comma-separated list of allowed CORS origins. | `*` |
| `TRUSTED_PROXIES` | string/array | Comma-separated list of trusted proxy IPs. | `` |
| `DASHBOARD_ENABLED` | boolean | Whether to enable the dashboard. | `true` |

## Contributing

If you like you can contribute to this project by picking up an [issue](https://github.com/tinyauthapp/analytics/issues) or creating a [pull request](https://github.com/tinyauthapp/analytics/pulls). Contributing is appreciated a lot!

## License

Tinyauth analytics is licensed under the MIT License. TL;DR — You can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software. Just make sure to include the original license in any substantial portions of the code. There’s no warranty — use at your own risk. See the [LICENSE](./LICENSE) file for full details.
Tinyauth analytics is licensed under the MIT License. TL;DR — You can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software. Just make sure to include the original license in any substantial portions of the code. There’s no warranty — use at your own risk. See the [LICENSE](LICENSE) file for full details.
Loading