Skip to content

BenjaLoggi/tron

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

59 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Tron - Platform as a Service

PaaS platform built on top of Kubernetes that simplifies application deployment and management.

πŸ“Έ Platform Overview

Dashboard

The dashboard provides a comprehensive overview of your platform, including statistics, component breakdown, and resource distribution across environments and clusters.

Dashboard

Templates

Manage reusable Kubernetes templates with Jinja2 templating. Create and configure templates for different component types (webapp, worker, cron) with customizable variables.

Templates

Applications

Organize and manage your applications. Each application can have multiple instances deployed across different environments with independent configurations.

Applications

Instance Details

View and manage components within an instance. Configure webapps, workers, and cron jobs with their specific settings, monitor their status, and access detailed information.

Instance

πŸš€ Quick Start

Prerequisites

  • Docker
  • Docker Compose

Running the Project

Run a single command to start the entire environment:

make start

This command will:

  • βœ… Start the FastAPI API (http://localhost:8000)
  • βœ… Start the React Portal (http://localhost:3000)
  • βœ… Start the PostgreSQL database
  • βœ… Start the Kubernetes cluster (K3s)
  • βœ… Run database migrations
  • βœ… Load initial templates
  • βœ… Create default administrator user
  • βœ… Configure API token
  • βœ… Create "local" environment
  • βœ… Configure local cluster

Access the Portal

After running make start, access:

URL: http://localhost:3000

Default credentials:

  • Email: admin@example.com
  • Password: admin

πŸ“š API Documentation

Interactive API documentation is available at:

πŸ› οΈ Useful Commands

Environment Management

# Start environment
make start

# Stop environment
make stop

# View logs
make logs

# Check service status
make status

# Rebuild images
make build

Database Migrations

# Create new migration
make api-migration

# Apply migrations
make api-migrate

Using kubectl with K3s

To interact with the local K3s cluster:

export KUBECONFIG=./volumes/kubeconfig/kubeconfig.yaml
kubectl get nodes

πŸ—οΈ Architecture

The project is organized as a monorepo containing:

  • API (/api): FastAPI backend with cluster, environment, application, and template management
  • Portal (/portal): React frontend for user interface
  • Scripts (/scripts): Automation and setup scripts

πŸ” Authentication

The platform supports two authentication methods:

  1. JWT (JSON Web Tokens): For web portal users
  2. API Tokens: For programmatic access via x-tron-token header

User Roles

  • Admin: Full access to all resources
  • User: Limited access (read-only on administrative resources)
  • Viewer: Read-only access

πŸ“– Main Features

  • Cluster Management: Add and manage Kubernetes clusters
  • Environments: Organize resources by environments (dev, staging, production)
  • Applications: Application deployment and management
  • Templates: Reusable templates for components
  • Users: User and permission management
  • API Tokens: Tokens for programmatic access

πŸ›οΈ Core Concepts

Applications, Instances, and Components

The platform organizes deployments using a hierarchical structure:

Application

An application represents a software project or service. It's the top-level entity that groups related deployments.

Example: my-api, frontend-app, data-processor

Instance

An instance is a deployment of an application in a specific environment. Each instance defines:

  • Image: Docker image to deploy (e.g., my-app:1.0.0)
  • Version: Version tag of the image
  • Environment: Where it's deployed (dev, staging, production)

Key points:

  • One application can have multiple instances (one per environment)
  • Each instance is unique per application + environment combination
  • Instances contain one or more components

Example:

  • Application: my-api
    • Instance 1: my-api in dev environment (image: my-api:1.0.0)
    • Instance 2: my-api in production environment (image: my-api:2.1.0)

Component

A component is a functional part of an instance that gets deployed to Kubernetes. Each component has:

  • Type: webapp, worker, or cron
  • Name: Unique identifier within the instance
  • Settings: Component-specific configuration (JSON)
  • Public URL: Optional public endpoint (for webapps)

Component Types:

  • webapp: Web application with HTTP/HTTPS access
  • worker: Background worker process
  • cron: Scheduled job (cron job)

Example:

  • Instance: my-api in production
    • Component 1: api-server (type: webapp, public URL: https://api.example.com)
    • Component 2: email-worker (type: worker)
    • Component 3: daily-report (type: cron, schedule: 0 0 * * *)

Hierarchy Summary

Application
  └── Instance (per environment)
      β”œβ”€β”€ Component (webapp)
      β”œβ”€β”€ Component (worker)
      └── Component (cron)

This structure allows you to:

  • Deploy the same application to multiple environments with different configurations
  • Manage different component types (web, workers, cron jobs) within the same instance
  • Scale and configure each component independently

πŸ”§ Development

Project Structure

tron/
β”œβ”€β”€ api/              # FastAPI backend
β”œβ”€β”€ portal/           # React frontend
β”œβ”€β”€ scripts/          # Automation scripts
β”œβ”€β”€ docker/           # Docker Compose configurations
└── volumes/          # Persistent volumes (kubeconfig, tokens)

Environment Variables

Main environment variables can be configured in the docker/docker-compose.yaml file or through .env files.


Built with ❀️ to simplify Kubernetes application management

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 48.7%
  • Python 45.8%
  • Jinja 1.6%
  • Shell 1.5%
  • HTML 0.8%
  • JavaScript 0.8%
  • Other 0.8%