# Calypso Appliance Services Documentation

This document provides an overview of all services that form the Calypso backup appliance.

## Core Calypso Services

### calypso-api.service
**Status**: Running  
**Description**: AtlasOS Calypso API Service (Development)  
**Purpose**: Main REST API backend for the Calypso appliance, handles all business logic and database operations.  
**Binary**: `/development/calypso/backend/bin/calypso-api`  
**Config**: `/development/calypso/backend/config.yaml.example`

### calypso-frontend.service
**Status**: Running  
**Description**: Calypso Frontend Development Server  
**Purpose**: Web UI for managing backups, storage, and monitoring the appliance.  
**Port**: 3000  
**Technology**: React + Vite (development mode)

## Backup Services (Bacula)

### bacula-director.service
**Status**: Running  
**Description**: Bacula Director Daemon  
**Purpose**: Central management daemon that orchestrates all backup, restore, and verify operations.  
**Config**: `/etc/bacula/bacula-dir.conf`  
**Docs**: `man:bacula-dir(8)`

### bacula-sd.service
**Status**: Running  
**Description**: Bacula Storage Daemon  
**Purpose**: Manages physical backup storage devices (disks, tapes, virtual tape libraries).  
**Config**: `/etc/bacula/bacula-sd.conf`

### bacula-fd.service
**Status**: Running  
**Description**: Bacula File Daemon  
**Purpose**: Runs on systems being backed up, manages file access and metadata.  
**Config**: `/etc/bacula/bacula-fd.conf`

## Storage/iSCSI Services (SCST)

### scst.service
**Status**: Active (exited)  
**Description**: SCST - A Generic SCSI Target Subsystem  
**Purpose**: Kernel-level SCSI target framework providing high-performance storage exports.  
**Type**: One-shot service that loads SCST kernel modules

### iscsi-scstd.service
**Status**: Running  
**Description**: iSCSI SCST Target Daemon  
**Purpose**: Provides iSCSI protocol support for SCST, allowing network block storage exports.  
**Port**: 3260 (standard iSCSI port)  
**Configured Targets**:
- `iqn.2025-12.id.atlas:lun01` (enabled)

### iscsid.service
**Status**: Inactive  
**Description**: iSCSI initiator daemon  
**Purpose**: Client-side iSCSI service (not currently in use)

### open-iscsi.service
**Status**: Inactive  
**Description**: Login to default iSCSI targets  
**Purpose**: Automatic iSCSI target login (not currently in use)

## Virtual Tape Library

### mhvtl-load-modules.service
**Status**: Active (exited)  
**Description**: Load mhvtl modules  
**Purpose**: Loads mhVTL (virtual tape library) kernel modules for tape emulation.  
**Type**: One-shot service that runs at boot  
**Docs**: `man:vtltape(1)`, `man:vtllibrary(1)`

## Database

### postgresql.service
**Status**: Active (exited)  
**Description**: PostgreSQL RDBMS  
**Purpose**: Parent service for PostgreSQL database management

### postgresql@16-main.service
**Status**: Running  
**Description**: PostgreSQL Cluster 16-main  
**Purpose**: Main database for Calypso API, stores configuration, jobs, and metadata.  
**Version**: PostgreSQL 16

## Service Management

### Check All Services Status
```bash
systemctl status calypso-api calypso-frontend bacula-director bacula-sd bacula-fd scst iscsi-scstd mhvtl-load-modules postgresql
```

### Rebuild and Restart Core Services
```bash
/development/calypso/scripts/rebuild-and-restart.sh
```

### Restart Individual Services
```bash
systemctl restart calypso-api.service
systemctl restart calypso-frontend.service
systemctl restart bacula-director.service
```

## Service Dependencies

```
PostgreSQL
    └── Calypso API
            └── Calypso Frontend

SCST
    └── iSCSI SCST Target Daemon

mhVTL
    └── Bacula Storage Daemon
            └── Bacula Director
                    └── Bacula File Daemon
```

## Total Service Count
**11 services** forming the complete Calypso backup appliance stack.
