aboutsummaryrefslogtreecommitdiffstats
path: root/config/shepherd/init.d/bitcoin.scm
blob: 2fb834d57c56a424e25f2546d91fad468521c47a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
(use-modules (ice-9 popen)
             (ice-9 rdelim))

(define (bitcoin-rpc-pass)
  (let* ((port
          (open-input-pipe
           "pass show Development/bitcoin/testnet/localhost"))
         (result (read-line port)))
    (close-pipe port)
    result))

;; TESTNET
;; Requires the running node which is now under systemd
(register-services
 (service
  '(index-testnet)
  #:documentation "Bitcoin testnet index"
  #:start (make-forkexec-constructor
           (list "/home/titan/dev/bitcoin/rust-bitcoin-indexer/target/release/bitcoin-indexer")
           #:environment-variables `("DATABASE_URL=postgres://titan@%2Frun%2Fpostgresql/btc-testnet-idx"
                                     ,(format #f "NODE_RPC_URL=http://crazy:~a@127.0.0.1:18332/" (bitcoin-rpc-pass))
                                     "RUST_LOG=bitcoin_indexer=info")
           #:log-file "/tmp/btc-indexer.log")
  #:stop (make-kill-destructor 2) ;; 2 is SIGINT - interupt process stream, ctrl-C
  #:respawn? #t))

(let ((nodes '(ali bob carl)))
  (register-services
   (map
    (lambda (name)
      (service
       (list (string->symbol (format #f "lnd-reg-~a" name)))
       #:documentation (format #f "Bitcoin regtest LND lightning wallet ~:@(~a~)" name)
       #:start (make-forkexec-constructor
                (list "/home/titan/.local/bin/lnd"
                      (format #f "--lnddir=/scratch/titan/lnd/reg-~a/" name)))
       #:stop (make-kill-destructor 2) ;; 2 is SIGINT - interupt process stream, ctrl-C
       #:respawn? #t))
    nodes)))

;; ssh
(register-services
 (service
  '(nina-ssh)
  #:documentation "nina ssh tunnel"
  #:start (make-forkexec-constructor
           (list "ssh" "-NTv"
                 "-o" "ServerAliveInterval=60"
                 "-o" "ExitOnForwardFailure=yes"
                 "-o" "StreamLocalBindUnlink=yes"
                 "-L" "8335:localhost:8332"   ;; btcm
                 "-L" "18335:localhost:18332"   ;; btct
                 "-L" "8481:localhost:8480"   ;; LNDT
                 "-L" "18443:localhost:18443"  ;; regbtc
                 "-L" "15005:localhost:15005"  ;; regbtczmq
                 "-L" "15006:localhost:15006"  ;; regbtczmq
                 "-L" "50004:localhost:50004"  ;; regelectrs
                 ;; "-L" "/tmp/nina-mn.socket:/run/cardano-node-mainnet/socket"
                 ;; "-L" "/tmp/nina-pr.socket:/run/cardano-node-preview/socket"
                 ;; "-L" "54320:localhost:5432"
                 ;; "-L" "50001:localhost:50001" ;; electrs
                 ;; "-L" "24224:localhost:24224" ;; electrs monitoring
                 "orchest@nina")
           #:log-file "/tmp/nina-ssh.log"
           #:environment-variables '("SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh"))
  #:stop (make-kill-destructor 2) ;; 2 is SIGINT - interupt process stream, ctrl-C
  #:respawn? #t))