mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-05-16 15:29:41 +00:00
Merge branch 'master' into deprecate_sync_strategy
This commit is contained in:
commit
8e9cbb53e8
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -79,7 +79,7 @@ jobs:
|
|||||||
- name: Build binaries
|
- name: Build binaries
|
||||||
run: make V=1 QUICK_AND_DIRTY_COMPILER=1 all tools
|
run: make V=1 QUICK_AND_DIRTY_COMPILER=1 all tools
|
||||||
|
|
||||||
trigger-windows-build:
|
build-windows:
|
||||||
uses: ./.github/workflows/windows-build.yml
|
uses: ./.github/workflows/windows-build.yml
|
||||||
with:
|
with:
|
||||||
branch: ${{ github.ref }}
|
branch: ${{ github.ref }}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ RUN make -j$(nproc) ${NIM_COMMIT} $MAKE_TARGET LOG_LEVEL=${LOG_LEVEL} NIMFLAGS="
|
|||||||
|
|
||||||
# PRODUCTION IMAGE -------------------------------------------------------------
|
# PRODUCTION IMAGE -------------------------------------------------------------
|
||||||
|
|
||||||
FROM alpine:3.18 as prod
|
FROM alpine:3.18 AS prod
|
||||||
|
|
||||||
ARG MAKE_TARGET=wakunode2
|
ARG MAKE_TARGET=wakunode2
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# Dockerfile to build a distributable container image from pre-existing binaries
|
# Dockerfile to build a distributable container image from pre-existing binaries
|
||||||
FROM debian:stable-slim as prod
|
FROM debian:stable-slim AS prod
|
||||||
|
|
||||||
ARG MAKE_TARGET=wakunode2
|
ARG MAKE_TARGET=wakunode2
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ proc testWakuNode(): WakuNode =
|
|||||||
newTestWakuNode(privkey, bindIp, port, some(extIp), some(port))
|
newTestWakuNode(privkey, bindIp, port, some(extIp), some(port))
|
||||||
|
|
||||||
suite "Waku v2 REST API - Debug":
|
suite "Waku v2 REST API - Debug":
|
||||||
asyncTest "Get node info - GET /debug/v1/info":
|
asyncTest "Get node info - GET /info":
|
||||||
# Given
|
# Given
|
||||||
let node = testWakuNode()
|
let node = testWakuNode()
|
||||||
await node.start()
|
await node.start()
|
||||||
@ -62,7 +62,7 @@ suite "Waku v2 REST API - Debug":
|
|||||||
await restServer.closeWait()
|
await restServer.closeWait()
|
||||||
await node.stop()
|
await node.stop()
|
||||||
|
|
||||||
asyncTest "Get node version - GET /debug/v1/version":
|
asyncTest "Get node version - GET /version":
|
||||||
# Given
|
# Given
|
||||||
let node = testWakuNode()
|
let node = testWakuNode()
|
||||||
await node.start()
|
await node.start()
|
||||||
|
|||||||
@ -148,7 +148,7 @@ proc startRestServerProtocolSupport*(
|
|||||||
"/relay endpoints are not available. Please check your configuration: --relay"
|
"/relay endpoints are not available. Please check your configuration: --relay"
|
||||||
|
|
||||||
## Filter REST API
|
## Filter REST API
|
||||||
if conf.filternode != "" and node.wakuFilterClient != nil:
|
if node.wakuFilterClient != nil:
|
||||||
let filterCache = MessageCache.init()
|
let filterCache = MessageCache.init()
|
||||||
|
|
||||||
let filterDiscoHandler =
|
let filterDiscoHandler =
|
||||||
@ -161,8 +161,7 @@ proc startRestServerProtocolSupport*(
|
|||||||
router, node, filterCache, filterDiscoHandler
|
router, node, filterCache, filterDiscoHandler
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
restServerNotInstalledTab["filter"] =
|
restServerNotInstalledTab["filter"] = "/filter endpoints are not available."
|
||||||
"/filter endpoints are not available. Please check your configuration: --filternode"
|
|
||||||
|
|
||||||
## Store REST API
|
## Store REST API
|
||||||
let storeDiscoHandler =
|
let storeDiscoHandler =
|
||||||
@ -175,9 +174,10 @@ proc startRestServerProtocolSupport*(
|
|||||||
rest_store_legacy_api.installStoreApiHandlers(router, node, storeDiscoHandler)
|
rest_store_legacy_api.installStoreApiHandlers(router, node, storeDiscoHandler)
|
||||||
|
|
||||||
## Light push API
|
## Light push API
|
||||||
## Install it either if lightpushnode (lightpush service node) is configured and client is mounted)
|
## Install it either if client is mounted)
|
||||||
## or install it to be used with self-hosted lightpush service
|
## or install it to be used with self-hosted lightpush service
|
||||||
if (conf.lightpushnode != "" and node.wakuLegacyLightpushClient != nil) or
|
## We either get lightpushnode (lightpush service node) from config or discovered or self served
|
||||||
|
if (node.wakuLegacyLightpushClient != nil) or
|
||||||
(conf.lightpush and node.wakuLegacyLightPush != nil and node.wakuRelay != nil):
|
(conf.lightpush and node.wakuLegacyLightPush != nil and node.wakuRelay != nil):
|
||||||
let lightDiscoHandler =
|
let lightDiscoHandler =
|
||||||
if not wakuDiscv5.isNil():
|
if not wakuDiscv5.isNil():
|
||||||
@ -190,8 +190,7 @@ proc startRestServerProtocolSupport*(
|
|||||||
)
|
)
|
||||||
rest_lightpush_api.installLightPushRequestHandler(router, node, lightDiscoHandler)
|
rest_lightpush_api.installLightPushRequestHandler(router, node, lightDiscoHandler)
|
||||||
else:
|
else:
|
||||||
restServerNotInstalledTab["lightpush"] =
|
restServerNotInstalledTab["lightpush"] = "/lightpush endpoints are not available."
|
||||||
"/lightpush endpoints are not available. Please check your configuration: --lightpushnode"
|
|
||||||
|
|
||||||
info "REST services are installed"
|
info "REST services are installed"
|
||||||
return ok()
|
return ok()
|
||||||
|
|||||||
@ -11,10 +11,10 @@ logScope:
|
|||||||
|
|
||||||
# TODO: Check how we can use a constant to set the method endpoint (improve "rest" pragma under nim-presto)
|
# TODO: Check how we can use a constant to set the method endpoint (improve "rest" pragma under nim-presto)
|
||||||
proc debugInfoV1*(): RestResponse[DebugWakuInfo] {.
|
proc debugInfoV1*(): RestResponse[DebugWakuInfo] {.
|
||||||
rest, endpoint: "/debug/v1/info", meth: HttpMethod.MethodGet
|
rest, endpoint: "/info", meth: HttpMethod.MethodGet
|
||||||
.}
|
.}
|
||||||
|
|
||||||
# TODO: Check how we can use a constant to set the method endpoint (improve "rest" pragma under nim-presto)
|
# TODO: Check how we can use a constant to set the method endpoint (improve "rest" pragma under nim-presto)
|
||||||
proc debugVersionV1*(): RestResponse[string] {.
|
proc debugVersionV1*(): RestResponse[string] {.
|
||||||
rest, endpoint: "/debug/v1/version", meth: HttpMethod.MethodGet
|
rest, endpoint: "/version", meth: HttpMethod.MethodGet
|
||||||
.}
|
.}
|
||||||
|
|||||||
@ -8,10 +8,12 @@ export types
|
|||||||
logScope:
|
logScope:
|
||||||
topics = "waku node rest debug_api"
|
topics = "waku node rest debug_api"
|
||||||
|
|
||||||
const ROUTE_DEBUG_INFOV1* = "/debug/v1/info"
|
const ROUTE_INFOV1* = "/info"
|
||||||
|
# /debug route is deprecated, will be removed
|
||||||
|
const ROUTE_DEBUG_INFOV1 = "/debug/v1/info"
|
||||||
|
|
||||||
proc installDebugInfoV1Handler(router: var RestRouter, node: WakuNode) =
|
proc installDebugInfoV1Handler(router: var RestRouter, node: WakuNode) =
|
||||||
router.api(MethodGet, ROUTE_DEBUG_INFOV1) do() -> RestApiResponse:
|
let getInfo = proc(): RestApiResponse =
|
||||||
let info = node.info().toDebugWakuInfo()
|
let info = node.info().toDebugWakuInfo()
|
||||||
let resp = RestApiResponse.jsonResponse(info, status = Http200)
|
let resp = RestApiResponse.jsonResponse(info, status = Http200)
|
||||||
if resp.isErr():
|
if resp.isErr():
|
||||||
@ -20,11 +22,22 @@ proc installDebugInfoV1Handler(router: var RestRouter, node: WakuNode) =
|
|||||||
|
|
||||||
return resp.get()
|
return resp.get()
|
||||||
|
|
||||||
const ROUTE_DEBUG_VERSIONV1* = "/debug/v1/version"
|
# /debug route is deprecated, will be removed
|
||||||
|
router.api(MethodGet, ROUTE_DEBUG_INFOV1) do() -> RestApiResponse:
|
||||||
|
return getInfo()
|
||||||
|
router.api(MethodGet, ROUTE_INFOV1) do() -> RestApiResponse:
|
||||||
|
return getInfo()
|
||||||
|
|
||||||
|
const ROUTE_VERSIONV1* = "/version"
|
||||||
|
# /debug route is deprecated, will be removed
|
||||||
|
const ROUTE_DEBUG_VERSIONV1 = "/debug/v1/version"
|
||||||
|
|
||||||
proc installDebugVersionV1Handler(router: var RestRouter, node: WakuNode) =
|
proc installDebugVersionV1Handler(router: var RestRouter, node: WakuNode) =
|
||||||
|
# /debug route is deprecated, will be removed
|
||||||
router.api(MethodGet, ROUTE_DEBUG_VERSIONV1) do() -> RestApiResponse:
|
router.api(MethodGet, ROUTE_DEBUG_VERSIONV1) do() -> RestApiResponse:
|
||||||
return RestApiResponse.textResponse(git_version, status = Http200)
|
return RestApiResponse.textResponse(git_version, status = Http200)
|
||||||
|
router.api(MethodGet, ROUTE_VERSIONV1) do() -> RestApiResponse:
|
||||||
|
return RestApiResponse.textResponse(git_version, status = Http200)
|
||||||
|
|
||||||
proc installDebugApiHandlers*(router: var RestRouter, node: WakuNode) =
|
proc installDebugApiHandlers*(router: var RestRouter, node: WakuNode) =
|
||||||
installDebugInfoV1Handler(router, node)
|
installDebugInfoV1Handler(router, node)
|
||||||
|
|||||||
@ -229,7 +229,7 @@ proc populateEnrCache(wpx: WakuPeerExchange) =
|
|||||||
|
|
||||||
# swap cache for new
|
# swap cache for new
|
||||||
wpx.enrCache = newEnrCache
|
wpx.enrCache = newEnrCache
|
||||||
debug "ENR cache populated"
|
trace "ENR cache populated"
|
||||||
|
|
||||||
proc updatePxEnrCache(wpx: WakuPeerExchange) {.async.} =
|
proc updatePxEnrCache(wpx: WakuPeerExchange) {.async.} =
|
||||||
# try more aggressively to fill the cache at startup
|
# try more aggressively to fill the cache at startup
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user