backend/README.md
2025-05-19 16:32:39 +03:00

3.4 KiB

Server Manager Backend

This is the code for the back-end used in ServerManager.

The server-manager is designed with modularity in mind and is built from a few major parts.

The backend interfaces with these parts separately however it will share the module's internal connection where possible to reduce duplicate connections. For example if several modules use the same mongo connection there is no reason to create several connections to the database.

Modules

User Management

The User management module has several responsibilities and should be split into modules in the future.

  • Fetch and save data about existing users

    • Global Permissions
    • Nickname
    • Contact Email
  • Authenticate a user

Currently the User Management is only implemented with MongoDB as the underlying database

Servers Metadata

The Servers Metadata holds data about existing servers such as:

  • Default command to run when ran without arguments
  • Default ports to open in case no ports are opened
  • Server nickname
  • Data on the image the server uses

Currently only implemented with MongoDB

Servers Authorization

The Servers Authorization Module is responsible for server-specific permissions.

Currently only implemented with MongoDB

Instance Manager

The Instance Manager is responsible for running the servers, and supplying interactive shell to the console of the server.

Can currently manage servers in Docker, and Kubernetes (using the ServerManager Operator)

Configuration Example

Yaml Config format

domain: "games.acooldomain.co"

signing:
  key: ""
  algorithm: "HS512"

email:
  from_email: "no-reply@acooldomain.co"
  username: "no-reply@acooldomain.co"
  password: ""
  server: "mail.acooldomain.co"

authentication:
  type: "UserPass"
  oidc: # can be omitted
    issuer_url: ""
    client_id: ""
    client_secret: ""
  user_pass:
    type: "mongo"
    initial_user:
      email: "acoolname@acooldomain.co"
    mongo:
      url: "mongodb://server-manager-mongo:27017"
      username: ""
      password: ""
      database: "users_db"
      collection: "user_data"
    invite_token_database:
      type: "mongo"
      mongo:
        url: "mongodb://server-manager-mongo:27017"
        username: ""
        password: ""
        database: "users_db"
        collection: "invite_tokens"

instancemanager:
  type: "kubernetes"
  kubernetes:
    namespace: server-manager
  docker: # can be omitted
    file_browser:
      image:
        registry: "filebrowser/filebrowser"
        tag: "latest"
      command: ""
      network: "exposed"
      reverse_proxy:
        middlewares:
          - backend-auth@docker
        entrypoint: "web"

users:
  default_max_owned_servers: 10

servers_database:
  type: "mongo"
  mongo:
    url: "mongodb://server-manager-mongo:27017"
    username: ""
    password: ""
    database: "server_db"
    collection: "servers"

servers_authorization_database:
  type: "mongo"
  mongo:
    url: "mongodb://server-manager-mongo:27017"
    username: ""
    password: ""
    database: "server_db"
    collection: "auth_data"