### Install Go on Ubuntu Source: https://github.com/barrydeen/haven/blob/master/docs/build.md Installs Go on Ubuntu systems using apt and snap. Verifies the installation. ```bash sudo apt update #Update Package List sudo apt install snapd #install snapd to get a newer version of Go sudo snap install go --classic #Install Go go version #check if go was installed correctly ``` -------------------------------- ### Install Build Essentials on Ubuntu Source: https://github.com/barrydeen/haven/blob/master/docs/build.md Installs essential build tools on Ubuntu systems using apt. ```bash sudo apt install build-essential` ``` -------------------------------- ### Start Haven Service Source: https://github.com/barrydeen/haven/blob/master/README.md Starts the Haven Relay service using systemd. ```bash sudo systemctl start haven ``` -------------------------------- ### Copy Environment Example File Source: https://github.com/barrydeen/haven/blob/master/README.md Copies the example environment file to a new file named .env. This is the first step in configuring the Haven Relay. ```bash cp .env.example .env ``` -------------------------------- ### Install Nginx Source: https://github.com/barrydeen/haven/blob/master/README.md Installs Nginx on Debian-based systems. This is the first step in setting up Nginx as a reverse proxy. ```bash sudo apt-get update sudo apt-get install nginx ``` -------------------------------- ### Install Caddy Web Server Source: https://github.com/barrydeen/haven/blob/master/README.md Installs the Caddy web server on Debian-based systems. This involves adding the Caddy repository and then installing the package. ```bash sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list sudo apt update sudo apt install caddy ``` -------------------------------- ### Enable Haven Service on Boot Source: https://github.com/barrydeen/haven/blob/master/README.md Enables the Haven Relay service to start automatically on system boot. ```bash sudo systemctl enable haven ``` -------------------------------- ### Copy Relays Import Example File Source: https://github.com/barrydeen/haven/blob/master/README.md Copies the example relays import JSON file to relays_import.json. This file is used to configure the seed relays for the Haven Relay. ```bash cp relays_import.example.json relays_import.json ``` -------------------------------- ### Copy Relays Blastr Example File Source: https://github.com/barrydeen/haven/blob/master/README.md Copies the example relays blastr JSON file to relays_blastr.json. This file is used to configure the blastr relays for the Haven Relay. ```bash cp relays_blastr.example.json relays_blastr.json ``` -------------------------------- ### Successful Checksum Verification Example Source: https://github.com/barrydeen/haven/blob/master/docs/verify.md This is the expected output when a binary file's checksum is successfully verified against the checksums file. ```text haven_Darwin_arm64.tar.gz: OK ``` -------------------------------- ### GPG Signature Verification Output Example Source: https://github.com/barrydeen/haven/blob/master/docs/verify.md Example output from GPG signature verification, showing a good signature but a warning about the key not being trusted. The fingerprints must match exactly. ```text $ gpg --with-fingerprint --verify checksums.txt.sig checksums.txt gpg: Signature made Tue 12 Aug 12:03:12 2025 BST gpg: using EDDSA key 59F3BB93E8F4097CC43ED03C66865E933089774D gpg: Good signature from "Haven " [unknown] gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 1924 3581 B019 B245 2DA2 F828 70FF 8598 9022 1E23 Subkey fingerprint: 59F3 BB93 E8F4 097C C43E D03C 6686 5E93 3089 774D ``` -------------------------------- ### Install Certbot and Nginx Plugin Source: https://github.com/barrydeen/haven/blob/master/README.md Installs Certbot and its Nginx plugin for automating SSL certificate generation and renewal with Nginx. ```bash sudo apt-get update sudo apt-get install certbot python3-certbot-nginx ``` -------------------------------- ### Import Haven PGP Key from Haven Repository Source: https://github.com/barrydeen/haven/blob/master/docs/verify.md Downloads the Haven PGP public key directly from the Haven GitHub repository and imports it using `gpg`. Ensure `curl` and `gpg` are installed. ```bash curl https://raw.githubusercontent.com/barrydeen/haven/master/haven.asc -sSL | gpg --import - ``` -------------------------------- ### Import Haven PGP Key from OpenPGP Keyserver Source: https://github.com/barrydeen/haven/blob/master/docs/verify.md Imports the Haven PGP public key from the OpenPGP keyserver using its key ID. Ensure you have `gpg` installed. ```bash gpg --keyserver hkps://keys.openpgp.org --recv-keys 19243581B019B2452DA2F82870FF859890221E23 ``` -------------------------------- ### Generate SSL Certificate with Certbot for Apache Source: https://github.com/barrydeen/haven/blob/master/README.md Runs Certbot to obtain and install an SSL certificate for Apache. This command requires the domain to be correctly pointed to the server's IP. ```bash sudo certbot --apache ``` -------------------------------- ### Generate SSL Certificate with Certbot for Nginx Source: https://github.com/barrydeen/haven/blob/master/README.md Runs Certbot to obtain and install an SSL certificate for Nginx. This command requires the domain to be correctly pointed to the server's IP. ```bash sudo certbot --nginx ``` -------------------------------- ### Build Haven Project Source: https://github.com/barrydeen/haven/blob/master/docs/build.md Builds the Haven relay project using the Go build command. ```bash go build ``` -------------------------------- ### Configure Backup Provider Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Set the BACKUP_PROVIDER environment variable to 's3' to enable cloud backups. Set to 'none' or leave blank to disable. ```dotenv BACKUP_PROVIDER="s3" # s3, none (or leave blank to disable) ``` -------------------------------- ### Configure Whitelist File Source: https://github.com/barrydeen/haven/blob/master/docs/access-control.md Create a JSON file containing an array of npubs to whitelist. The relay owner's npub is automatically included. ```json [ "npub1...", "npub2..." ] ``` -------------------------------- ### Import Old Notes Source: https://github.com/barrydeen/haven/blob/master/README.md Run this command to stop the Haven relay, import old notes, and then restart the relay. ```bash sudo systemctl stop haven ./haven import sudo systemctl start haven ``` -------------------------------- ### Perform Manual Backup to Cloud Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Back up all relay data and upload it to the configured cloud storage provider. ```bash ./haven backup --to-cloud ``` -------------------------------- ### Extracting Haven Binaries Source: https://github.com/barrydeen/haven/blob/master/README.md Instructions for extracting downloaded Haven binaries on Linux/macOS systems. Ensure you have downloaded the correct file for your platform and architecture. ```bash mkdir haven tar -xzf haven_[Platform]_[Architecture].tar.gz -C haven ``` -------------------------------- ### Create Systemd Service File Source: https://github.com/barrydeen/haven/blob/master/README.md Creates a new systemd service file for the Haven Relay. This allows the relay to run as a background service on Linux systems. ```bash sudo nano /etc/systemd/system/haven.service ``` -------------------------------- ### Perform Manual Backup Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Run this command to back up all relay data to a default zip file named 'haven_backup.zip' in the current directory. ```bash ./haven backup ``` -------------------------------- ### Perform Manual Restore Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Restore relay data from a 'haven_backup.zip' file located in the current directory. ```bash ./haven restore ``` -------------------------------- ### Perform Manual Backup with Custom Filename Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Specify a custom filename for the backup zip file. ```bash ./haven backup mybackup.zip ``` -------------------------------- ### Perform Manual Restore with Custom Filename Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Restore relay data from a specified zip file. ```bash ./haven restore mybackup.zip ``` -------------------------------- ### Configure S3 Cloud Backup Credentials Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Set environment variables in your .env file to configure S3-compatible cloud storage credentials for periodic backups. ```dotenv S3_ACCESS_KEY_ID="your_access_key_id" S3_SECRET_KEY="your_secret_key" S3_ENDPOINT="your_endpoint" S3_REGION="your_region" S3_BUCKET_NAME="your_bucket" ``` -------------------------------- ### Verify Binary File Checksum Source: https://github.com/barrydeen/haven/blob/master/docs/verify.md Use this command to verify the integrity of a downloaded binary file against a checksums file. Ensure the checksums file itself is authentic before running this command. ```bash sha256sum -c --ignore-missing checksums.txt ``` -------------------------------- ### Clone Haven Repository Source: https://github.com/barrydeen/haven/blob/master/docs/build.md Clones the Haven repository from GitHub and navigates into the project directory. ```bash git clone https://github.com/barrydeen/haven.git cd haven ``` -------------------------------- ### Perform Manual Backup to Cloud with Custom Filename Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Back up all relay data to a specified filename and upload it to the configured cloud storage provider. ```bash ./haven backup --to-cloud mybackup.zip ``` -------------------------------- ### Configure LMDB Engine Source: https://github.com/barrydeen/haven/blob/master/README.md Set the DB_ENGINE environment variable to 'lmdb' in the .env file to switch from the default BadgerDB to LMDB. ```bash DB_ENGINE=lmdb ``` -------------------------------- ### Restore from Cloud with Default Name Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Restore relay data from the cloud using the default backup filename. ```bash ./haven restore --from-cloud ``` -------------------------------- ### Restore from Cloud with Custom Filename Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Restore relay data from the cloud using a specified filename. ```bash ./haven restore --from-cloud mybackup.zip ``` -------------------------------- ### Systemd Service Configuration Source: https://github.com/barrydeen/haven/blob/master/README.md Configuration content for the Haven Relay systemd service. This includes service description, execution commands, working directory, memory limits, and restart policy. ```ini [Unit] Description=Haven Relay After=network.target [Service] ExecStart=/home/ubuntu/haven/haven #Edit path to point to where you installed Haven WorkingDirectory=/home/ubuntu/haven #Edit path to point to where you installed Haven MemoryMax=1000M # Example, Limit memory usage to 1000 MB | Edit this to fit your machine Restart=always [Install] WantedBy=multi-user.target ``` -------------------------------- ### Sign Haven's GPG Key Locally Source: https://github.com/barrydeen/haven/blob/master/docs/verify.md Sign Haven's public GPG key with your own signing key. Replace YOUR_SIGNING_KEY_ID with your actual GPG key ID. ```bash gpg --local-user YOUR_SIGNING_KEY_ID --sign-key 19243581B019B2452DA2F82870FF859890221E23 ``` -------------------------------- ### Configure Periodic Backup Interval Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Set the BACKUP_INTERVAL_HOURS environment variable to define how often the relay should back up the database. ```dotenv BACKUP_INTERVAL_HOURS=24 ``` -------------------------------- ### AWS S3 Configuration Source: https://github.com/barrydeen/haven/blob/master/docs/cloud-storage.md Set the S3_ACCESS_KEY, S3_SECRET_KEY, S3_ENDPOINT, S3_REGION, and S3_BUCKET_NAME for AWS S3 backups. ```Dotenv S3_ACCESS_KEY="AKIAIOSFODNN7EXAMPLE" S3_SECRET_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" S3_ENDPOINT="s3.us-east-1.amazonaws.com" S3_REGION="us-east-1" S3_BUCKET_NAME="haven_backup" ``` -------------------------------- ### Backup Specific Relay to Cloud Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Back up data from a specific relay to a JSONL file and upload it to the configured cloud storage provider. ```bash ./haven backup --relay outbox --to-cloud outbox.jsonl ``` -------------------------------- ### Set Whitelist Environment Variable Source: https://github.com/barrydeen/haven/blob/master/docs/access-control.md Set the WHITELISTED_NPUBS_FILE environment variable in your .env file to specify the path to your whitelist configuration. ```env WHITELISTED_NPUBS_FILE=whitelisted_npubs.json ``` -------------------------------- ### Backup Specific Relay to JSONL File Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Back up data from a specific relay to a JSONL file. ```bash ./haven backup --relay outbox outbox.jsonl ``` -------------------------------- ### Configure Web of Trust Depth Source: https://github.com/barrydeen/haven/blob/master/docs/wot.md Set the WOT_DEPTH environment variable to control the level of trust required for relay access. Levels range from 0 (disabled) to 3 (connections of connections). ```shell export WOT_DEPTH=2 ``` -------------------------------- ### macOS Terminal Script for Haven Relay Source: https://github.com/barrydeen/haven/blob/master/README.md A script for macOS's Script Editor to open a Terminal window and run the Haven binary. This is used to set up the relay to run on boot. ```applescript tell application "Terminal" activate do script "cd \"$HOME/haven\"; ./haven; exec $SHELL" end tell ``` -------------------------------- ### Configure Minimum Followers for WoT Level 3 Source: https://github.com/barrydeen/haven/blob/master/docs/wot.md Adjust WOT_MINIMUM_FOLLOWERS to set the threshold for common followers required to include connections in the Web of Trust at Level 3. The default is 3. ```shell export WOT_MINIMUM_FOLLOWERS=5 ``` -------------------------------- ### Restore Specific Relay from Cloud Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Restore data for a specific relay from a JSONL file stored in the cloud. ```bash ./haven restore --relay outbox --from-cloud outbox.jsonl ``` -------------------------------- ### Set Blacklist Environment Variable Source: https://github.com/barrydeen/haven/blob/master/docs/access-control.md Set the BLACKLISTED_NPUBS_FILE environment variable in your .env file to specify the path to your blacklist configuration. ```env BLACKLISTED_NPUBS_FILE=blacklisted_npubs.json ``` -------------------------------- ### Publish Signed GPG Key Source: https://github.com/barrydeen/haven/blob/master/docs/verify.md Optionally, publish your signed version of Haven's GPG key to keys.openpgp.org. This helps in establishing trust within the PGP Web of Trust. ```bash gpg --keyserver hkps://keys.openpgp.org --send-keys 19243581B019B2452DA2F82870FF859890221E23 ``` -------------------------------- ### Reload Systemd Daemon Source: https://github.com/barrydeen/haven/blob/master/README.md Reloads the systemd manager configuration to recognize the newly created haven.service file. ```bash sudo systemctl daemon-reload ``` -------------------------------- ### GCP Cloud Storage Configuration Source: https://github.com/barrydeen/haven/blob/master/docs/cloud-storage.md Configure S3_ENDPOINT to storage.googleapis.com and use HMAC keys for GCP Cloud Storage backups. S3_REGION can be left blank. ```Dotenv S3_ACCESS_KEY_ID="GOOGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" S3_SECRET_KEY="Yyy+YYY0/yYYYYyyyy0+YyyYyyYyyYyyyyYyyYyy" S3_ENDPOINT="storage.googleapis.com" S3_REGION="" S3_BUCKET_NAME="haven_backup" ``` -------------------------------- ### Configure WoT Data Fetch Timeout Source: https://github.com/barrydeen/haven/blob/master/docs/wot.md Set WOT_FETCH_TIMEOUT_SECONDS to define the maximum waiting time in seconds for fetching Web of Trust data from other relays. The default is 30 seconds. ```shell export WOT_FETCH_TIMEOUT_SECONDS=60 ``` -------------------------------- ### Apache Virtual Host for WebSocket and HTTP Proxy Source: https://github.com/barrydeen/haven/blob/master/README.md Sets up an Apache virtual host to proxy both WebSocket and standard HTTP traffic to a local service on port 3355. Includes optional HSTS header. ```apache ServerName yourdomain.com RewriteEngine On RewriteCond %{HTTP:Upgrade} websocket [NC] RewriteCond %{HTTP:Connection} upgrade [NC] RewriteRule ^/?(.*) "ws://localhost:3355/$1" [P,L] # Proxy for HTTP traffic (NIP-11 relay info page) ProxyPass / http://localhost:3355/ ProxyPassReverse / http://localhost:3355/ # Optional: Add HSTS header for enhanced security Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" # Optional: Set appropriate WebSocket headers RequestHeader set Upgrade "websocket" RequestHeader set Connection "Upgrade" ``` -------------------------------- ### Restart Apache Service Source: https://github.com/barrydeen/haven/blob/master/README.md Restarts the Apache HTTP server (httpd) to apply virtual host configuration changes. ```bash sudo systemctl restart httpd ``` -------------------------------- ### Verify Checksums File Signature Source: https://github.com/barrydeen/haven/blob/master/docs/verify.md Verifies the signature of the `checksums.txt` file using the `checksums.txt.sig` file. This command checks for a 'Good signature' and displays key fingerprints for manual verification. ```bash gpg --with-fingerprint --verify checksums.txt.sig checksums.txt ``` -------------------------------- ### Caddy Reverse Proxy Configuration Source: https://github.com/barrydeen/haven/blob/master/README.md Configures Caddy to act as a reverse proxy for a local service on port 3355. It handles domain name resolution, proxy headers, and request body size limits. Caddy automatically manages SSL and WebSockets. ```bash # Configuration for HAVEN Relay yourdomain.com { reverse_proxy localhost:3355 { header_up Host {host} header_up X-Real-IP {remote_host} header_up X-Forwarded-For {remote_host} header_up X-Forwarded-Proto {scheme} transport http { versions 1.1 } } request_body { max_size 100MB } } ``` -------------------------------- ### Cloudflare R2 Configuration Source: https://github.com/barrydeen/haven/blob/master/docs/cloud-storage.md Set S3_ACCESS_KEY_ID, S3_SECRET_KEY, S3_ENDPOINT, S3_REGION, and S3_BUCKET_NAME for Cloudflare R2 backups. The endpoint format is .r2.cloudflarestorage.com. ```Dotenv S3_ACCESS_KEY_ID="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" S3_SECRET_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" S3_ENDPOINT=".r2.cloudflarestorage.com" S3_REGION="" S3_BUCKET_NAME="haven_backup" ``` -------------------------------- ### Restore Specific Relay from JSONL File Source: https://github.com/barrydeen/haven/blob/master/docs/backup.md Restore data for a specific relay from a JSONL file. ```bash ./haven restore --relay outbox outbox.jsonl ``` -------------------------------- ### Check Caddy Status and Logs Source: https://github.com/barrydeen/haven/blob/master/README.md Checks the current status of the Caddy service and streams its logs from the last two hours. Useful for debugging. ```bash sudo systemctl status caddy sudo journalctl -u caddy -f --since "2 hour ago" ``` -------------------------------- ### Restart Nginx Service Source: https://github.com/barrydeen/haven/blob/master/README.md Restarts the Nginx service to apply configuration changes. This command is used after modifying Nginx configuration files. ```bash sudo systemctl restart nginx ``` -------------------------------- ### Adjust LMDB Map Size Source: https://github.com/barrydeen/haven/blob/master/README.md On Windows and macOS, adjust the LMDB_MAPSIZE environment variable to a value lower than available disk space if the default 273 GB is too high. Users with large databases may need to increase this value. ```bash LMDB_MAPSIZE=value ``` -------------------------------- ### Web of Trust Levels Visualization Source: https://github.com/barrydeen/haven/blob/master/docs/wot.md A Mermaid diagram illustrating the different levels of the Web of Trust, from Level 0 (Public) to Level 3 (Connections of connections), showing relationships and excluded nodes. ```mermaid flowchart TD %% ------------------------------- %% Level 0 — Public %% ------------------------------- subgraph L0["Level 0"] direction TB %% ------------------------------- %% Level 3 — Connections of Connections %% ------------------------------- subgraph L3["Level 3"] direction TB Note3([Connections of connections with enough common followers]) %% ------------------------------- %% Level 2 — Direct Connections %% ------------------------------- subgraph L2["Level 2"] direction LR Note2([Direct follows only]) %% Level 1 — Private subgraph L1["Level 1"] direction TB You((Relay Owner)) end Alice((Alice)) Bob((Bob)) end Carol((Carol)) Dave((Dave)) Eve((Eve)) end Mallory((Mallory ❌)) end %% ------------------------------- %% Relationships %% ------------------------------- You --> Alice You --> Bob Alice --> Carol Alice --> Dave Bob --> Eve Bob --> Mallory %% ------------------------------- %% Styling for excluded nodes %% ------------------------------- classDef excluded fill:#eee,stroke:#999,stroke-dasharray: 5 5,color:#666; class Mallory excluded; ``` -------------------------------- ### Reload Caddy Service Source: https://github.com/barrydeen/haven/blob/master/README.md Reloads the Caddy service to apply changes made to the Caddyfile configuration. ```bash sudo systemctl reload caddy ``` -------------------------------- ### Configure WoT Data Refresh Interval Source: https://github.com/barrydeen/haven/blob/master/docs/wot.md Specify WOT_REFRESH_INTERVAL to determine how often the relay refreshes its Web of Trust data. Supports duration strings like '24h' or '1h'. The default is '24h'. ```shell export WOT_REFRESH_INTERVAL=12h ``` -------------------------------- ### Edit GPG Key Trust Manually Source: https://github.com/barrydeen/haven/blob/master/docs/verify.md Manually edit a GPG key in your keyring to set its trust level. This is an alternative to signing and publishing, but setting ultimate trust (5) is generally not recommended for external keys. ```bash gpg --edit-key 19243581B019B2452DA2F82870FF859890221E23 ``` -------------------------------- ### Nginx Reverse Proxy Configuration Source: https://github.com/barrydeen/haven/blob/master/README.md Configures Nginx to proxy requests to a local service running on port 3355. Replace 'yourdomain.com' with your actual domain. Adjust 'client_max_body_size' for larger uploads. ```nginx server { listen 80; server_name yourdomain.com; client_max_body_size 100m; location / { proxy_pass http://localhost:3355; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.