Hetzner Community Content

repository·master·Indexed 19 days ago

https://github.com/hetzneronline/community-content

A collection of community-contributed tutorials and documentation for Hetzner users. Content includes guides on running DeepSeek R1 with Ollama, installing AWX without Kubernetes on Ubuntu 20.04, PHP Symfony development prerequisites, and installing the duf utility on Linux.

Tokens
257.6K
Snippets
837
Records
1.1K
Agent score
65%

What's inside hetzneronline-community-content

  1. Prerequisites for setting up Vaultwarden

    master

    Before starting the Vaultwarden installation, ensure you have the following:

    • A Hetzner Account.
    • Control of a publicly resolvable domain.
    • An SMTP Server (can be a free webmail service).
    • An Ubuntu 24.04 server (or Debian 12, though Debian requires manual installation of dependencies).

    Security Warning: Vaultwarden decrypts user data only on the endpoint (app, browser extension, or web app). If a user loses their master key, all their data is permanently lost. Ensure you are comfortable with these security parameters before storing critical data.

  2. Provision a highly available load balancer in Hetzner Cloud with Ansible

    master

    This tutorial demonstrates how to build a highly available (HA) load balancer setup using Hetzner Cloud, haproxy, keepalived, and Ansible.

    Architecture Overview

    • haproxy: Handles traffic distribution across multiple backend servers and performs health checks.
    • keepalived: Manages high availability by ensuring one load balancer (master or backup) is always active. It uses the Hetzner Cloud CLI to assign a floating IP address to the active node, enabling seamless failover.
    • Floating IP: An IP address that can be moved between servers, allowing DNS to point to a single stable address regardless of which load balancer is active.
    • Ansible: Automates the configuration of the servers and the management of cloud resources.

    Prerequisites

    • A Hetzner Cloud account and project.
    • A Hetzner Cloud API token (found under Access > API tokens in the console).
    • Ansible and Python installed on your local machine.
    • The hcloud-python module installed (pip install hcloud-python) to enable Ansible's dynamic inventory for Hetzner Cloud.
  3. Understand the MariaDB container controller (main.sh)

    master

    The main.sh script acts as the container's entrypoint and controller. It uses the REQUEST environment variable to determine its mode of operation:

    • REQUEST=initialize: Runs mariadb-install-db to set up the initial database files in $DIR_DATA using --auth-root-authentication-method=socket.
    • REQUEST=run: Starts the mariadbd daemon.

    Signal Handling: The script includes a trap for SIGTERM. When Docker stops a container, it sends SIGTERM to main.sh. The script catches this and executes signal_terminate_trap, which uses mariadb-admin shutdown to ensure a clean database shutdown before the container exits.

    #!/bin/ash
    set -e
    
    signal_terminate_trap() {
        mariadb-admin shutdown &
        wait $!
        echo "MariaDB shut down successfully"
    }
    
    trap "signal_terminate_trap" SIGTERM
    
    if [ "$REQUEST" == "run" ]; then
        exec mariadbd &
        wait $!
        exit 1
    fi
    
    if [ "$REQUEST" == "initialize" ]; then
        # ... initialization logic ...
    fi
  4. How background transcription workers work

    master

    The API uses a producer-consumer pattern to handle heavy transcription tasks without blocking the web server:

    1. The Queue: An os.queue.Queue holds (transcription_id, file_path) tuples.
    2. The Worker Thread: A background thread runs a worker() function that continuously pulls tasks from the queue.
    3. Concurrency: The worker uses a concurrent.futures.ThreadPoolExecutor with a defined MAX_WORKERS limit to execute the transcribe_audio function in parallel.
    4. State Management: A global dictionary transcription_status tracks the lifecycle of each task (pending $\rightarrow$ in_progress $\rightarrow$ completed/failed) so the /progress endpoint can report status to the user.
    def worker():
        with ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
            while True:
                transcription_id, file_path = progress_queue.get()
                executor.submit(transcribe_audio, transcription_id, file_path)
                progress_queue.task_done()
    
    # Start the background worker thread
    threading.Thread(target=worker, daemon=True).start()
  5. Docker Core Concepts

    master

    Understanding the fundamental building blocks of Docker:

    • Images: Snapshots or templates of a file system containing everything needed to launch an application.
    • Containers: The actual running instances of an application created from an image.
    • Layers: The components of an image. Each instruction in a Dockerfile creates a layer. Docker uses layer caching to reuse unchanged layers during builds, speeding up the process.
    • Registries: Remote services (like Docker Hub, GCP, AWS, or Azure) where images are stored and shared via push and pull operations.
  6. Use Argo CD Dashboards and Views

    master

    Argo CD provides several visualization modes to inspect your deployed resources. Use the icons in the top right corner of the Application view to switch between:

    • Standard View: The default view showing resource hierarchies and health status.
    • Node View: Provides statistics and insights regarding the nodes in your cluster.
    • Network View: Displays the network topology, showing connections between different resources (e.g., showing which Pod is assigned to which Service).
    • Table View: Displays all resources in a structured table format.
  7. How the CrowdSec Nginx WAF architecture works

    master

    This setup implements an application-layer firewall using the following flow:

    1. Nginx receives every inbound HTTP request.
    2. The crowdsec-nginx-bouncer intercepts the request and sends it to CrowdSec AppSec before it reaches the upstream application.
    3. CrowdSec AppSec evaluates the request against the OWASP Core Rule Set (CRS) and virtual patches.
    4. If a match is found, CrowdSec blocks the request with an HTTP 403 response.
    5. The event is stored for observability, allowing the CrowdSec agent to correlate WAF events with other IP-level behavior (like SSH brute-force attacks).
  8. Optimize custom image disk size for compatibility

    master

    When creating custom images (Snapshots) with Packer for Hetzner Cloud, use the smallest available instance sizes during the build process.

    Why this matters: A new VM created from a Snapshot must have a disk that is at least the same size as the disk used when the Snapshot was created. If you build an image using a large server (e.g., 240GB), you will be unable to deploy that image to any VM with a disk smaller than 240GB, limiting your deployment flexibility.

  9. How reasoning models like DeepSeek R1 work

    master

    DeepSeek R1 is a reasoning AI model designed for logical, analytical, and contextual tasks. Unlike traditional models that rely on pattern recognition, reasoning models use processes like deduction and inference to solve complex problems.

    Key Concepts

    • Distillation: Instead of storing massive raw datasets, these models are trained to replicate the reasoning outputs of more powerful LLMs. This allows them to remain compact while maintaining high accuracy.
    • Response Structure: Reasoning models typically provide a two-part response:
      1. Chain of Thought: A step-by-step analysis where the model "thinks" through the problem (often wrapped in <think> tags).
      2. Answer: The final conclusion or result.

    Example Output Format

    <think>
    Okay, so I need to ...
    </think>
    
    In conclusion, you ...
  10. How Cluster API and CAPH Custom Resources work

    master

    Cluster API (CAPI) manages infrastructure using a hierarchical model similar to Kubernetes' own resource management:

    • MachineDeployment: Creates MachineSets.
    • MachineSet: Responsible for creating individual Machines.

    Because CAPI is provider-agnostic, the Cluster API Provider Hetzner (CAPH) provides specific Custom Resources to map these to Hetzner infrastructure:

    • HCloudMachine: Represents a Hetzner Cloud VM.
    • HetznerBareMetalMachine: Represents a dedicated bare metal server.
    • HetznerBareMetalHost: Represents the inventory of available bare metal servers in your Hetzner Robot account.

    In this workflow, you register bare metal servers as HetznerBareMetalHost resources, and when a cluster requests bare metal machines, CAPH selects them from this inventory.