Files
sloppyware/docs/installation.md
2026-11-22 02:02:18 +01:00

184 lines
4.1 KiB
Markdown

# Chronos Installation Guide
This document provides instructions for installing Chronos on supported Linux distributions.
## System Requirements
- Linux kernel 5.0 or newer
- Rust 1.70 or newer (stable toolchain)
- PostgreSQL 13 or newer
- Redis 6 or newer (optional, for caching)
- Node.js 18 or newer (for frontend build)
## Supported Distributions
Chronos is officially supported on:
- Debian 12 (Bookworm) and newer
- Ubuntu 22.04 LTS (Jammy) and newer
- Arch Linux
Other distributions may work but are not officially tested.
## Prerequisites
Before installing Chronos, ensure the following packages are installed:
### Debian/Ubuntu:
```bash
sudo apt update
sudo apt install -y build-essential postgresql redis-server nodejs npm
```
### Arch Linux:
```bash
sudo pacman -Syu --needed base-devel postgresql redis nodejs npm
```
## Installation Steps
1. **Clone the repository:**
```bash
git clone https://github.com/chronos/chronos.git
cd chronos
```
2. **Install Rust (if not already installed):**
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env
```
3. **Set up PostgreSQL database:**
```bash
sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo -u postgres createuser chronos
sudo -u postgres createdb chronos
```
4. **Create Chronos system users:**
```bash
sudo useradd -r -s /bin/false chronos-api
sudo useradd -r -s /bin/false chronos-scheduler
sudo useradd -r -s /bin/false chronos-worker
```
5. **Build the application:**
```bash
cargo build --release
```
6. **Install systemd service files:**
```bash
sudo cp systemd/*.service /etc/systemd/system/
sudo systemctl daemon-reload
```
7. **Configure the application:**
```bash
cp config/chronos.example.toml config/chronos.toml
# Edit config/chronos.toml with your settings
```
8. **Run database migrations:**
```bash
cargo run --bin chronos-cli -- migrate
```
9. **Start services:**
```bash
sudo systemctl enable chronos-api.service
sudo systemctl enable chronos-scheduler.service
sudo systemctl enable chronos-worker.service
sudo systemctl start chronos-api.service
sudo systemctl start chronos-scheduler.service
sudo systemctl start chronos-worker.service
```
## Configuration
Chronos uses a TOML configuration file. The example configuration is located at `config/chronos.example.toml`.
Key configuration sections:
- `[server]` - API server settings
- `[database]` - PostgreSQL connection details
- `[redis]` - Redis cache settings (optional)
- `[scheduler]` - Scheduling behavior
- `[workers]` - Worker pool configuration
- `[execution]` - Execution environment settings
## Verification
Check that services are running:
```bash
sudo systemctl status chronos-api.service
sudo systemctl status chronos-scheduler.service
sudo systemctl status chronos-worker.service
```
Verify the API is accessible:
```bash
curl http://localhost:8080/api/v1/health
```
## Updating
To update Chronos:
1. Pull latest changes:
```bash
git pull origin master
```
2. Rebuild:
```bash
cargo build --release
```
3. Run migrations if needed:
```bash
cargo run --bin chronos-cli -- migrate
```
4. Restart services:
```bash
sudo systemctl restart chronos-api.service
sudo systemctl restart chronos-scheduler.service
sudo systemctl restart chronos-worker.service
```
## Uninstalling
To uninstall Chronos:
1. Stop services:
```bash
sudo systemctl stop chronos-api.service
sudo systemctl stop chronos-scheduler.service
sudo systemctl stop chronos-worker.service
```
2. Disable services:
```bash
sudo systemctl disable chronos-api.service
sudo systemctl disable chronos-scheduler.service
sudo systemctl disable chronos-worker.service
```
3. Remove systemd service files:
```bash
sudo rm /etc/systemd/system/chronos-*.service
sudo systemctl daemon-reload
```
4. Remove system users:
```bash
sudo userdel chronos-api
sudo userdel chronos-scheduler
sudo userdel chronos-worker
```
5. Remove application files:
```bash
sudo rm -rf /path/to/chronos
```