Skip to content

KVMDash.back is the backend for the KVMDash web application, enabling the management of virtual machines (VMs) on Linux systems.

License

Notifications You must be signed in to change notification settings

KvmDash/KvmDash.back

Repository files navigation

KVMDash Backend

KvmDash Logo KVMDash is a web application that enables the management of Virtual Machines (VMs) on Linux systems. This is the backend of the application, based on Symfony 7 and API Platform.

System Requirements

  • PHP 8.2 or newer
  • Composer 2.x
  • MySQL/MariaDB, PostgreSQL or SQLite
  • OpenSSL for JWT key generation

Installation & Configuration

1. Clone Repository

git clone https://github.com/KvmDash/KvmDash.back.git kvmdash-backend
cd kvmdash-backend

2. Configure Environment Variables

# Create .env.local
cp .env .env.local

Edit .env.local and adjust the following settings:

# Development environment
APP_ENV=dev
APP_SECRET=YourSecretKey

# Choose one of the following database options and uncomment it:
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# or
# DATABASE_URL="mysql://user:password@127.0.0.1:3306/kvmdash"
# or
# DATABASE_URL="postgresql://user:password@127.0.0.1:5432/kvmdash?serverVersion=15&charset=utf8"

# JWT Configuration
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=YourJWTPassphrase

3. Install Dependencies

composer install

4. Generate JWT Keys

mkdir -p config/jwt
openssl genpkey -out config/jwt/private.pem -aes256 -algorithm rsa -pkeyopt rsa_keygen_bits:4096
openssl pkey -in config/jwt/private.pem -out config/jwt/public.pem -pubout

5. Setup Database

# Create database schema
php bin/console doctrine:schema:create

6. Create Admin User

php bin/console app:create-user "admin@example.com" "YourPassword"

7. Start Development Server

# With SSL on port 8000
symfony server:start --port=8000

# Alternatively with PHP's built-in server (not for production!)
php -S localhost:8000 -t public/

Important Note about Development Environment

The development server does not support WebSocket connections required for the SPICE remote console. The following features are only available in a production environment with Apache/Nginx:

  • SPICE remote console
  • WebSocket connections to VMs

For full functionality, especially the remote console feature, a production web server (Apache/Nginx) with WebSocket support is required.

API Documentation

The API documentation is available after starting the server at:

Production Deployment

For production use:

  1. Set APP_ENV=prod in .env.local
  2. Optimize the autoloader:
composer dump-autoload --optimize --no-dev --classmap-authoritative
  1. Clear the cache:
php bin/console cache:clear --env=prod

Note

This backend is required by the KVMDash Frontend (https://github.com/KvmDash/KvmDash.front). Make sure the CORS settings in .env.local are configured correctly.

About

KVMDash.back is the backend for the KVMDash web application, enabling the management of virtual machines (VMs) on Linux systems.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published