diff options
| author | Matthieu <matthieu@developershouse.xyz> | 2021-09-10 07:47:20 +0400 |
|---|---|---|
| committer | Matthieu <matthieu@developershouse.xyz> | 2021-09-10 07:47:20 +0400 |
| commit | 91a2855e3d0af5199d284d32cc2f6b8280df9d10 (patch) | |
| tree | 1b0ce35097e2e167d67c01f0f092961237a1e63f | |
| parent | 3ebfe6df71b3356250536b35b677a733c42235c9 (diff) | |
dispplay shard error message
| -rw-r--r-- | doc/README.md | 1 | ||||
| -rw-r--r-- | doc/common.md | 6 | ||||
| -rw-r--r-- | doc/components/webhook.md | 8 | ||||
| -rw-r--r-- | doc/structure.md | 15 | ||||
| -rw-r--r-- | examples/config/webhook.yaml | 20 | ||||
| -rw-r--r-- | examples/docker-compose.gateway.yml | 2 | ||||
| -rw-r--r-- | gateway/config/default.yaml | 4 | ||||
| -rw-r--r-- | gateway/docker-compose.yaml | 10 | ||||
| -rw-r--r-- | gateway/src/cluster_manager.rs | 9 | ||||
| -rw-r--r-- | novactl/cmd/init.go | 2 | ||||
| -rw-r--r-- | novactl/lib/version_test.go | 7 | ||||
| -rw-r--r-- | webhook/config/default.yaml | 2 |
12 files changed, 73 insertions, 13 deletions
diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 0000000..fcc815a --- /dev/null +++ b/doc/README.md @@ -0,0 +1 @@ +# Nova documentation
\ No newline at end of file diff --git a/doc/common.md b/doc/common.md new file mode 100644 index 0000000..3dce3ac --- /dev/null +++ b/doc/common.md @@ -0,0 +1,6 @@ +# Common packages + +Nova exposes common packages for all the different projects in the mono-repo. +Since Nova uses two different languages, it has two different common libraries, +one built in rust in [the common/rust](../common/rust) directory and one in Go +in [the common/](../common) directory.
\ No newline at end of file diff --git a/doc/components/webhook.md b/doc/components/webhook.md new file mode 100644 index 0000000..76361ef --- /dev/null +++ b/doc/components/webhook.md @@ -0,0 +1,8 @@ +# Webhook + +> TD;TR The webhook component is an implementation of the discord interaction webhooks; You can either use the Gateway or the Webhooks. The webhooks __require__ an external https endpoint to work. + +The webhook source code is located in the [webhook](../../webhook) folder and is implemented in Rust. It's a simple http web server which implements the webhook signature verification and deserialization. Like the gateway, the messages are redirected using the [relaying system](../common#relaying_trait). + +The signature verification is done using libsodium via the libsodium-sys trait. +Subsequently, it uses code marked as "unsafe" in rust. It's built into the binary statically. Any route can be used to receive webhook messages.
\ No newline at end of file diff --git a/doc/structure.md b/doc/structure.md new file mode 100644 index 0000000..1f82ae3 --- /dev/null +++ b/doc/structure.md @@ -0,0 +1,15 @@ +# Workspace/System structure + +## System structure + +In the nova repository, two different types of projects exist, + +* The management projects primarly in Go \ + They manage the other components of the nova infrastructure. +* The data-path projects \ + They handle all the data transfer / management. + +### Gateway + +> The gateway interfaces with the discord gateway to retrive events in real time +It's implemented in rust and is in the gateway folder.
\ No newline at end of file diff --git a/examples/config/webhook.yaml b/examples/config/webhook.yaml index db8b3a3..fdb76d4 100644 --- a/examples/config/webhook.yaml +++ b/examples/config/webhook.yaml @@ -6,3 +6,23 @@ discord: # Theses credentials are public anyways client_id: 738817757650485300 public_key: "475bed67e20fb1e2d9b9007607f08d7b25b5a0aa936ef2d4ddaf7d592c993860" + +gateway: + relaying: + relay_instances: 0 + clustering: + cluster_size: 1 # The total number of clusters + cluster_id: 0 # Current cluster id + shard_count: 1 # 10 shards by cluster + discord: + token: "token" + large_threshold: 100 + intents: 16384 + +webhook: + server: + address: 0.0.0.0 + port: 8000 + discord: + client_id: 738817757650485300 + public_key: "475bed67e20fb1e2d9b9007607f08d7b25b5a0aa936ef2d4ddaf7d592c993860" diff --git a/examples/docker-compose.gateway.yml b/examples/docker-compose.gateway.yml index 0cd1472..8f42454 100644 --- a/examples/docker-compose.gateway.yml +++ b/examples/docker-compose.gateway.yml @@ -5,4 +5,4 @@ services: image: "ghcr.io/discordnova/nova/gateway@sha256:3432794af8d6f910b06bf8502bc92e5ecca3d6f4c0ec302ca77df03c6a94b014" environment: - DISCORD_TOKEN="<your discord token>" - - RUST_LOG=info
\ No newline at end of file + - RUST_LOG=debug
\ No newline at end of file diff --git a/gateway/config/default.yaml b/gateway/config/default.yaml index 519810c..1c6cd41 100644 --- a/gateway/config/default.yaml +++ b/gateway/config/default.yaml @@ -6,8 +6,8 @@ gateway: clustering: cluster_size: 1 # The total number of clusters cluster_id: 0 # Current cluster id - shard_count: 10 # 10 shards by cluster + shard_count: 1 # 10 shards by cluster discord: token: "token" large_threshold: 100 - intents: 0
\ No newline at end of file + intents: 16384
\ No newline at end of file diff --git a/gateway/docker-compose.yaml b/gateway/docker-compose.yaml new file mode 100644 index 0000000..c6b070e --- /dev/null +++ b/gateway/docker-compose.yaml @@ -0,0 +1,10 @@ +version: "3.3" + +services: + cluster1: + image: ghcr.io/discordnova/nova/gateway@sha256:e37764f61b76617200cc4444dd9e50e76e8ecd9c0a9d411779731fd80a986260 + environment: + - NOVA_gateway_LOG=debug + restart: always + volumes: + - ./config/default.yaml:/app/gateway/gateway.runfiles/nova/config/default.yaml diff --git a/gateway/src/cluster_manager.rs b/gateway/src/cluster_manager.rs index 8900979..627fcfd 100644 --- a/gateway/src/cluster_manager.rs +++ b/gateway/src/cluster_manager.rs @@ -38,9 +38,10 @@ impl ClusterManager { }), })); } - let tasks = self.gateway_connexions.into_iter().map(|item| Box::pin(item.start())); - select_all(tasks).await; - - info!("one shard crashed, we need a restart"); + let tasks = self.gateway_connexions.into_iter().map(|item| { + Box::pin(item.start()) + }); + let task = select_all(tasks).await; + info!("one shard crashed, we need a restart {:?}", task.0); } }
\ No newline at end of file diff --git a/novactl/cmd/init.go b/novactl/cmd/init.go index ff796c6..47a5559 100644 --- a/novactl/cmd/init.go +++ b/novactl/cmd/init.go @@ -16,7 +16,7 @@ import ( var (
InitializeCommand = &cobra.Command{
Use: "init",
- Short: "Initialize a newnova based project",
+ Short: "Initialize a new nova based project",
Run: initNovaRepo,
}
)
diff --git a/novactl/lib/version_test.go b/novactl/lib/version_test.go index 5ec88c7..665780f 100644 --- a/novactl/lib/version_test.go +++ b/novactl/lib/version_test.go @@ -1,12 +1,13 @@ package lib_test
import (
- "github.com/discordnova/nova/novactl/lib"
"testing"
+
+ "github.com/discordnova/nova/novactl/lib"
)
func TestVersion(t *testing.T) {
- if lib.VERSION != "0.0.1" {
+ if lib.VERSION != "0.0.1" {
t.Fatalf("Version number do not match %s", lib.VERSION)
}
-}
\ No newline at end of file +}
diff --git a/webhook/config/default.yaml b/webhook/config/default.yaml index 15d40a4..80cf77a 100644 --- a/webhook/config/default.yaml +++ b/webhook/config/default.yaml @@ -12,5 +12,3 @@ webhook: client_id: 738817757650485300
public_key: "475bed67e20fb1e2d9b9007607f08d7b25b5a0aa936ef2d4ddaf7d592c993860"
-gateway:
- truc_machin: "aaaaaaaa"
|
