Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 3485f7f

Browse files
committed
[CO-390] Introduce library code for running a demo cluster
1 parent c68ec9c commit 3485f7f

File tree

6 files changed

+907
-31
lines changed

6 files changed

+907
-31
lines changed

lib/src/Pos/Launcher/Launcher.hs

+34-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
-- | Applications of runners to scenarios.
55

66
module Pos.Launcher.Launcher
7-
( -- * Node launcher.
8-
launchNode
9-
) where
7+
( -- * Node launcher.
8+
launchNode
9+
10+
-- * Actions
11+
, actionWithCoreNode
12+
) where
1013

1114
import Universum
1215

@@ -25,11 +28,14 @@ import Pos.Launcher.Configuration (AssetLockPath (..),
2528
import Pos.Launcher.Param (LoggingParams (..), NodeParams (..))
2629
import Pos.Launcher.Resource (NodeResources, bracketNodeResources,
2730
loggerBracket)
31+
import Pos.Launcher.Runner (runRealMode)
32+
import Pos.Launcher.Scenario (runNode)
33+
import Pos.Util.CompileInfo (HasCompileInfo)
2834
import Pos.Util.Util (logException)
35+
import Pos.Util.Wlog (logInfo)
36+
import Pos.Worker.Update (updateTriggerWorker)
2937
import Pos.WorkMode (EmptyMempoolExt)
3038

31-
-- import Pos.Util.CompileInfo (HasCompileInfo, withCompileInfo)
32-
3339

3440
-- | Run a given action from a bunch of static arguments
3541
launchNode
@@ -79,3 +85,26 @@ launchNode nArgs cArgs lArgs action = do
7985
(txpGlobalSettings genesisConfig txpConfig)
8086
(initNodeDBs genesisConfig)
8187
action'
88+
89+
90+
-- | Run basic core node
91+
actionWithCoreNode
92+
:: (HasConfigurations, HasCompileInfo)
93+
=> Genesis.Config
94+
-> WalletConfiguration
95+
-> TxpConfiguration
96+
-> NtpConfiguration
97+
-> NodeParams
98+
-> SscParams
99+
-> NodeResources EmptyMempoolExt
100+
-> IO ()
101+
actionWithCoreNode genesisConfig _ txpConfig _ _ _ nodeRes = do
102+
let plugins = [ updateTriggerWorker ]
103+
104+
logInfo "Wallet is disabled, because software is built w/o it"
105+
106+
runRealMode
107+
genesisConfig
108+
txpConfig
109+
nodeRes
110+
(runNode genesisConfig txpConfig nodeRes plugins)

lib/src/Pos/Web/Types.hs

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
module Pos.Web.Types
44
( SscStage (..)
55
, TlsParams (..)
6+
, TlsClientParams (..)
67
, CConfirmedProposalState (..)
78
) where
89

@@ -33,6 +34,14 @@ data TlsParams = TlsParams
3334
, tpClientAuth :: Bool
3435
} deriving (Show)
3536

37+
-- | TLS Transport Layer Security client file paths
38+
data TlsClientParams = TlsClientParams
39+
{ tpClientCertPath :: !FilePath
40+
, tpClientKeyPath :: !FilePath
41+
, tpClientCaPath :: !FilePath
42+
} deriving (Show)
43+
44+
3645
newtype CConfirmedProposalState = CConfirmedProposalState Text
3746
deriving (Show, Generic, Buildable)
3847

node/Main.hs

+2-14
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,12 @@ import Universum
66

77
import Pos.Client.CLI (SimpleNodeArgs (..), getSimpleNodeOptions,
88
loggingParams)
9-
import Pos.Launcher (launchNode, runNode, runRealMode)
9+
import Pos.Launcher (actionWithCoreNode, launchNode)
1010
import Pos.Util.CompileInfo (withCompileInfo)
11-
import Pos.Util.Wlog (logInfo)
12-
import Pos.Worker.Update (updateTriggerWorker)
1311

1412

1513
main :: IO ()
1614
main = withCompileInfo $ do
1715
SimpleNodeArgs cArgs nArgs <- getSimpleNodeOptions
1816
let lArgs = loggingParams "node" cArgs
19-
20-
launchNode nArgs cArgs lArgs $ \genesisConfig _ txpConfig _ _ _ nodeRes -> do
21-
let plugins = [ updateTriggerWorker ]
22-
23-
logInfo "Wallet is disabled, because software is built w/o it"
24-
25-
runRealMode
26-
genesisConfig
27-
txpConfig
28-
nodeRes
29-
(runNode genesisConfig txpConfig nodeRes plugins)
17+
launchNode nArgs cArgs lArgs actionWithCoreNode

wallet-new/cardano-sl-wallet-new.cabal

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ cabal-version: >=1.10
1616
library
1717
hs-source-dirs: src
1818
exposed-modules: Cardano.Wallet.Action
19+
Cardano.Wallet.Demo
1920
Cardano.Wallet.LegacyAction
2021
Cardano.Wallet.API
2122
Cardano.Wallet.API.Indices
@@ -170,6 +171,7 @@ library
170171
, aeson-options
171172
, aeson-pretty
172173
, async
174+
, attoparsec
173175
, base58-bytestring
174176
, beam-core
175177
, beam-migrate
@@ -210,6 +212,7 @@ library
210212
, http-client
211213
, http-client-tls
212214
, http-types
215+
, iproute
213216
, ixset-typed
214217
, lens
215218
, memory
@@ -218,11 +221,13 @@ library
218221
, neat-interpolation
219222
, network-transport
220223
, optparse-applicative
224+
, parsec
221225
, QuickCheck
222226
, QuickCheck
223227
, reflection
224228
, resourcet
225229
, retry
230+
, safe
226231
, safecopy
227232
, safe-exceptions
228233
, serokell-util
@@ -239,6 +244,7 @@ library
239244
, stm
240245
, stm
241246
, swagger2
247+
, temporary
242248
, text
243249
, time
244250
, time-units

0 commit comments

Comments
 (0)