Rewrite from Go + vanilla JS to Python (FastAPI) + React (TypeScript)

- Backend: Python 3.12 with FastAPI, SQLAlchemy, boto3
- Frontend: React 18 with TypeScript, Vite build tooling
- Updated Dockerfile for multi-stage Node + Python build
- Updated CI pipeline for Python backend
- Removed old Go code (cmd/, internal/, go.mod, go.sum)
- Updated README with new tech stack documentation
This commit is contained in:
Mondo Diaz
2025-12-05 17:16:43 -06:00
parent 343f7bfc59
commit 2261bfc830
45 changed files with 2104 additions and 3359 deletions

109
README.md
View File

@@ -4,6 +4,14 @@
Orchard is a centralized binary artifact storage system that provides content-addressable storage with automatic deduplication, flexible access control, and multi-format package support. Like an orchard that cultivates and distributes fruit, Orchard nurtures and distributes the products of software builds.
## Tech Stack
- **Backend**: Python 3.12 + FastAPI
- **Frontend**: React 18 + TypeScript + Vite
- **Database**: PostgreSQL 16
- **Object Storage**: MinIO (S3-compatible)
- **Cache**: Redis (for future use)
## Features
### Currently Implemented
@@ -17,8 +25,9 @@ Orchard is a centralized binary artifact storage system that provides content-ad
- **S3-Compatible Backend** - Uses MinIO (or any S3-compatible storage) for artifact storage
- **PostgreSQL Metadata** - Relational database for metadata, access control, and audit trails
- **REST API** - Full HTTP API for all operations
- **Web UI** - Browser-based interface for managing artifacts
- **Web UI** - React-based interface for managing artifacts
- **Docker Compose Setup** - Easy local development environment
- **Helm Chart** - Kubernetes deployment with PostgreSQL, MinIO, and Redis subcharts
### API Endpoints
@@ -81,8 +90,29 @@ docker-compose down
- **Web UI**: http://localhost:8080
- **API**: http://localhost:8080/api/v1
- **API Docs**: http://localhost:8080/docs
- **MinIO Console**: http://localhost:9001 (user: `minioadmin`, pass: `minioadmin`)
## Development
### Backend (FastAPI)
```bash
cd backend
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8080
```
### Frontend (React)
```bash
cd frontend
npm install
npm run dev
```
The frontend dev server proxies API requests to `localhost:8080`.
## Usage Examples
### Create a Grove
@@ -151,37 +181,41 @@ curl http://localhost:8080/api/v1/fruit/a3f5d8e12b4c67890abcdef1234567890abcdef1
```
orchard/
├── cmd/
── orchard-server/
── main.go # Application entrypoint
├── internal/
│ ├── api/
│ │ ├── handlers.go # HTTP request handlers
│ │ ├── router.go # Route definitions
│ │ ── static/ # Web UI assets
│ │ ├── index.html
│ │ ├── style.css
│ └── app.js
│ ├── config/
│ └── config.go # Configuration management
│ ├── models/
│ │ ── models.go # Data structures
└── storage/
├── database.go # PostgreSQL operations
── s3.go # S3 storage operations
├── backend/
── app/
── __init__.py
│ │ ├── config.py # Pydantic settings
│ ├── database.py # SQLAlchemy setup
│ │ ├── main.py # FastAPI application
│ │ ├── models.py # SQLAlchemy models
│ │ ── routes.py # API endpoints
│ │ ├── schemas.py # Pydantic schemas
│ │ └── storage.py # S3 storage layer
└── requirements.txt
├── frontend/
├── src/
│ ├── components/ # React components
│ │ ── pages/ # Page components
│ ├── api.ts # API client
├── types.ts # TypeScript types
── App.tsx
│ │ └── main.tsx
│ ├── index.html
│ ├── package.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── helm/
│ └── orchard/ # Helm chart
├── migrations/
│ └── 001_initial.sql # Database schema
├── Dockerfile # Multi-stage Docker build
├── docker-compose.yml # Local development stack
── config.yaml # Default configuration
├── Makefile # Build automation
├── go.mod # Go module definition
└── go.sum # Dependency checksums
│ └── 001_initial.sql # Database schema
├── Dockerfile # Multi-stage build (Node + Python)
├── docker-compose.yml # Local development stack
── .gitlab-ci.yml # CI/CD pipeline
```
## Configuration
Configuration can be provided via `config.yaml` or environment variables prefixed with `ORCHARD_`:
Configuration is provided via environment variables prefixed with `ORCHARD_`:
| Environment Variable | Description | Default |
|---------------------|-------------|---------|
@@ -198,6 +232,27 @@ Configuration can be provided via `config.yaml` or environment variables prefixe
| `ORCHARD_S3_ACCESS_KEY_ID` | S3 access key | - |
| `ORCHARD_S3_SECRET_ACCESS_KEY` | S3 secret key | - |
## Kubernetes Deployment
### Using Helm
```bash
# Add Bitnami repo for dependencies
helm repo add bitnami https://charts.bitnami.com/bitnami
# Update dependencies
cd helm/orchard
helm dependency update
# Install
helm install orchard ./helm/orchard -n orchard --create-namespace
# Install with custom values
helm install orchard ./helm/orchard -f my-values.yaml
```
See `helm/orchard/values.yaml` for all configuration options.
## Database Schema
### Core Tables