- Go 57.7%
- HTML 39.2%
- Shell 1.7%
- CSS 0.6%
- PLpgSQL 0.5%
- Other 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Bump .version to 1.39.3 and record the x/crypto and kumo updates in the changelog. |
||
| .github | ||
| .vscode | ||
| auth | ||
| controllers | ||
| database | ||
| docs | ||
| images | ||
| internal/testdb | ||
| middleware | ||
| models | ||
| scheduler | ||
| scripts | ||
| static/css | ||
| statistics | ||
| templates | ||
| tests | ||
| util | ||
| version | ||
| .air.toml | ||
| .editorconfig | ||
| .gitignore | ||
| .golangci.yml | ||
| .markdownlint.json | ||
| .version | ||
| CHANGELOG.md | ||
| cosign.pub | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| Makefile | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
Transaction Log Server
Server to receive data from Txlog Agent
This repository contains the code for the Txlog Server.
Installation
Docker
docker pull ghcr.io/txlog/server:main
docker run -d -p 8080:8080 \
-e INSTANCE=Datacenter 001 \
-e LOG_LEVEL=INFO \
-e PGSQL_HOST=postgres.example.com \
-e PGSQL_PORT=5432 \
-e PGSQL_USER=txlog \
-e PGSQL_DB=txlog \
-e PGSQL_PASSWORD=your_db_password \
-e PGSQL_SSLMODE=require \
-e CRON_RETENTION_DAYS=7 \
-e CRON_RETENTION_EXPRESSION=0 2 * * * \
-e CRON_STATS_EXPRESSION=0 * * * * \
-e CRON_OSV_EXPRESSION=0 4 * * * \
ghcr.io/txlog/server:main
Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: txlog-server
spec:
replicas: 3
selector:
matchLabels:
app: txlog-server
template:
metadata:
labels:
app: txlog-server
spec:
containers:
- name: txlog-server
image: ghcr.io/txlog/server:main
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
env:
- name: INSTANCE
value: "Datacenter 001"
- name: LOG_LEVEL
value: "INFO"
- name: PGSQL_HOST
value: "postgres.example.com"
- name: PGSQL_PORT
value: "5432"
- name: PGSQL_USER
value: "txlog"
- name: PGSQL_DB
value: "txlog"
- name: PGSQL_PASSWORD
valueFrom:
secretKeyRef:
name: txlog-secrets
key: db-password
- name: PGSQL_SSLMODE
value: "require"
- name: CRON_RETENTION_DAYS
value: 7
- name: CRON_RETENTION_EXPRESSION
value: 0 2 * * *
- name: CRON_STATS_EXPRESSION
value: 0 * * * *
- name: CRON_OSV_EXPRESSION
value: 0 4 * * *
Image Signature Verification
All Docker images from v1.19.1 and above published to ghcr.io/txlog/server are
digitally signed using Cosign from the
Sigstore project. This ensures the authenticity and
integrity of the images you pull.
Verifying an Image
cosign verify \
--key https://raw.githubusercontent.com/txlog/server/main/cosign.pub \
ghcr.io/txlog/server:latest
Or, if you have cloned this repository:
cosign verify \
--key cosign.pub \
ghcr.io/txlog/server:latest
A successful verification will display the image digest and signature details.
If the signature is invalid or missing, cosign will return an error.
Development
To make changes on this project, you need:
Golang
wget https://go.dev/dl/go1.27.4.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.27.4.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
source ~/.bashrc
rm go1.27.4.linux-amd64.tar.gz
Swaggo
curl -fsSL https://install.rda.run/swaggo/swag@latest! | bash
Air
curl -fsSL https://install.rda.run/air-verse/air@latest! | bash
A `.env` file
INSTANCE=Development environment
LOG_LEVEL=DEBUG
GIN_MODE=debug
PGSQL_HOST=127.0.0.1
PGSQL_PORT=5432
PGSQL_USER=postgres
PGSQL_DB=txlog
PGSQL_PASSWORD=your_db_password
PGSQL_SSLMODE=require
CRON_RETENTION_DAYS=1
CRON_RETENTION_EXPRESSION=0 2 * * *
CRON_STATS_EXPRESSION=0 * * * *
CRON_OSV_EXPRESSION=0 4 * * *
# OIDC Authentication (Optional)
OIDC_ISSUER_URL=https://id.example.com
OIDC_CLIENT_ID=your_oidc_client_id
OIDC_CLIENT_SECRET=your_oidc_client_secret
OIDC_REDIRECT_URL=https://txlog.example.com/auth/callback
OIDC_SKIP_TLS_VERIFY=false
# LDAP Authentication (Optional)
LDAP_HOST=ldap.example.com
LDAP_PORT=389
LDAP_USE_TLS=false
LDAP_BIND_DN=cn=admin,dc=example,dc=com
LDAP_BIND_PASSWORD=your_bind_password
LDAP_BASE_DN=ou=users,dc=example,dc=com
LDAP_USER_FILTER=(uid=%s)
LDAP_ADMIN_GROUP=cn=admins,ou=groups,dc=example,dc=com
LDAP_VIEWER_GROUP=cn=viewers,ou=groups,dc=example,dc=com
LDAP_GROUP_FILTER=(member=%s)
UI & CSS
The UI uses Kumo UI and Tailwind CSS v4 compiled via npm.
Ensure you have npm installed, and run:
npm install
The source CSS is in static/css/input.css. The compiled output is static/css/style.css.
Authentication Configuration
Txlog Server supports three authentication modes:
- No Authentication (Default): If neither OIDC nor LDAP is configured, the server runs without authentication
- OIDC Authentication: Configure OIDC environment variables to enable OpenID Connect authentication
- LDAP Authentication: Configure LDAP environment variables to enable LDAP authentication
- Both OIDC and LDAP: Both can be enabled simultaneously, allowing users to choose their preferred authentication method
LDAP Configuration Details
- LDAP_HOST (Required): LDAP server hostname
- LDAP_PORT: LDAP server port (default: 389 for LDAP, 636 for LDAPS)
- LDAP_USE_TLS: Enable TLS connection (default: false)
- LDAP_SKIP_TLS_VERIFY: Skip TLS certificate verification for self-signed certificates (default: false)
- LDAP_BIND_DN (Optional): Distinguished Name for service account bind
- Not required if your LDAP allows anonymous searches
- Recommended for Active Directory and restricted LDAP servers
- LDAP_BIND_PASSWORD (Optional): Password for service account
- LDAP_BASE_DN (Required): Base DN for user searches
- LDAP_USER_FILTER: LDAP filter for finding users (default:
(uid=%s), where %s is replaced with username) - LDAP_ADMIN_GROUP: DN of the admin group (users in this group have full admin access)
- LDAP_VIEWER_GROUP: DN of the viewer group (users in this group have read-only access)
- LDAP_GROUP_FILTER: LDAP filter for checking group membership (default:
(member=%s), where %s is replaced with user DN)
Note: At least one of LDAP_ADMIN_GROUP or LDAP_VIEWER_GROUP must be
configured. Users must be members of at least one of these groups to
authenticate successfully.
Service Account: LDAP_BIND_DN and LDAP_BIND_PASSWORD are optional.
If not provided, the server will:
- Use anonymous bind for user searches (works with OpenLDAP)
- Use the authenticated user's session for group membership checks
- Active Directory typically requires a service account
Development commands
The Makefile contains all the necessary commands for development. You can run
make to view all options.
make run: start the development server with hot-reload (Air)make css: build the Tailwind CSS (minified)make build: build a production-ready binary (rebuilds CSS first)make clean: remove compiled binaries and packagesmake doc: write the swagger documentation based on method comments
Air is configured to rebuild the Tailwind CSS automatically before each Go build,
so make run is all you need — CSS is regenerated whenever you change templates.
The server will run at http://localhost:8080 and the Swagger docs at http://localhost:8080/swagger/index.html.
Contributing
- Fork it (https://github.com/txlog/server/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request