-
Notifications
You must be signed in to change notification settings - Fork 2
/
swarm-bee.rb
64 lines (53 loc) · 2.02 KB
/
swarm-bee.rb
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
# typed: false
# frozen_string_literal: true
# This file was generated by GoReleaser. DO NOT EDIT.
class SwarmBee < Formula
desc "Ethereum Swarm node"
homepage "https://swarm.ethereum.org/"
version "2.3.1"
depends_on :macos
on_intel do
url "https://github.com/ethersphere/bee/releases/download/v2.3.1/bee-darwin-amd64.tar.gz"
sha256 "4656805579e4eeab40898a568f131e78a1791b102d0bfe6a714754038b03d4d3"
def install
(etc/"swarm-bee").mkpath
(var/"lib/swarm-bee").mkpath
bin.install ["bee", "bee-get-addr"]
etc.install "bee.yaml" => "swarm-bee/bee.yaml" unless File.exists? etc/"swarm-bee/bee.yaml"
end
end
on_arm do
url "https://github.com/ethersphere/bee/releases/download/v2.3.1/bee-darwin-arm64.tar.gz"
sha256 "361a065242b501129c9c243cebc3d6d065d6a10e52e26835f88315ea82fbc912"
def install
(etc/"swarm-bee").mkpath
(var/"lib/swarm-bee").mkpath
bin.install ["bee", "bee-get-addr"]
etc.install "bee.yaml" => "swarm-bee/bee.yaml" unless File.exists? etc/"swarm-bee/bee.yaml"
end
end
def post_install
unless File.exists? "#{var}/lib/swarm-bee/password"
system("openssl", "rand", "-out", var/"lib/swarm-bee/password", "-base64", "32")
end
system(bin/"bee", "init", "--config", etc/"swarm-bee/bee.yaml", ">/dev/null", "2>&1")
end
def caveats
<<~EOS
Logs: #{var}/log/swarm-bee/bee.log
Config: #{etc}/swarm-bee/bee.yaml
Bee requires a Gnosis Chain RPC endpoint to function. By default this is expected to be found at ws://localhost:8546.
Please see https://docs.ethswarm.org/docs/installation/install for more details on how to configure your node.
After you finish configuration run 'bee-get-addr' and fund your node with XDAI, and also XBZZ if so desired.
EOS
end
service do
run [bin/"bee", "start", "--config", etc/"swarm-bee/bee.yaml"]
keep_alive true
error_log_path var/"log/swarm-bee/bee.log"
log_path var/"log/swarm-bee/bee.log"
end
test do
system "#{bin}/bee version"
end
end