chore(wakunode2): move wakunode2 to apps directory

This commit is contained in:
Lorenzo Delgado 2022-10-18 12:35:26 -05:00 committed by GitHub
parent d5acb6aab2
commit 757804c9ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 87 additions and 77 deletions

5
apps/wakunode2/nim.cfg Normal file
View File

@ -0,0 +1,5 @@
-d:chronicles_line_numbers
-d:"chronicles_runtime_filtering=on"
-d:nimDebugDlOpen
# Results in empty output for some reason
#-d:"chronicles_enabled_topics=GossipSub:TRACE,WakuRelay:TRACE"

View File

@ -2,29 +2,54 @@
import
std/[options, tables, strutils, sequtils, os],
chronos, chronicles, metrics,
stew/shims/net as stewNet,
chronicles,
chronos,
metrics,
confutils,
toml_serialization,
system/ansi_c,
eth/keys,
eth/p2p/discoveryv5/enr,
libp2p/[builders, multihash],
libp2p/crypto/crypto,
libp2p/protocols/ping,
libp2p/protocols/pubsub/[gossipsub, rpc/messages],
libp2p/[builders, multihash],
libp2p/transports/[transport, wstransport]
libp2p/transports/[transport, wstransport],
libp2p/nameresolving/dnsresolver
import
../protocol/waku_store,
../protocol/waku_filter,
../protocol/waku_rln_relay/waku_rln_relay_types,
../protocol/waku_peer_exchange,
../utils/[peers, wakuenr],
./peer_manager/peer_manager,
./storage/message/waku_store_queue,
./storage/message/message_retention_policy_capacity,
./storage/message/message_retention_policy_time,
./dnsdisc/waku_dnsdisc,
./discv5/waku_discv5,
./wakuswitch,
./waku_node
../../waku/v2/protocol/waku_store,
../../waku/v2/protocol/waku_filter,
../../waku/v2/protocol/waku_peer_exchange,
../../waku/v2/node/peer_manager/peer_manager,
../../waku/v2/node/dnsdisc/waku_dnsdisc,
../../waku/v2/node/discv5/waku_discv5,
../../waku/v2/node/storage/sqlite,
../../waku/v2/node/storage/peer/waku_peer_storage,
../../waku/v2/node/storage/message/waku_store_queue,
../../waku/v2/node/storage/message/dual_message_store,
../../waku/v2/node/storage/message/sqlite_store,
../../waku/v2/node/storage/message/message_retention_policy_capacity,
../../waku/v2/node/storage/message/message_retention_policy_time,
../../waku/v2/node/wakuswitch,
../../waku/v2/node/waku_node,
../../waku/v2/utils/peers,
../../waku/v2/utils/wakuenr,
../../waku/common/utils/nat,
./wakunode2_setup_rest,
./wakunode2_setup_metrics,
./wakunode2_setup_rpc,
./wakunode2_setup_sql_migrations,
./config
when defined(rln) or defined(rlnzerokit):
import
../../waku/v2/protocol/waku_rln_relay/waku_rln_relay_types,
../../waku/v2/protocol/waku_rln_relay/waku_rln_relay_utils
logScope:
topics = "wakunode.setup"
{.pop.} # @TODO confutils.nim(775, 17) Error: can raise an unlisted exception: ref IOError
@ -36,34 +61,13 @@ when isMainModule:
## 4. Start node and mounted protocols
## 5. Start monitoring tools and external interfaces
## 6. Setup graceful shutdown hooks
import
confutils, toml_serialization,
system/ansi_c,
libp2p/nameresolving/dnsresolver,
../../common/utils/nat,
./config,
./wakunode2_setup,
./wakunode2_setup_rest,
./wakunode2_setup_metrics,
./wakunode2_setup_rpc,
./wakunode2_setup_sql_migrations,
./storage/sqlite,
./storage/message/dual_message_store,
./storage/message/sqlite_store,
./storage/peer/waku_peer_storage
when defined(rln) or defined(rlnzerokit):
import ../protocol/waku_rln_relay/waku_rln_relay_utils
logScope:
topics = "wakunode.setup"
###################
# Setup functions #
###################
type SetupResult[T] = Result[T, string]
# 1/7 Setup storage
proc setupStorage(conf: WakuNodeConf):
SetupResult[tuple[pStorage: WakuPeerStorage, mStorage: MessageStore]] =

