--- # DATUM Gateway: solo/pooled mining gateway, built from source on knots-box. # # This is HALF OF A SYSTEM. The Bitcoin Knots node on the same host feeds it via # `blocknotify=killall -USR1 datum_gateway` in bitcoin.conf (see # roles/bitcoin_knots/README.md). Changing either config means thinking about # both. Interrupting Stratum costs mining shares, so check for connected miners # before restarting: # ss -tn state established '( sport = :23334 )' - name: Deploy DATUM Gateway on the bitcoin host hosts: bitcoin become: yes vars: # Preserves the push URL this check reports to. The role knows nothing about # Uptime Kuma — this is just "a URL that accepts a ping". healthcheck_push_url: "{{ healthcheck_push_urls.datum_gateway | default('') }}" roles: - datum_gateway - name: Configure Caddy reverse proxy for the DATUM Gateway dashboard on the edge host hosts: edge become: yes tasks: - name: Publish the DATUM Gateway dashboard through Caddy ansible.builtin.include_role: name: caddy_site vars: caddy_site_name: datum-gateway caddy_site_domain: "{{ subdomains.datum_gateway }}.{{ root_domain }}" caddy_site_upstream: "{{ hostvars['knots_box_local'].ansible_host }}:{{ hostvars['knots_box_local'].datum_gateway_api_port }}" caddy_site_resolvers: "100.100.100.100" caddy_site_basic_auth: - user: "{{ datum_dashboard_username }}" hash: "{{ datum_dashboard_password_hash }}" # The role validates its own site fragment; this re-validates the whole # assembled Caddyfile, which is the only thing that catches a conflict # between two sites. - name: Validate the assembled Caddyfile ansible.builtin.command: caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile changed_when: false - name: Setup public Stratum port forwarding on the edge host hosts: edge become: yes tasks: - name: Expose the DATUM Stratum port through a socket proxy ansible.builtin.include_role: name: socket_proxy vars: socket_proxy_name: datum-stratum socket_proxy_description: "DATUM Stratum" socket_proxy_listen_port: "{{ hostvars['knots_box_local'].datum_gateway_stratum_port }}" socket_proxy_upstream_host: "{{ hostvars['knots_box_local'].ansible_host }}" # Matches the UFW comment already on the edge host; the derived default # would say "DATUM Stratum" and rewrite the rule. socket_proxy_ufw_comment: "DATUM Gateway Stratum public access"