diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f8e394d..f0531f9 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -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
@@ -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 }}
@@ -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:
@@ -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
@@ -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 }}
@@ -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:
@@ -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 ' *)
diff --git a/.gitignore b/.gitignore
index 5620294..d7071db 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,9 @@
-# data
-data
-
# debug
__debug_*
# build out
-tinyauth-analytics
+/analytics
-# benchmarks
-bench
\ No newline at end of file
+# data
+/analytics.db*
+/data
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index d9d8835..0000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "version": "0.2.0",
- "configurations": [
- {
- "name": "Launch Package",
- "type": "go",
- "request": "launch",
- "mode": "auto",
- "program": "${fileDirname}",
- "env": {
- "DATABASE_PATH": "./data/analytics.db",
- "PORT": "8080",
- "ADDRESS": "0.0.0.0",
- "TRUSTED_PROXIES": "0.0.0.0",
- "RATE_LIMIT_COUNT": "3"
- }
- }
- ]
-}
diff --git a/Dockerfile b/Dockerfile
index 02994b1..eb43950 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -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}"
diff --git a/LICENSE b/LICENSE
index e13034d..68ee9cf 100644
--- a/LICENSE
+++ b/LICENSE
@@ -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:
diff --git a/README.md b/README.md
index 53d92c0..6294c0a 100644
--- a/README.md
+++ b/README.md
@@ -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.
## 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
@@ -26,6 +26,7 @@ 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
@@ -33,4 +34,4 @@ If you like you can contribute to this project by picking up an [issue](https://
## 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.
diff --git a/dashboard/dashboard.html b/dashboard.html
similarity index 53%
rename from dashboard/dashboard.html
rename to dashboard.html
index 6336b7d..f821257 100644
--- a/dashboard/dashboard.html
+++ b/dashboard.html
@@ -7,6 +7,7 @@