View File

@ -6,17 +6,21 @@ import
chronicles,
chronos,
metrics,
metrics/chronos_httpserver,
./config,
./waku_node,
./peer_manager/peer_manager,
../protocol/waku_filter,
../protocol/waku_store,
../protocol/waku_lightpush,
../protocol/waku_swap/waku_swap,
../protocol/waku_peer_exchange,
../protocol/waku_rln_relay/waku_rln_relay_metrics,
../utils/collector
metrics/chronos_httpserver
import
../../waku/v2/protocol/waku_filter,
../../waku/v2/protocol/waku_store,
../../waku/v2/protocol/waku_lightpush,
../../waku/v2/protocol/waku_swap/waku_swap,
../../waku/v2/protocol/waku_peer_exchange,
../../waku/v2/utils/collector,
../../waku/v2/node/peer_manager/peer_manager,
../../waku/v2/node/waku_node,
./config
when defined(rln) or defined(rlnzerokit):
import ../../waku/v2/protocol/waku_rln_relay/waku_rln_relay_metrics
logScope:
topics = "wakunode.setup.metrics"

View File

@ -5,11 +5,11 @@ import
chronicles,
presto
import
./config,
./waku_node,
./rest/server,
./rest/debug/debug_api,
./rest/relay/[relay_api, topic_cache]
../../waku/v2/node/waku_node,
../../waku/v2/node/rest/server,
../../waku/v2/node/rest/debug/debug_api,
../../waku/v2/node/rest/relay/[relay_api, topic_cache],
./config
logScope:

View File

@ -6,16 +6,16 @@ import
chronicles,
json_rpc/rpcserver
import
./config,
../protocol/waku_message,
./waku_node,
./jsonrpc/[admin_api,
debug_api,
filter_api,
relay_api,
store_api,
private_api,
debug_api]
../../waku/v2/protocol/waku_message,
../../waku/v2/node/waku_node,
../../waku/v2/node/jsonrpc/[admin_api,
debug_api,
filter_api,
relay_api,
store_api,
private_api,
debug_api],
./config
logScope:
topics = "wakunode.setup.rpc"

View File

@ -2,9 +2,10 @@
import
stew/results,
chronicles,
./storage/sqlite,
./storage/migration,
chronicles
import
../../waku/v2/node/storage/sqlite,
../../waku/v2/node/storage/migration,
./config
logScope:

View File

@ -8,7 +8,8 @@ import
libp2p/crypto/[crypto,secp],
eth/keys,
json_rpc/[rpcclient, rpcserver],
../../waku/v2/node/[config, waku_node],
../../waku/v2/node/waku_node,
../../apps/wakunode2/config,
../../waku/common/utils/nat,
../../waku/v2/protocol/waku_message

View File

@ -65,7 +65,7 @@ task test1, "Build & run Waku v1 tests":
### Waku v2 tasks
task wakunode2, "Build Waku v2 (experimental) cli node":
let name = "wakunode2"
buildBinary name, "waku/v2/node/", "-d:chronicles_log_level=DEBUG"
buildBinary name, "apps/wakunode2/", "-d:chronicles_log_level=DEBUG"
task bridge, "Build Waku v1 - v2 bridge":
let name = "wakubridge"

View File

@ -6,7 +6,7 @@ import
eth/keys,
eth/p2p/discoveryv5/[enr, node, protocol],
stew/results,
../config,
../../../../apps/wakunode2/config, ## TODO: Remove dependency on wakunode2 config module
../../utils/[peers, wakuenr]
export protocol, wakuenr

View File

@ -1,5 +0,0 @@
{.push raises: [Defect].}
import stew/results
type SetupResult*[T] = Result[T, string]

View File

@ -17,7 +17,7 @@ import
waku_rln_relay_metrics,
../../utils/time,
../../node/waku_node,
../../node/config, ## TODO: Decouple the protocol code from the app configuration
../../../../../apps/wakunode2/config, ## TODO: Decouple the protocol code from the app configuration
../../../../../apps/chat2/config_chat2, ## TODO: Decouple the protocol code from the app configuration
../waku_message