/django-vps-manager

A Django REST API service for managing Virtual Private Servers (VPS) with resource allocation (CPU up to 16 cores, RAM up to 32GB, HDD up to 1TB) and status control (start/stop/block). Features OpenAPI documentation, rate limiting, and Docker deployment.

Primary LanguagePythonMIT LicenseMIT

VPS Manager API

English | Русский

A Django REST API service for managing Virtual Private Servers (VPS), allowing users to create, monitor, and control virtual servers.

Features

  • Create and manage virtual servers with configurable resources (CPU, RAM, HDD)
  • Status management (start/stop/block servers)
  • Resource usage tracking and limits
  • API rate limiting and throttling
  • OpenAPI documentation
  • Containerized deployment with Docker

Requirements

  • Python 3.12+
  • Docker and Docker Compose
  • PostgreSQL 16

Quick Start

  1. Clone the repository:
git clone https://github.com/yourusername/django-vps-manager.git
cd django-vps-manager
  1. Create and configure environment file:
cp .env.example .env
  1. Start the services:
docker compose up --build -d
  1. Access the API:

  2. Demo User Access:

    • Username: demo
    • Password: demo123
    • The demo user has superuser privileges for testing purposes

API Endpoints

  • POST /api/v1/servers/ - Create new VPS
  • GET /api/v1/servers/ - List all servers (with filtering)
  • GET /api/v1/servers/{uid}/ - Get server details
  • POST /api/v1/servers/{uid}/change_status/ - Change server status

Testing

Run tests with:

docker compose exec server python manage.py test vps

License

This project is licensed under the MIT License - see the LICENSE file for details.