1.1.0 • Published 9 months ago

@bytelab.studio/ksm v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

KSM

A server manager following the KISS principle. (KISS Server Manager)

What is KISS


The KISS principle stands for "Keep It Simple, Stupid", and it emphasizes simplicity in design and implementation. The idea is that systems, software, or processes should be kept as simple as possible because simplicity leads to greater reliability, easier maintenance, and better usability.

In the context of software development, KISS encourages developers to:

  • Avoid unnecessary complexity.
  • Write clear and understandable code.
  • Use straightforward and minimalistic designs.
  • Focus on solving the problem with the simplest approach that works.

The underlying philosophy is that most problems can be solved more effectively with simpler solutions, and complex solutions are more prone to errors, harder to maintain, and can lead to unnecessary complications.

- ChatGPT


Philosophy

KSM focuses on simple server management that:

  • Keeps servers running
  • Can be easily configured from the server's project
  • Aims for a plug-and-play experience
  • Works with any server, regardless of its language or runtime

Installation

npm install -g @bytelab.studio/ksm

The installation requires root privileges because cronjob and other system-wide configuration files must be created.

Commands

ksm install

Adds a server to the serverlist when a config file isn't given, the command looks in the current directory for a ksm.json file. Optional the --start flag can be set to start the server as well.

ksm uninstall

Removes a server from the serverlist when a config file isn't given, the command looks in the current directory for a ksm.json file. Also, when the server is running it will be killed by ksm

ksm list

List all added servers.

Configuration

interface ServerConfig {
    cwd: string;
    ports: {
        http: number;
        https: number;
    }
    env: Record<string, string | boolean | number>;
    command: string[];
}

Sample configuration

An example configuration for a express.js app

{
    "cwd": ".",
    "ports": {
        "http": 2000,
        "https": 2001
    },
    "env": {
        "debug": false
    },
    "command": [
        "node",
        "./app/main.js"
    ]
}

The ports will be automatically added to the env as HTTPS_PORT and HTTP_PORT. The cwd property is relative to the config file. The proxy property is for the integrated ksm-proxy. But can be disabled at any time.

Template configuration

{
    "cwd": ".",
    "ports": {
        "http": 0,
        "https": 0
    },
    "env": {},
    "command": []
}

Base configuration

KSM comes with base configuration located at /etc/ksm/config.json

{
    "env": {
        "KSM_CONFIG": "/etc/ksm/config.json",
        "KSM_SERVERLIST": "/etc/ksm/serverlist"
    }
}

Which is for configure environment variables and extensions like ksm-proxy.

Contribution

Contributions are welcome! If you'd like to help improve KSM, feel free to submit a pull request or open an issue. Whether it's bug fixes, new features, or documentation improvements, all contributions are appreciated.

1.1.0

9 months ago

1.0.0

9 months ago