aboutsummaryrefslogtreecommitdiffstats
path: root/config/shepherd/init.d/bitcoin.scm
blob: 93f76a3649a58144a9e48d69419fe82d0faf6e23 (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
(use-modules (ice-9 popen)
             (ice-9 rdelim))

(define (make-dir-parents dir-path)
  (unless (access? dir-path F_OK)
    (make-dir-parents (dirname dir-path))
    (mkdir dir-path)))

(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
 (make <service>
   #:docstring "Bitcoin testnet index"
   #:provides '(index-testnet)
   #: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))

(register-services
 (make <service>
   #:docstring "Bitcoin testnet lnd lightning"
   #:provides '(lnd-testnet)
   #:start (make-forkexec-constructor
            (list "/home/titan/.local/bin/lnd"
                  "--lnddir=/mnt/disk/personal/bitcoin/lnd/"
                  "--noseedbackup"))
   #:stop (make-kill-destructor 2) ;; 2 is SIGINT - interupt process stream, ctrl-C
   #:respawn? #t))