]> git.puffer.fish Git - matthieu/nova.git/commitdiff
dispplay shard error message
authorMatthieu <matthieu@developershouse.xyz>
Fri, 10 Sep 2021 03:47:20 +0000 (07:47 +0400)
committerMatthieu <matthieu@developershouse.xyz>
Fri, 10 Sep 2021 03:47:20 +0000 (07:47 +0400)
12 files changed:
doc/README.md [new file with mode: 0644]
doc/common.md [new file with mode: 0644]
doc/components/webhook.md [new file with mode: 0644]
doc/structure.md [new file with mode: 0644]
examples/config/webhook.yaml
examples/docker-compose.gateway.yml
gateway/config/default.yaml
gateway/docker-compose.yaml [new file with mode: 0644]
gateway/src/cluster_manager.rs
novactl/cmd/init.go
novactl/lib/version_test.go
webhook/config/default.yaml

diff --git a/doc/README.md b/doc/README.md
new file mode 100644 (file)
index 0000000..fcc815a
--- /dev/null
@@ -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 (file)
index 0000000..3dce3ac
--- /dev/null
@@ -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 (file)
index 0000000..76361ef
--- /dev/null
@@ -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 (file)
index 0000000..1f82ae3
--- /dev/null
@@ -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
index db8b3a3adb4cb0445d4f0d70c4a08b27b122ddc9..fdb76d4f2529dc41341c34c0864e16e680a062fa 100644 (file)
@@ -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"
index 0cd1472bafd8fe81017a57c47e25037ef5b033bd..8f424547ba60838aa42e7b2668aa7ba6fb17a949 100644 (file)
@@ -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
index 519810ce02683c0aabe475f77a79f837b6b0c970..1c6cd41692136fa0e2fd55f16d6db862c58dc6ae 100644 (file)
@@ -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 (file)
index 0000000..c6b070e
--- /dev/null
@@ -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
index 8900979a214ebf44df24b9b9a4b7e62b3309bb13..627fcfd7990efa81da11c745b29b7113711c7b1a 100644 (file)
@@ -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
index ff796c6c9842eec4b7872f2963fec7252ecab842..47a5559599b2c802df6ea002a46b9ef20dd96ad4 100644 (file)
@@ -16,7 +16,7 @@ import (
 var (\r
        InitializeCommand = &cobra.Command{\r
                Use:   "init",\r
-               Short: "Initialize a newnova based project",\r
+               Short: "Initialize a new nova based project",\r
                Run:   initNovaRepo,\r
        }\r
 )\r
index 5ec88c7bc35541c005d55783485b1322ce7ab93d..665780ffa0706ec10942e0f03f27b2d0d3a09d40 100644 (file)
@@ -1,12 +1,13 @@
 package lib_test\r
 \r
 import (\r
-       "github.com/discordnova/nova/novactl/lib"\r
        "testing"\r
+\r
+       "github.com/discordnova/nova/novactl/lib"\r
 )\r
 \r
 func TestVersion(t *testing.T) {\r
-    if lib.VERSION != "0.0.1" {\r
+       if lib.VERSION != "0.0.1" {\r
                t.Fatalf("Version number do not match %s", lib.VERSION)\r
        }\r
-}
\ No newline at end of file
+}\r
index 15d40a4c1f030b264e42aaeaae2e113dff907bae..80cf77a00eee38b9f306e275f8c4da347a19cf40 100644 (file)
@@ -12,5 +12,3 @@ webhook:
     client_id: 738817757650485300\r
     public_key: "475bed67e20fb1e2d9b9007607f08d7b25b5a0aa936ef2d4ddaf7d592c993860"\r
 \r
-gateway:\r
-  truc_machin: "aaaaaaaa"\r