Skip to content
sany2k8Public

About

A self-hosted, browser based platform for hands-on DevOps/developer practice.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Suncloud

A self-hosted, KodeKloud-style platform for hands-on DevOps, Software Engineering, and Database Administration practice. Each lab pairs an interactive task panel with a real, isolated terminal running inside a disposable Docker container. The platform validates task completion server-side by inspecting the container state in real time β€” with zero cloud accounts, zero credentials, and zero local tool setup for the learner.


πŸ“Έ Screenshots

Frontend β€” Learning Platform UI (http://localhost:5181)

Frontend – SunCloud Login Page

Backend β€” FastAPI Interactive Docs (http://127.0.0.1:8400/docs)

Backend – Suncloud API Swagger UI


πŸš€ Live Topics & Chapters Catalog

Suncloud features 121 live, interactive lab exercises spanning 10 fully implemented courses, plus 2 upcoming roadmap courses.

Status Topic Icon Ready / Total Chapters Key Topics Covered
Active Python 🐍 21 / 21 Variables, Lists, Dicts, Functions, OOP, Modules, Exceptions, Decorators, Regex, APIs, Concurrency, Testing, Type Hints
Active JavaScript 🟨 14 / 14 ES6+, Control Flow, Arrays, Objects, Closures, Async/Await, Node.js FS, Testing
Active Git πŸ”€ 11 / 11 Commits, Branching, Remotes, Conflict Resolution, Rebasing, Stashing, Undoing, Workflows
Active Docker 🐳 10 / 10 Container Lifecycle, Images, Volumes, Networking, Compose, Optimization, CI/CD
Active Linux 🐧 12 / 12 Command Line, File Ops, Users & Permissions, Text Processing, Processes, Package Mgmt, Systemd, Cron, Disk Storage
Active Ansible βš™οΈ 10 / 10 Inventories, Playbooks, Variables, Jinja2 Templates, Handlers, Roles, Vault, Error Handling
Active Bash & Shell Scripting 🐚 11 / 11 Scripts, Control Flow, Functions, Pipelines, Arrays, Grep, Sed, Awk, Cron, Error Handling
Active Networking Fundamentals 🌐 8 / 8 OSI Model, curl, HTTP Status Codes, DNS & dig, Ports & ss, Traceroute, tcpdump, Connectivity Troubleshooting
Active SQL & Database Administration πŸ—„οΈ 13 / 13 Queries, Joins, Aggregations, CTEs, Window Functions, Schema Design, Indexes, DCL Permissions, Views, Backup & Restore
Active Redis & Caching πŸ”΄ 11 / 11 Data Structures, Lists/Hashes/Sets, TTLs, Pub/Sub, Cache-Aside Patterns, Eviction Policies, RDB/AOF Persistence, Transactions
Roadmap Kubernetes ☸️ 0 / 10 Pods, Deployments, Services, ConfigMaps, Secrets, Volumes, Resource Limits, Helm, Workload Troubleshooting
Roadmap Terraform πŸ—οΈ 0 / 10 HCL Syntax, Providers, State Management, Modules, Provisioners, Workspaces, Local AWS with Floci

Total Available Labs: 121 / 141 Live


πŸ”’ Security & Isolation Architecture

The learner has a full, real interactive shell inside a live container. Suncloud enforces enterprise-grade security and isolation to ensure sandbox containers cannot harm the host machine, escalate privileges, or consume unbounded system resources:

  • Unprivileged Learner Execution (UID 1000): All interactive shell sessions and automated checks run under an unprivileged learner user (uid 1000). System paths (/etc, /usr, /var) are read-only to the learner.
  • Linux Capability Dropping & Privilege Escalation Blocks:
    • cap_drop=["ALL"] β€” Removes all Linux capabilities from the container.
    • security_opt=["no-new-privileges:true"] β€” Strictly forbids gaining new privileges (blocking setuid/sudo escalation attempts).
  • Network Isolation (network_mode="none"):
    • Sandbox containers run with zero network egress/ingress.
    • All exercises operate 100% offline with pre-seeded dependencies, mock servers, or local Unix sockets.
  • Resource Caps:
    • mem_limit="512m" β€” Prevents memory leaks and host RAM exhaustion.
    • nano_cpus=1000000000 (1.0 CPU) β€” Limits CPU utilization.
    • pids_limit=256 β€” Protects against fork bombs.
  • Single Active Session Protection & Auto-Teardown:
    • Suncloud enforces single-session concurrency per environment.
    • When starting a new lab, previous active sessions and their Docker containers are automatically stopped and purged (docker rm -f).
    • Thread-safe provisioning locks prevent duplicate container spin-up races.
  • Background Reaper Service:
    • A background worker scans for expired sessions (SESSION_TTL_MINUTES = 45) and orphaned containers carrying the ilab.session Docker label, destroying them automatically.
  • Task Reset Functionality:
    • Every exercise includes a Reset mechanism that cleans the working directory and restores initial starter files.

πŸ—οΈ Architecture

flowchart TD
    subgraph Browser ["Browser Client (:5181)"]
        direction TB
        Catalog["Catalog View & Search"]
        subgraph LabView ["Lab View"]
            QuestionPanel["Task Panel<br/>(Markdown, Progress, Check/Skip)"]
            TerminalUI["xterm.js Terminal"]
            TimerUI["Session Timer"]
        end
    end

    subgraph Backend ["Backend API - FastAPI (:8400)"]
        direction TB
        ContentSvc["Content Service<br/>(loads YAML labs)"]
        SessionSvc["Sessions & Docker Manager<br/>(single session & auto-teardown)"]
        TerminalSvc["Terminal Service<br/>(WS /api/sessions/{id}/terminal)"]
        ValidatorSvc["Validator Service"]
        ReaperSvc["Background Reaper<br/>(kills expired/orphan containers)"]
        DB[(SQLite DB)]
    end

    subgraph DockerHost ["Docker Host"]
        DockerSocket["/var/run/docker.sock"]
        subgraph Sandbox ["Disposable Sandbox Container"]
            ContainerInstance["Isolated Container<br/>(network_mode=none, cap_drop=ALL)"]
        end
    end

    %% Flow connections
    Catalog -- "GET /api/topics" --> ContentSvc
    QuestionPanel -- "POST /api/sessions" --> SessionSvc
    SessionSvc -- "Create Container" --> DockerSocket
    DockerSocket --> ContainerInstance

    TerminalUI -- "WS /api/sessions/{id}/terminal" --> TerminalSvc
    TerminalSvc -- "docker exec PTY (raw socket)" --> DockerSocket

    QuestionPanel -- "POST /api/sessions/{id}/questions/{qid}/check" --> ValidatorSvc
    ValidatorSvc -- "docker exec check" --> DockerSocket

    TimerUI -- "DELETE /api/sessions/{id}" --> SessionSvc
    ReaperSvc -- "Auto-cleanup" --> SessionSvc
    SessionSvc -- "docker rm -f" --> DockerSocket

    SessionSvc <--> DB
    ValidatorSvc <--> DB
Loading

Both the interactive terminal and validation check engine communicate directly via docker exec through the local Docker socket, bypassing container networking entirely.


πŸ“‚ Repository Layout

β”œβ”€β”€ backend/                  # FastAPI Application
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ routers/          # API endpoints (topics, labs, sessions, terminal WS, validation)
β”‚   β”‚   β”œβ”€β”€ services/         # docker_manager, content, topics, validator, reaper, session_service
β”‚   β”‚   └── config.py         # System configuration and resource limits
β”œβ”€β”€ content/                  # Lab authoring surface (121 lab.yaml definitions)
β”‚   β”œβ”€β”€ python-*/
β”‚   β”œβ”€β”€ js-*/
β”‚   β”œβ”€β”€ git-*/
β”‚   β”œβ”€β”€ docker-*/
β”‚   β”œβ”€β”€ linux-*/
β”‚   β”œβ”€β”€ ansible-*/
β”‚   β”œβ”€β”€ bash-*/
β”‚   β”œβ”€β”€ net-*/
β”‚   β”œβ”€β”€ sql-*/
β”‚   └── redis-*/
β”œβ”€β”€ topics/                   # Catalog structure manifest
β”‚   β”œβ”€β”€ topics.yaml           # Two-level catalog mapping (topics -> chapters -> lab_id)
β”‚   └── *-lab-chapters.md     # Chapter roadmaps per topic
β”œβ”€β”€ sandbox/                  # Dedicated Dockerfiles per topic
β”‚   β”œβ”€β”€ python/
β”‚   β”œβ”€β”€ javascript/
β”‚   β”œβ”€β”€ git/
β”‚   β”œβ”€β”€ docker/
β”‚   β”œβ”€β”€ linux/
β”‚   β”œβ”€β”€ ansible/
β”‚   β”œβ”€β”€ redis/
β”‚   └── sql/
└── frontend/                 # Vite + React + TypeScript + Tailwind CSS UI
    └── src/
        β”œβ”€β”€ pages/            # Topics (Homepage), Topic (Chapters), Lab (Workspace)
        └── components/       # Terminal (xterm.js), QuestionPanel, Header, Footer

πŸ› οΈ Quick Start

Prerequisites

  • Docker Engine / Docker Desktop running locally.
  • Python 3.11+
  • Node.js 18+

1. Build Sandbox Container Images

Build the base Docker images for your target lab topics:

docker build -t ilab-sandbox-python:latest sandbox/python
docker build -t ilab-sandbox-linux:latest sandbox/linux
docker build -t ilab-sandbox-git:latest sandbox/git
docker build -t ilab-sandbox-ansible:latest sandbox/ansible
docker build -t ilab-sandbox-redis:latest sandbox/redis
docker build -t ilab-sandbox-sql:latest sandbox/sql
docker build -t ilab-sandbox-js:latest sandbox/javascript
docker build -t ilab-sandbox-docker:latest sandbox/docker

2. Start Backend API (FastAPI)

cd backend
uv sync
uvicorn app.main:app --port 8400

3. Start Frontend UI (Vite)

cd frontend
npm install
npm run dev   # Opens at http://localhost:5181

πŸ“ Authoring a Lab

Adding a lab requires only creating a YAML file under content/<lab-id>/lab.yaml:

id: net-curl
title: "curl β€” HTTP from the Command Line"
topic: networking
image: "ilab-sandbox-linux:latest"
workdir: /home/learner/lab
est_minutes: 20
description: >
  Master HTTP requests from the terminal β€” GET/POST with curl, viewing response headers,
  sending JSON payloads, and saving output to files.

questions:
  - id: q1
    type: sandbox
    instructions: |
      ## 1 Β· Basic GET Request
      Make a GET request to `http://localhost:9000` and save output to `response.html`.
    validate:
      cmd: 'test -f response.html && test -s response.html'
      success: "response.html contains HTTP response."
      failure: "Run curl http://localhost:9000 > response.html."

  - id: q2
    type: multiple_choice
    instructions: |
      Which flag in `curl` fetches HTTP response headers only?
    choices:
      - "-v"
      - "-I"
      - "-s"
      - "-d"
    answer: 1

Hot-reload lab definitions at any time with POST /api/labs/reload.


πŸ—ΊοΈ Future Roadmap

  • Kubernetes Interactive Lab: Containerized k3d/kind cluster in sandbox with Pods, Services, Deployments, and Helm tasks.
  • Terraform & Cloud Emulation: Infrastructure as Code labs against Floci (a lightweight local AWS emulator).
  • Monaco Code Editor Integration: Side-by-side IDE code editor alongside xterm.js terminal.
  • Progress Synchronization: Authenticated user accounts and cloud progress synchronization.

About

A self-hosted, browser based platform for hands-on DevOps/developer practice.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages