cardano-up 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c55536463a8a275a7a370bac31474072c837a1411e08455934aa23a9b9d18932
4
- data.tar.gz: b884c70ea66053c81bb91c3eefdef6447bd855e5a91595f0d7cf6ea0d5216b23
3
+ metadata.gz: 97b0c3e82b8f3c963327000c3baf309a9844c69de0d93e4f2c32405e5f21ded3
4
+ data.tar.gz: cd87f4af35c07c65ea108f5b6f9418dd8a56633d8cbb145cf1e9855a027bae51
5
5
  SHA512:
6
- metadata.gz: 84a039aeab642b1e9eb5adcc30ebf1eccc8af53edbf6aebb28025ade0a69a858c9f8f8f7cb66ea4c84f1ff547065c19682347e7e4e5eef1039f47dfec70d14c4
7
- data.tar.gz: 948ba5bad9619f2aaacad6c0cc6a9c1e5f114b8aa3eb1ea40c47141922b6d373eba19be5e8ff586db6f770296ab6cb868efa09773c82523b9fa61b6823e22b34
6
+ metadata.gz: 7fd6b704ef5ee77a7398415452f03dbf8c3a5b44fd68ea19c42c26fa9b09ad318e3f66489c745da663ef7e626ad038d16a57a34d94fa218717ef89da972626be
7
+ data.tar.gz: ab22622009628fdfea1a7c326a49d98d7e9d9f8c95d5a5e9cd3e376f1e920fab794e56a6ff9d452a37cc3052c77c544f646cdb405e276cdb0661013beb408af4
data/bin/cardano-up CHANGED
@@ -14,7 +14,7 @@ doc = <<~DOCOPT
14
14
  #{File.basename(__FILE__)} ls
15
15
  #{File.basename(__FILE__)} config [--set-default] [--bindir <path>] [--configdir <path>] [--logdir <path>] [--statedir <path>]
16
16
  #{File.basename(__FILE__)} <env> [(node|wallet)] [(up|down|ping)] [--port <port>] [--session <name>]
17
- #{File.basename(__FILE__)} <env> (node|wallet) tail [--session <name>]
17
+ #{File.basename(__FILE__)} <env> (node|wallet) tail [--lines <num_lines>] [--session <name>]
18
18
  #{File.basename(__FILE__)} -v | --version
19
19
  #{File.basename(__FILE__)} -e | --examples
20
20
  #{File.basename(__FILE__)} -h | --help
@@ -29,6 +29,7 @@ doc = <<~DOCOPT
29
29
  ones from latest release.
30
30
  down Stop particular service.
31
31
  tail Follow logs for particular service.
32
+ -n --lines <num_lines> Number of lines to show from the end of the log file. [default: 10]
32
33
  ping Ping service to check its status.
33
34
  ls List sessions.
34
35
  -p --port <port> Specify wallet port. [default: 8090]
@@ -122,7 +123,7 @@ Check health of node and wallet on mainnet:
122
123
  Monitor mainnet wallet and node logs (Ctrl + c to stop):
123
124
 
124
125
  $ #{File.basename(__FILE__)} mainnet node tail
125
- $ #{File.basename(__FILE__)} mainnet wallet tail
126
+ $ #{File.basename(__FILE__)} mainnet wallet tail -n 100
126
127
 
127
128
  Stop preprod node:
128
129
 
@@ -316,14 +317,15 @@ Stop mainnet node and wallet:
316
317
  elsif o['tail'] == true
317
318
  env = o['<env>']
318
319
  session_name = o['--session']
320
+ lines = o['--lines'].to_i
319
321
  begin
320
322
  log_dir = File.join(CardanoUp.config[:log_dir], session_name, env)
321
323
  if o['node']
322
324
  log_file = File.join(log_dir, 'node.log')
323
- CardanoUp::Tail.tail(log_file)
325
+ CardanoUp::Tail.tail(log_file, lines)
324
326
  elsif o['wallet']
325
327
  log_file = File.join(log_dir, 'wallet.log')
326
- CardanoUp::Tail.tail(log_file)
328
+ CardanoUp::Tail.tail(log_file, lines)
327
329
  end
328
330
  rescue CardanoUp::EnvNotSupportedError => e
329
331
  warn(e.message)
@@ -113,23 +113,34 @@ module CardanoUp
113
113
  }
114
114
  }
115
115
  CardanoUp::Session.create_or_update(session_name, service_details)
116
- if CardanoUp::Utils.win?
117
- # Turn off p2p for Windows
118
- # TODO: remove after https://github.com/input-output-hk/ouroboros-network/issues/3968 released
119
- config_win = CardanoUp::Utils.from_json("#{config_dir}/config.json")
120
- config_win[:EnableP2P] = false
121
- CardanoUp::Utils.to_json("#{config_dir}/config.json", config_win)
122
- topology = {
123
- Producers: [
124
- {
125
- addr: "#{env}-node.world.dev.cardano.org",
126
- port: 30_002,
127
- valency: 2
128
- }
129
- ]
130
- }
131
- CardanoUp::Utils.to_json("#{config_dir}/topology.json", topology)
132
116
 
117
+ # Turn off p2p in config.json and topology.json
118
+ config_json = CardanoUp::Utils.from_json("#{config_dir}/config.json")
119
+ config_json[:EnableP2P] = false
120
+ CardanoUp::Utils.to_json("#{config_dir}/config.json", config_json)
121
+ addr = env == 'mainnet' ? 'relays-new.cardano-mainnet.iohk.io' : "#{env}-node.world.dev.cardano.org"
122
+ port = case env
123
+ when 'mainnet'
124
+ 3001
125
+ when 'preprod'
126
+ 30_000
127
+ when 'preview'
128
+ 30_002
129
+ else
130
+ 30_000
131
+ end
132
+ topology_json = {
133
+ Producers: [
134
+ {
135
+ addr: addr,
136
+ port: port,
137
+ valency: 2
138
+ }
139
+ ]
140
+ }
141
+ CardanoUp::Utils.to_json("#{config_dir}/topology.json", topology_json)
142
+
143
+ if CardanoUp::Utils.win?
133
144
  # create cardano-node.bat file
134
145
  File.write("#{bin_dir}/cardano-node.bat", node_cmd)
135
146
  install_node = "nssm install #{node_service} #{bin_dir}/cardano-node.bat"
@@ -3,11 +3,12 @@
3
3
  module CardanoUp
4
4
  # Tail log file
5
5
  module Tail
6
- def self.tail(file_path)
6
+ def self.tail(file_path, lines = nil)
7
+ lines_back = lines || 10
7
8
  File.open(file_path) do |log|
8
9
  log.extend(File::Tail)
9
10
  log.interval
10
- log.backward(10)
11
+ log.backward(lines_back.to_i)
11
12
  log.tail { |line| warn line }
12
13
  end
13
14
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Version
4
4
  module CardanoUp
5
- VERSION ||= '0.1.3'
5
+ VERSION ||= '0.1.5'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cardano-up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Stachyra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-25 00:00:00.000000000 Z
11
+ date: 2023-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt