Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
448d0af
feat: implement OAuth authentication system with hybrid auth modes
stmh Aug 16, 2025
cdff24e
feat(auth)!: implement comprehensive OAuth authentication system
stmh Aug 17, 2025
98c6fe8
fix: resolve clippy warnings and format code
stmh Aug 17, 2025
9872785
fix(frontend): resolve TypeScript lint errors and improve type safety
stmh Aug 17, 2025
11a1db6
Merge branch 'main' into feat/oauth-authentication-system
stmh Aug 17, 2025
f8fe3d0
fix(frontend): fix task activity indicator animation
stmh Aug 17, 2025
aec48b4
chore: Coding style fixes
stmh Aug 17, 2025
5fa0800
feat(frontend): improve OAuth login flow and authentication validation
stmh Aug 17, 2025
4576f51
chore: Remove unnecessary files
stmh Aug 17, 2025
33d20c1
docs: add OAuth authentication documentation and update configuration
stmh Aug 17, 2025
2d30292
feat(docker): optimize healthcheck configuration for faster startup
stmh Aug 17, 2025
14730de
feat: implement OAuth session exchange for secure frontend authentica…
stmh Aug 17, 2025
d4ec80e
feat: refactor OAuth to OIDC-compliant provider-agnostic system with …
stmh Aug 17, 2025
5d46b48
feat: implement complete OAuth device flow for scottyctl
stmh Aug 17, 2025
01a898b
chore: fix ESLint and code formatting issues
stmh Aug 17, 2025
3b161ab
Merge branch 'main' into feat/oauth-authentication-system
stmh Aug 17, 2025
0e65197
docs: fix CLI command format throughout documentation
stmh Aug 18, 2025
0a357a6
feat: add comprehensive authentication testing for scotty backend
stmh Aug 18, 2025
d0ed3be
fix: remove unnecessary assert!(true) statements flagged by clippy
stmh Aug 18, 2025
066d2a8
feat: implement version compatibility check between scottyctl and server
stmh Aug 18, 2025
e565210
refactor: update auth commands to use UI helper and reduce emoji usage
stmh Aug 18, 2025
9fb12b3
feat: consolidate shared functionality and improve OAuth error handling
stmh Aug 18, 2025
8c8990a
feat: unify OAuth error handling system and fix device flow polling
stmh Aug 18, 2025
0329ae7
Merge branch 'main' into feat/oauth-authentication-system
stmh Aug 24, 2025
01922a5
feat: implement comprehensive RBAC authorization system
stmh Aug 24, 2025
f265a23
fix: resolve RBAC authorization middleware issues
stmh Aug 24, 2025
a595a63
docs: update authorization documentation for RBAC changes
stmh Aug 24, 2025
4c31504
fix: scottyctl bearer token authentication with RBAC
stmh Aug 24, 2025
1b73a9f
refactor: make RBAC configuration mandatory and improve logging
stmh Aug 24, 2025
cbb58f6
chore: Codestyle
stmh Aug 24, 2025
3fad1fc
chore: Codestyle and fix tests
stmh Aug 24, 2025
7e23c56
Merge pull request #415 from factorial-io/feat/oauth-authentication-s…
stmh Aug 24, 2025
f38392d
Merge branch 'next' into feat/rbac
stmh Aug 31, 2025
f5d0405
ci: trigger ci
stmh Aug 25, 2025
88914eb
Update docker-cleanup.yml
stmh Aug 25, 2025
a3c5816
chore(deps): update dependency typescript-eslint to v8.41.0
renovate[bot] Aug 25, 2025
179f66e
chore(deps): update rust crate clap to v4.5.46 (#439)
renovate[bot] Aug 26, 2025
44a1d71
chore(deps): update npm dependencies auto-merge (patch) (#438)
renovate[bot] Aug 27, 2025
a734b11
chore(deps): update rust crate config to v0.15.15
renovate[bot] Aug 31, 2025
c4f4d08
chore(deps): update rust crate tracing-subscriber to v0.3.20 [security]
renovate[bot] Aug 31, 2025
c068519
fix(deps): update rust crate tempfile to v3.21.0
renovate[bot] Aug 19, 2025
c548bbb
chore: Update dependencies
stmh Aug 31, 2025
4739ba9
Merge branch 'next' into feat/rbac
stmh Aug 31, 2025
9a19e46
refactor: Replace authorization groups terminology with scopes
stmh Aug 31, 2025
5eaa8a8
docs: Update authorization system terminology from groups to scopes
stmh Aug 31, 2025
01aab56
feat: Add comprehensive admin API for authorization management
stmh Aug 31, 2025
1fa7aa3
Update documentation and fix tests for new bearer token system
stmh Aug 31, 2025
306830a
fix(auth): centralize user ID logic and fix bearer token authorization
stmh Aug 31, 2025
3480151
feat: implement shared admin types and enhance authentication logging
stmh Aug 31, 2025
1629d87
refactor: remove emojis from admin command success messages
stmh Aug 31, 2025
da4dd95
fix: resolve clap panic in admin permissions test command
stmh Aug 31, 2025
149bd8e
feat: use email addresses as user identifiers for OAuth users
stmh Aug 31, 2025
36921a3
feat: enhance OIDC user info capture and logging
stmh Aug 31, 2025
20b09e8
feat: implement OIDC profile picture support in user avatars
stmh Aug 31, 2025
6c93781
feat: implement comprehensive permission-based UI access control
stmh Aug 31, 2025
3cec366
refactor: streamline admin CLI command error handling
stmh Aug 31, 2025
e10373a
fix: update OIDC test data and apply code formatting
stmh Aug 31, 2025
c63f96d
feat: add permission-based visibility for custom actions
stmh Aug 31, 2025
342c2f6
fix: resolve permission-based action button visibility race condition
stmh Aug 31, 2025
cf84e49
chore: Code style
stmh Aug 31, 2025
b8d71ed
fix: resolve clippy warnings and improve code quality
stmh Aug 31, 2025
5717477
fix: improve authorization security and robustness
stmh Aug 31, 2025
f641a40
chore: Code style fixes
stmh Aug 31, 2025
ad30988
fix: resolve frontend linting errors
stmh Aug 31, 2025
cbc1740
docs: enhance bearer token security documentation
stmh Aug 31, 2025
74399c2
fix: align Casbin model matcher between test and production environments
stmh Aug 31, 2025
d368f3d
Merge pull request #436 from factorial-io/feat/rbac
stmh Sep 3, 2025
91505b5
chore: Remove unused file
stmh Sep 3, 2025
77648aa
fix: improve bearer token authentication and error logging
stmh Sep 3, 2025
8557bf6
refactor: remove unused get_user_by_token method from AuthorizationSe…
stmh Sep 3, 2025
f73e63e
Revert "refactor: remove unused get_user_by_token method from Authori…
stmh Sep 3, 2025
0fe385d
fix: Fix code warning
stmh Sep 3, 2025
bc792d8
Merge branch 'main' into next
stmh Sep 17, 2025
74bc69e
Merge branch 'main' into next
stmh Sep 20, 2025
5db0e88
refactor: update authorization config to use serde_norway
stmh Sep 20, 2025
d64016e
Merge branch 'main' into next
stmh Sep 24, 2025
e57a9ec
fix: normalize URLs to prevent double slashes in API calls (#470)
stmh Sep 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 176 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Scotty is a Rust-based Micro-PaaS (Platform as a Service) that provides an API to manage Docker Compose-based applications. It consists of three main components:

- **scotty**: HTTP server providing REST API and web UI for managing applications
- **scottyctl**: CLI application for interacting with the Scotty server
- **scotty-core**: Core library containing shared data structures and settings

## Architecture

Scotty manages applications by:
1. Scanning a configurable apps directory for folders containing `docker-compose.yml` files
2. Reading optional `.scotty.yml` configuration files for app-specific settings
3. Generating `docker-compose.override.yml` files with load balancer configurations (Traefik or HAProxy)
4. Managing app lifecycle (create, start, stop, destroy) with TTL-based auto-cleanup
5. Supporting app blueprints for common deployment patterns

### Authentication Modes

Scotty supports three authentication modes (configured via `auth_mode`):
- **Development**: No authentication required, uses fixed dev user
- **OAuth**: Authentication via oauth2-proxy with GitLab OIDC integration
- **Bearer**: Traditional token-based authentication

Authentication is handled by the `basic_auth.rs` middleware which extracts user information based on the configured mode.

## Development Commands

### Building and Running

```bash
# Build all workspace members
cargo build

# Run the scotty server
cargo run --bin scotty

# Run the scottyctl CLI
cargo run --bin scottyctl -- help

# Run with specific configuration
SCOTTY__API__AUTH_MODE=dev cargo run --bin scotty
```

### Frontend Development

The frontend is a SvelteKit application with TypeScript:

```bash
cd frontend

# Install dependencies (use bun instead of npm)
bun install

# Run development server
bun run dev

# Build for production
bun run build

# Lint and format
bun run lint
bun run format
```

### Testing and Quality

```bash
# Run tests for all workspace members
cargo test

# Run tests for specific crate
cargo test -p scotty-core

# Check formatting
cargo fmt --check

# Run clippy linting
cargo clippy --all-targets --all-features
```

### Release Management

```bash
# Update changelog using git-cliff
git cliff > CHANGELOG.md

# Create new release (example for alpha)
cargo release --no-publish alpha -x --tag-prefix ""
```

## Configuration Structure

### Main Configuration Files
- `config/default.yaml`: Base configuration with all settings
- `config/local.yaml`: Local overrides for development
- `config/blueprints/`: App blueprint definitions (drupal-lagoon.yaml, nginx-lagoon.yaml)

### OAuth Development Setup
The `examples/oauth2-proxy/` directory contains a complete OAuth development environment:

```bash
cd examples/oauth2-proxy

# Start in development mode (no auth)
./start-dev.sh dev

# Start with OAuth (requires GitLab app configuration)
op run --env-file="./.env.1password" -- ./start-dev.sh oauth --build

# Start in bearer token mode
./start-dev.sh bearer
```

### Key Configuration Options

- `auth_mode`: "dev", "oauth", or "bearer"
- `bind_address`: Server bind address (default: "0.0.0.0:21342")
- `apps.root_folder`: Directory to scan for applications
- `load_balancer_type`: "Traefik" or "HaproxyConfig"
- `traefik.network`: Docker network for Traefik integration
- `docker.registries`: Private Docker registry configurations

## App Management

### App Types
- **Owned**: Fully managed by Scotty, can be destroyed
- **Supported**: Can be managed but not destroyed
- **Unsupported**: Read-only, shown in UI but not manageable

### App Structure
```
apps/
├── my-app/
│ ├── docker-compose.yml # Required
│ ├── .scotty.yml # Optional app settings
│ ├── docker-compose.override.yml # Generated by Scotty
│ └── ... (other app files)
```

### Blueprints
Blueprints provide common deployment patterns and are referenced during app creation. They define lifecycle hooks that execute at specific events (create, run, destroy).

## API and CLI Integration

The API is self-documenting via OpenAPI/Swagger at `/rapidoc` endpoint. The CLI (`scottyctl`) communicates with the server via this REST API using bearer token authentication.

Key environment variables for CLI:
- `SCOTTY_SERVER`: Server URL
- `SCOTTY_ACCESS_TOKEN`: Authentication token

## Load Balancer Integration

Scotty generates appropriate configurations for:

### Traefik (Preferred)
- Uses Docker labels for service discovery
- Supports custom middlewares, basic auth, robots.txt prevention
- Automatic SSL via Let's Encrypt integration

### HAProxy-Config (Legacy)
- Uses environment variables for configuration
- Limited feature set compared to Traefik

## Development Notes

- Use workspace-level Cargo.toml for shared dependencies
- Frontend uses Bun instead of npm for package management
- Conventional commits are enforced via git-cliff
- Pre-push hooks via cargo-husky perform quality checks
- Container apps directory must have identical paths on host and container for bind mounts
- Use conventional commit messages
Loading