Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgresql integration #2

Closed
wants to merge 5 commits into from
Closed
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
3 changes: 1 addition & 2 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
# This file configures Charmcraft.
# See https://juju.is/docs/sdk/charmcraft-config for guidance.

type: charm
bases:
Expand All @@ -11,3 +9,4 @@ bases:
run-on:
- name: ubuntu
channel: "22.04"

44 changes: 44 additions & 0 deletions hockeypuck_rock/hockeypuck.conf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Initial config file for hockeypuck docker-compose/standalone deployments
# Environment variables are substituted using golang template markup
# See https://pkg.go.dev/text/template

[hockeypuck]
loglevel="INFO"
indexTemplate="/hockeypuck/lib/templates/index.html.tmpl"
vindexTemplate="/hockeypuck/lib/templates/index.html.tmpl"
statsTemplate="/hockeypuck/lib/templates/stats.html.tmpl"
webroot="/hockeypuck/lib/www"
hostname="${FQDN}"
contact="${FINGERPRINT}"
adminKeys=[
# List your admin key fingerprint(s) here.
# It is NOT RECOMMENDED to use the same key for both contact and admin.
]

[hockeypuck.hkp]
bind=":11371"
logRequestDetails=false

# prevent abusively large keys
[hockeypuck.openpgp]
maxPacketLength=8192
maxKeyLength=1048576
# Full fingerprints of keys to ignore, minus the leading 0x
blacklist=[

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Inclusive naming check] reported by reviewdog 🐶
[warning] blacklist may be insensitive, use denylist, blocklist instead

# "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF",
]

[hockeypuck.openpgp.db]
driver="postgres-jsonb"
dsn="database=hkp host=${POSTGRES_HOST} user=${POSTGRES_USER} password=${POSTGRES_PASSWORD} port=${POSTGRES_PORT} sslmode=disable"

[hockeypuck.conflux.recon]
allowCIDRs=["127.0.0.1/8"]

[hockeypuck.conflux.recon.leveldb]
path="/hockeypuck/data/ptree"

# Gossip peers
#[hockeypuck.conflux.recon.partner.keyserver_example_com]
#httpAddr="keyserver.example.com:11371"
#reconAddr="keyserver.example.com:11370"
15 changes: 15 additions & 0 deletions hockeypuck_rock/hockeypuck_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#!/bin/bash
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
#!/bin/bash


TEMPLATE_FILE="/hockeypuck/etc/hockeypuck.conf.tmpl"
OUTPUT_FILE="/hockeypuck/etc/hockeypuck.conf"

if [[ ! -f $TEMPLATE_FILE ]]; then
echo "Template file $TEMPLATE_FILE not found."
exit 1
fi

envsubst < "$TEMP_FILE" > "$OUTPUT_FILE"

echo "Substitution complete. Output written to $OUTPUT_FILE."

exec /hockeypuck/bin/hockeypuck -config $OUTPUT_FILE
43 changes: 43 additions & 0 deletions hockeypuck_rock/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

name: hockeypuck

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: hockeypuck
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
name: hockeypuck

base: [email protected]
version: 0.9
summary: Hockeypuck is an OpenPGP public keyserver.
description: |
Hockeypuck is an openPGP public keyserver or a software tool
used to manage public key infrastructure for PGP (Pretty Good Privacy),
which is a system for securing communication through encryption and
digital signatures.
platforms:
amd64:
build-on:
- amd64
build-for:
- amd64
parts:
hockeypuck:
plugin: make
source: https://github.com/hockeypuck/hockeypuck.git
source-tag: 2.2.2
source-type: git
source-depth: 1
build-snaps:
- go
organize:
usr/bin/hockeypuck: hockeypuck/bin/hockeypuck
usr/bin/hockeypuck-dump: hockeypuck/bin/hockeypuck-dump
usr/bin/hockeypuck-load: hockeypuck/bin/hockeypuck-load
usr/bin/hockeypuck-pbuild: hockeypuck/bin/hockeypuck-pbuild
var/lib/hockeypuck/*: hockeypuck/lib/
stage-packages:
- gettext-base
copy-files:
plugin: dump
source: .
organize:
hockeypuck.conf.tmpl: hockeypuck/etc/hockeypuck.conf.tmpl
hockeypuck_wrapper.sh: hockeypuck/bin/hockeypuck_wrapper.sh
prime:
- hockeypuck/*
Loading
Loading