To contribute you need
- goreleaser: This is the tool we use to build and release staticreg, used by GNU Make to compile the project
- Go: The Go compiler, used by goreleaser to build binaries (at least 1.21 so we can use Go Toolchains)
- GNU Make: we use make to hide the details of running multiple commands to get builds done
- Optional: Docker: to build container images and for running the local development dependencies
Start the local development environment with Docker Compose (includes Registry and PostgreSQL):
docker-compose up -dThis starts:
- PostgreSQL database on port 5432
- OCI Registry on port 5000
Alternatively, start a standalone registry and push an image to it:
docker run -d -p 5000:5000 --name registry registry:3
docker pull alpine
docker tag alpine:latest localhost:5000/alpine:latest
docker push localhost:5000/alpine:latestBuild staticreg
make deps
makeSet up the database (if using webhook/metrics features):
# Set database connection string
export STATICREG_DB_URL="postgresql://staticreg:password@localhost:5432/staticreg"
# Apply database schema
psql $STATICREG_DB_URL -f sql/event_schema.sqlStart staticreg
./_output/dist/staticreg serveBy default, staticreg will:
- Serve the web UI on http://localhost:8093
- Connect to the registry at localhost:5000
- Store webhook events in PostgreSQL (if STATICREG_DB_URL is set)
make clean
makeTo test the webhook integration locally:
-
Ensure docker-compose services are running:
docker-compose up -d
-
Start staticreg:
export STATICREG_DB_URL="postgresql://staticreg:password@localhost:5432/staticreg" go run main.go serve
-
Pull an image from the local registry to trigger webhook events:
docker pull localhost:5000/alpine:latest
-
Verify metrics are stored in the database:
psql $STATICREG_DB_URL -c "SELECT pull_date, repo_name, tag, architecture, pull_count FROM container_pull_metrics ORDER BY pull_date DESC LIMIT 5;"
Releasing is done via GitHub actions.
To release you need to:
- Bump version in the
VERSIONfile (this needs to be a semver numbers) - Commit the version file
- Start the release process
Bump version file
git checkout master
echo "<new version>" > VERSIONCommit the version file
git commit -am "release: v$(cat VERSION)"
git pushStart the release process
make release