134 lines
3.4 KiB
Markdown
134 lines
3.4 KiB
Markdown
|
|
# Server Manager Backend
|
|
|
|
This is the code for the back-end used in [ServerManager](https://games.acooldomain.co).
|
|
|
|
The server-manager is designed with modularity in mind and is built from a few major parts.
|
|
|
|
<!--toc:start-->
|
|
- [User Management](#user-management)
|
|
- [Servers Metadata](#servers-metadata)
|
|
- [Servers Authorization](#servers-authorization)
|
|
- [Instance Manager](#instance-manager)
|
|
|
|
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](https://git.acooldomain.co/server-manager/kubernetes-operator))
|
|
|
|
## Configuration Example
|
|
|
|
### Yaml Config format
|
|
|
|
```yaml
|
|
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"
|
|
```
|