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 2 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
53 changes: 53 additions & 0 deletions hockeypuck_rock/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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

version: '0.3'
summary: A summary of your Go application
description: |
This is hockeypuck's description. You have a paragraph or two to tell the
most important story about it. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the
container registries out there.
base: [email protected]
platforms:
amd64:
build-on:
- amd64
build-for:
- amd64
parts:
go-framework/base-layout:
plugin: nil
override-build: mkdir -p ${CRAFT_PART_INSTALL}/hockeypuck/bin ${CRAFT_PART_INSTALL}/hockeypuck/lib
-p ${CRAFT_PART_INSTALL}/hockeypuck/etc -p ${CRAFT_PART_INSTALL}/hockeypuck/data
go-framework/install-app:
plugin: go
source: https://github.com/hockeypuck/hockeypuck.git
source-subdir: src/hockeypuck/
organize:
bin/hockeypuck: hockeypuck/bin/hockeypuck
bin/hockeypuck-dump: hockeypuck/bin/hockeypuck-dump
bin/hockeypuck-load: hockeypuck/bin/hockeypuck-load
bin/hockeypuck-pbuild: hockeypuck/bin/hockeypuck-pbuild
build-snaps:
- go
stage-packages:
- gettext-base
build-environment:
- CGO_ENABLED: '0'
copy-templates:
plugin: dump
source: https://github.com/hockeypuck/hockeypuck.git
source-tag: 2.2.2
organize:
contrib/templates: /hockeypuck/lib/templates
contrib/webroot: /hockeypuck/lib/www
prime:
- hockeypuck/*
copy-conf:
plugin: dump
source: .
organize:
hockeypuck.conf.tmpl: /hockeypuck/etc/hockeypuck.conf.tmpl
hockeypuck_wrapper.sh: /hockeypuck/bin/hockeypuck_wrapper.sh
prime:
- hockeypuck/*

Loading
Loading