+-------------------------------------------------------------------------------
| Running honk on OpenBSD
+-------------------------------------------------------------------------------

Initial configuration
=====================

honk expects to be fronted by a TLS terminating reverse proxy.
Make sure to pass the Host header for nginx(8)
	proxy_set_header Host $http_host;

Setup
=====

Please see /usr/local/share/doc/honk

honk(8)
-------

honk# doas -su _honk
honk$ umask 077; cd /var/honk && honk init
listenaddr: localhost:31337
servername: honk.example.com
honk$ touch /var/honk/savedinbox.json
honk$ exit

honk# rcctl enable honk
honk# rcctl start honk

Honk at https://honk.example.com

Customization
=============

Site CSS may be overridden by creating a views/local.css file in the
/var/honk directory. Site JS may similarly be included by creating
views/local.js. A restart is required after changes.

e.g. add the following snippet to open all links in honks in new tabs

function adjusttargets() {
        var els = document.querySelectorAll("p.content a")
        for (var i = 0; i < els.length; i++) {
                var e = els[i]
                e.target = "_blank"
        }
}
document.addEventListener('DOMContentLoaded', adjusttargets, false);

Maintenance
===========

The cleanup [days] command exists to purge old external data, by default 30
days. This removes unreferenced, unsaved posts and attachments. It does not
remove any original content.

honk# crontab -eu _honk

# crontab(5)
MAILTO=root
@daily /usr/local/bin/honk cleanup

Over time, blob.db can grow larger than strictly necessary. Run VACUUM to shrink
honk$ sqlite3 blob.db vacuum

Database Upgrade
================

If you are upgrading from a version before 1.3.1, you will need to upgrade
the database format:

Stop the old honk process.
honk# rcctl stop honk

Perform the upgrade with the upgrade command.
honk# doas -su _honk
honk$ umask 077; cd /var/honk && cp honk.db backup.db
honk$ honk upgrade && honk cleanup
honk$ exit

Restart.
honk# rcctl start honk
