1. Help Center
  2. Getting Started
  3. Getting Started With Diarkis Server Development

Diarkis Server Template Directories

We will look at the directories of Diarkis Server Template.

Below is the directories of Diarkis Server Template:

───┬─ servers/ ─┬──── http/main.go      [HTTP server main]
   │            │
   │            ├──── udp/main.go       [UDP server main]
   │            │
   │            ├──── tcp/main.go       [TCP server main]
   │            │
   │            ├──── connector/main.go [Connector server main]
   │            │
   │            └──── ws/main.go        [WebSocket server main]
   │
   ├─ mars/ ───────── main.go
   │
   │
   ├─ healthcheck/ ── main.go
   │
   │
   ├─ configs/ ─┬──── shared/ [Shared configuration directory] ────────────────────┬─ field.json
   │            │                                                                  ├─ group.json
   │            ├──── http/     [HTTP configuration directory] ──────── main.json  ├─ log.json
   │            │                                                                  ├─ matching.json
   │            ├──── udp/      [UDP configuration directory]  ──────── main.json  └─ mesh.json
   │            │
   │            ├──── tcp/      [TCP configuration directory]  ──────── main.json
   │            │
   │            ├──── connector [Connector configuration directory] ─── main.json
   │            │
   │            └──── ws/       [WebSocket configuration directory] ─── main.json
   │
   ├─ cmds/  [Custom client command directory] ────────────────┬── main.go [Entry point for all cmds]
   │                                                           │
   ├─ ws_cmds/ [Custom client command directory for WebSocket] │
   │                                                           │
   │                                                           ├── http   ──────────────────────────────────────┬─── main.go
   ├─ lib/   [Shared library directory]                        ├── room   ──────────────────────────── main.go  └─── matching.go
   │                                                           ├── group  ──────────────────────────── main.go
   ├─ bin/   [Built server binary directory]                   ├── field  ──────────────────────────── main.go
   │                                                           └── custom ──────────────────────────── main.go
   │
   ├─ build.yml [Build configuration file for diarkis-cli]
   │
   └─ go.mod [Go module file for the project]

Server Entries

Diarkis server is separated by network protocol. Here we have UDP, TCP, WS (WebSocket), and HTTP server main.go files under server.

These are the server entry points for each server.

MARS Server

Diarkis has its own unique server called MARS every Diarkis server cluster must have one MARS server. mars/main.go is the MARS server main code.

You do NOT need to edit this file at all. You simply build MARS server using diarkis-cli.

Health Check

When you deploy Diarkis server cluster on Kubernetes, it requires health check on every server pod. Diarkis Server Template provides the health check tool for this.

Similar to MARS server, you do NOT need to edit healthcheck/main.go, but simple build it with diarkis-cli.

Configurations

configs/ directory contains all configuration files for the servers.

Custom Commands

Diarkis server allows you to implement your own custom commands.

Commands are ways for the Diarkis client and server to communicate each other and execute operations RPC style.

There are two custom cmmand directories:

  • cmds/ for UDP, TCP, and HTTP
  • ws_cmds/ for WebSocket.

Build.yml File

build.yml is used by diarkis-cli. For details on build.yml file, please read here.