3 Commits

Author SHA1 Message Date
0a8f40b9cb Add MIT License file to the project
All checks were successful
Release Tag / release (push) Successful in 47s
- Introduced LICENSE file with the MIT License terms.
- Ensured compliance with open-source distribution and usage rights.
2026-01-02 14:55:53 -06:00
7440511740 Add GoReleaser configuration and update Makefile for streamlined builds
Some checks failed
Release Tag / release (push) Failing after 46s
- Introduced .goreleaser.yaml for automated release management.
- Updated Makefile to utilize GoReleaser for building the jiggablend binary.
- Added new workflows for release tagging and pull request checks in Gitea.
- Updated dependencies in go.mod and go.sum, including new packages for versioning.
- Enhanced .gitignore to exclude build artifacts in the dist directory.
2026-01-02 14:28:03 -06:00
c7c8762164 Update README.md to reflect significant changes in architecture and features. Replace DuckDB with SQLite for the database, enhance authentication options, and introduce a modern React-based web UI. Expand job management capabilities, including video encoding support and metadata extraction. Revise installation and configuration instructions, and clarify output formats and storage structure. Improve development guidelines for building and testing the application. 2026-01-02 14:03:03 -06:00
13 changed files with 384 additions and 95 deletions

View File

@@ -0,0 +1,24 @@
name: Release Tag
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@main
with:
go-version-file: 'go.mod'
- uses: goreleaser/goreleaser-action@master
with:
distribution: goreleaser
version: 'latest'
args: release
env:
GITEA_TOKEN: ${{secrets.RELEASE_TOKEN}}

View File

@@ -0,0 +1,15 @@
name: PR Check
on:
- pull_request
jobs:
check-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version-file: 'go.mod'
- run: go mod tidy
- run: go build ./...
- run: go test -race -v -shuffle=on ./...

1
.gitignore vendored
View File

@@ -65,6 +65,7 @@ lerna-debug.log*
*.o
*.a
*.so
/dist/
# Temporary files
*.tmp

48
.goreleaser.yaml Normal file
View File

@@ -0,0 +1,48 @@
version: 2
before:
hooks:
- go mod tidy -v
- sh -c "cd web && npm install && npm run build"
builds:
- id: default
main: ./cmd/jiggablend
binary: jiggablend
ldflags:
- -X jiggablend/version.Version={{.Version}}
- -X jiggablend/version.Date={{.Date}}
env:
- CGO_ENABLED=1
goos:
- linux
goarch:
- amd64
checksum:
name_template: "checksums.txt"
archives:
- id: default
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
formats: tar.gz
format_overrides:
- goos: windows
formats: zip
files:
- README.md
- LICENSE
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
release:
name_template: "{{ .ProjectName }}-{{ .Version }}"
gitea_urls:
api: https://git.s1d3sw1ped.com/api/v1
download: https://git.s1d3sw1ped.com

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright © 2026 s1d3sw1ped
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,12 +1,11 @@
.PHONY: build build-web run run-manager run-runner cleanup cleanup-manager cleanup-runner kill-all clean-bin clean-web test help install
.PHONY: build build-web run run-manager run-runner cleanup cleanup-manager cleanup-runner clean-bin clean-web test help install
# Build the jiggablend binary (includes embedded web UI)
build: clean-bin build-web
go build -o bin/jiggablend ./cmd/jiggablend
# Build for Linux (cross-compile)
build-linux: clean-bin build-web
GOOS=linux GOARCH=amd64 go build -o bin/jiggablend ./cmd/jiggablend
build:
@echo "Building with GoReleaser..."
goreleaser build --clean --snapshot --single-target
@mkdir -p bin
@find dist -name jiggablend -type f -exec cp {} bin/jiggablend \;
# Build web UI
build-web: clean-web
@@ -27,10 +26,6 @@ cleanup-runner:
# Cleanup both manager and runner logs
cleanup: cleanup-manager cleanup-runner
# Kill all jiggablend processes
kill-all:
@echo "Not implemented"
# Run manager and runner in parallel (for testing)
run: cleanup build init-test
@echo "Starting manager and runner in parallel..."
@@ -74,17 +69,12 @@ clean-web:
test:
go test ./... -timeout 30s
# Install to /usr/local/bin
install: build
sudo cp bin/jiggablend /usr/local/bin/
# Show help
help:
@echo "Jiggablend Build and Run Makefile"
@echo ""
@echo "Build targets:"
@echo " build - Build jiggablend binary with embedded web UI"
@echo " build-linux - Cross-compile for Linux amd64"
@echo " build-web - Build web UI only"
@echo ""
@echo "Run targets:"
@@ -97,13 +87,11 @@ help:
@echo " cleanup - Clean all logs"
@echo " cleanup-manager - Clean manager logs"
@echo " cleanup-runner - Clean runner logs"
@echo " kill-all - Kill all running jiggablend processes"
@echo ""
@echo "Other targets:"
@echo " clean-bin - Clean build artifacts"
@echo " clean-web - Clean web build artifacts"
@echo " test - Run Go tests"
@echo " install - Install to /usr/local/bin"
@echo " help - Show this help"
@echo ""
@echo "CLI Usage:"

264
README.md
View File

@@ -4,28 +4,41 @@ A distributed Blender render farm system built with Go. The system consists of a
## Architecture
- **Manager**: Central server with REST API, web UI, DuckDB database, and local file storage
- **Manager**: Central server with REST API, embedded web UI, SQLite database, and local file storage
- **Runner**: Linux amd64 client that connects to manager, receives jobs, executes Blender renders, and reports back
Both manager and runner are part of a single binary (`jiggablend`) with subcommands.
## Features
- OAuth authentication (Google and Discord)
- Web-based job submission and monitoring
- Distributed rendering across multiple runners
- Real-time job progress tracking
- File upload/download for Blender files and rendered outputs
- Runner health monitoring
- **Authentication**: OAuth (Google and Discord) and local authentication with user management
- **Web UI**: Modern React-based interface for job submission and monitoring
- **Distributed Rendering**: Scale across multiple runners with automatic job distribution
- **Real-time Updates**: WebSocket-based progress tracking and job status updates
- **Video Encoding**: Automatic video encoding from EXR/PNG sequences with multiple codec support:
- H.264 (MP4) - SDR and HDR support
- AV1 (MP4) - With alpha channel support
- VP9 (WebM) - With alpha channel and HDR support
- **Output Formats**: PNG, JPEG, EXR, and video formats (MP4, WebM)
- **Blender Version Management**: Support for multiple Blender versions with automatic detection
- **Metadata Extraction**: Automatic extraction of scene metadata from Blender files
- **Admin Panel**: User and runner management interface
- **Runner Management**: API key-based authentication for runners with health monitoring
- **HDR Support**: Preserve HDR range in video encoding with HLG transfer function
- **Alpha Channel**: Preserve alpha channel in video encoding (AV1 and VP9)
## Prerequisites
### Manager
- Go 1.21 or later
- DuckDB (via Go driver)
- Go 1.25.4 or later
- SQLite (via Go driver)
- Blender installed and in PATH (for metadata extraction)
- ImageMagick installed (for EXR preview conversion)
### Runner
- Linux amd64
- Blender installed and in PATH
- FFmpeg installed (optional, for video processing)
- Blender installed (can use bundled versions from storage)
- FFmpeg installed (required for video encoding)
## Installation
@@ -44,44 +57,87 @@ go mod download
### Manager
Set the following environment variables for authentication (optional):
Configuration is managed through the CLI using `jiggablend manager config` commands. The configuration is stored in the SQLite database.
#### Initial Setup
For testing, use the Makefile helper:
```bash
make init-test
```
This will:
- Enable local authentication
- Set a fixed API key for testing
- Create a test admin user (test@example.com / testpassword)
#### Manual Configuration
```bash
# OAuth Providers (optional)
export GOOGLE_CLIENT_ID="your-google-client-id"
export GOOGLE_CLIENT_SECRET="your-google-client-secret"
export GOOGLE_REDIRECT_URL="http://localhost:8080/api/auth/google/callback"
# Enable local authentication
jiggablend manager config enable localauth
export DISCORD_CLIENT_ID="your-discord-client-id"
export DISCORD_CLIENT_SECRET="your-discord-client-secret"
export DISCORD_REDIRECT_URL="http://localhost:8080/api/auth/discord/callback"
# Add a user
jiggablend manager config add user <email> <password> --admin
# Local Authentication (optional)
export ENABLE_LOCAL_AUTH="true"
# Generate an API key for runners
jiggablend manager config add apikey <name> --scope manager
# Test User (optional, for testing only)
# Creates a local user on startup if it doesn't exist
export LOCAL_TEST_EMAIL="test@example.com"
export LOCAL_TEST_PASSWORD="testpassword"
# Set OAuth credentials
jiggablend manager config set google-oauth <client-id> <client-secret> --redirect-url <url>
jiggablend manager config set discord-oauth <client-id> <client-secret> --redirect-url <url>
# View current configuration
jiggablend manager config show
# List users and API keys
jiggablend manager config list users
jiggablend manager config list apikeys
```
#### Environment Variables
You can also use environment variables with the `JIGGABLEND_` prefix:
- `JIGGABLEND_PORT` - Server port (default: 8080)
- `JIGGABLEND_DB` - Database path (default: jiggablend.db)
- `JIGGABLEND_STORAGE` - Storage path (default: ./jiggablend-storage)
- `JIGGABLEND_LOG_FILE` - Log file path
- `JIGGABLEND_LOG_LEVEL` - Log level (debug, info, warn, error)
- `JIGGABLEND_VERBOSE` - Enable verbose logging
### Runner
No configuration required. Runner will auto-detect hostname and IP.
The runner requires an API key to connect to the manager. The runner will auto-detect hostname and IP.
## Usage
### Building
```bash
# Build the unified binary (includes embedded web UI)
make build
# Or build directly
go build -o bin/jiggablend ./cmd/jiggablend
# Build web UI separately
make build-web
```
### Running the Manager
```bash
# Using make
# Using make (includes test setup)
make run-manager
# Or directly
go run ./cmd/manager
bin/jiggablend manager
# With custom options
go run ./cmd/manager -port 8080 -db jiggablend.db -storage ./storage
bin/jiggablend manager --port 8080 --db jiggablend.db --storage ./jiggablend-storage --log-file manager.log
# Using environment variables
JIGGABLEND_PORT=8080 JIGGABLEND_DB=jiggablend.db bin/jiggablend manager
```
The manager will start on `http://localhost:8080` by default.
@@ -89,26 +145,28 @@ The manager will start on `http://localhost:8080` by default.
### Running a Runner
```bash
# Using make
# Using make (uses test API key)
make run-runner
# Or directly
go run ./cmd/runner
# Or directly (requires API key)
bin/jiggablend runner --api-key <your-api-key>
# With custom options
go run ./cmd/runner -manager http://localhost:8080 -name my-runner
bin/jiggablend runner --manager http://localhost:8080 --name my-runner --api-key <key> --log-file runner.log
# Using environment variables
JIGGABLEND_MANAGER=http://localhost:8080 JIGGABLEND_API_KEY=<key> bin/jiggablend runner
```
### Building
### Running Both (for Testing)
```bash
# Build manager
make build-manager
# Build runner (Linux amd64)
make build-runner
# Run manager and runner in parallel
make run
```
This will start both the manager and a test runner with a fixed API key.
## OAuth Setup
### Google OAuth
@@ -118,7 +176,10 @@ make build-runner
3. Enable Google+ API
4. Create OAuth 2.0 credentials
5. Add authorized redirect URI: `http://localhost:8080/api/auth/google/callback`
6. Set environment variables with Client ID and Secret
6. Configure using CLI:
```bash
jiggablend manager config set google-oauth <client-id> <client-secret> --redirect-url http://localhost:8080/api/auth/google/callback
```
### Discord OAuth
@@ -126,25 +187,39 @@ make build-runner
2. Create a new application
3. Go to OAuth2 section
4. Add redirect URI: `http://localhost:8080/api/auth/discord/callback`
5. Set environment variables with Client ID and Secret
5. Configure using CLI:
```bash
jiggablend manager config set discord-oauth <client-id> <client-secret> --redirect-url http://localhost:8080/api/auth/discord/callback
```
## Project Structure
```
jiggablend/
├── cmd/
── manager/ # Manager server application
└── runner/ # Runner client application
── jiggablend/ # Unified CLI application
├── cmd/ # Cobra command definitions
│ └── main.go # Entry point
├── internal/
│ ├── api/ # REST API handlers
│ ├── auth/ # OAuth authentication
│ ├── database/ # DuckDB database models and migrations
│ ├── queue/ # Job queue management
│ ├── storage/ # File storage operations
── runner/ # Runner management logic
│ ├── auth/ # Authentication (OAuth, local, sessions)
│ ├── config/ # Configuration management
│ ├── database/ # SQLite database models and migrations
│ ├── logger/ # Logging utilities
│ ├── manager/ # Manager server logic
── runner/ # Runner client logic
│ │ ├── api/ # Manager API client
│ │ ├── blender/ # Blender version detection
│ │ ├── encoding/ # Video encoding (H.264, AV1, VP9)
│ │ ├── tasks/ # Task execution (render, encode, process)
│ │ └── workspace/ # Workspace management
│ └── storage/ # File storage operations
├── pkg/
│ ├── executils/ # Execution utilities
│ ├── scripts/ # Python scripts for Blender
│ └── types/ # Shared types and models
├── web/ # Static web UI files
├── web/ # React web UI
│ ├── src/ # Source files
│ └── dist/ # Built files (embedded in binary)
├── go.mod
└── Makefile
```
@@ -156,27 +231,106 @@ jiggablend/
- `GET /api/auth/google/callback` - Google OAuth callback
- `GET /api/auth/discord/login` - Initiate Discord OAuth
- `GET /api/auth/discord/callback` - Discord OAuth callback
- `POST /api/auth/login` - Local authentication login
- `POST /api/auth/register` - User registration (if enabled)
- `POST /api/auth/logout` - Logout
- `GET /api/auth/me` - Get current user
- `POST /api/auth/password/change` - Change password
### Jobs
- `POST /api/jobs` - Create a new job
- `GET /api/jobs` - List user's jobs
- `GET /api/jobs/{id}` - Get job details
- `DELETE /api/jobs/{id}` - Cancel a job
- `POST /api/jobs/{id}/upload` - Upload job file
- `POST /api/jobs/{id}/upload` - Upload job file (Blender file)
- `GET /api/jobs/{id}/files` - List job files
- `GET /api/jobs/{id}/files/{fileId}/download` - Download job file
- `GET /api/jobs/{id}/metadata` - Extract metadata from uploaded file
- `GET /api/jobs/{id}/outputs` - List job output files
### Runners
- `GET /api/admin/runners` - List all runners (admin only)
- `POST /api/runner/register` - Register a runner (uses registration token)
- `POST /api/runner/heartbeat` - Update runner heartbeat (runner authenticated)
### Blender
- `GET /api/blender/versions` - List available Blender versions
### Runners (Internal API)
- `POST /api/runner/register` - Register a runner (uses API key)
- `POST /api/runner/heartbeat` - Update runner heartbeat
- `GET /api/runner/tasks` - Get pending tasks for runner
- `POST /api/runner/tasks/{id}/complete` - Mark task as complete
- `GET /api/runner/files/{jobId}/{fileName}` - Download file for runner
- `POST /api/runner/files/{jobId}/upload` - Upload file from runner
### Admin (Admin Only)
- `GET /api/admin/runners` - List all runners
- `GET /api/admin/jobs` - List all jobs
- `GET /api/admin/users` - List all users
- `GET /api/admin/stats` - System statistics
### WebSocket
- `WS /api/ws` - WebSocket connection for real-time updates
- Subscribe to job channels: `job:{jobId}`
- Receive job status updates, progress, and logs
## Output Formats
The system supports the following output formats:
### Image Formats
- **PNG** - Standard PNG output
- **JPEG** - JPEG output
- **EXR** - OpenEXR format (HDR)
### Video Formats
- **EXR_264_MP4** - H.264 encoded MP4 from EXR sequence (SDR or HDR)
- **EXR_AV1_MP4** - AV1 encoded MP4 from EXR sequence (with alpha channel support)
- **EXR_VP9_WEBM** - VP9 encoded WebM from EXR sequence (with alpha channel and HDR support)
Video encoding features:
- 2-pass encoding for optimal quality
- HDR preservation using HLG transfer function
- Alpha channel preservation (AV1 and VP9 only)
- Automatic detection of source format (EXR or PNG)
- Software encoding (libx264, libaom-av1, libvpx-vp9)
## Storage Structure
The manager uses a local storage directory (default: `./jiggablend-storage`) with the following structure:
```
jiggablend-storage/
├── blender-versions/ # Bundled Blender versions
│ └── <version>/
├── jobs/ # Job context files
│ └── <job-id>/
│ └── context.tar
├── outputs/ # Rendered outputs
│ └── <job-id>/
├── temp/ # Temporary files
└── uploads/ # Uploaded files
```
## Development
### Running Tests
```bash
make test
# Or directly
go test ./... -timeout 30s
```
### Web UI Development
The web UI is built with React and Vite. To develop the UI:
```bash
cd web
npm install
npm run dev # Development server
npm run build # Build for production
```
The built files are embedded in the Go binary using `embed.FS`.
## License
MIT

View File

@@ -32,4 +32,3 @@ func exitWithError(msg string, args ...interface{}) {
fmt.Fprintf(os.Stderr, "Error: "+msg+"\n", args...)
os.Exit(1)
}

View File

@@ -0,0 +1,25 @@
package cmd
import (
"fmt"
"jiggablend/version"
"github.com/spf13/cobra"
)
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version information",
Long: `Print the version and build date of jiggablend.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("jiggablend version %s\n", version.Version)
if version.Date != "" {
fmt.Printf("Build date: %s\n", version.Date)
}
},
}
func init() {
rootCmd.AddCommand(versionCmd)
}

View File

@@ -4,6 +4,7 @@ import (
"os"
"jiggablend/cmd/jiggablend/cmd"
_ "jiggablend/version"
)
func main() {
@@ -11,4 +12,3 @@ func main() {
os.Exit(1)
}
}

4
go.mod
View File

@@ -4,6 +4,8 @@ go 1.25.4
require (
github.com/go-chi/chi/v5 v5.2.3
github.com/go-chi/cors v1.2.2
github.com/golang-migrate/migrate/v4 v4.19.0
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
github.com/mattn/go-sqlite3 v1.14.32
@@ -17,9 +19,7 @@ require (
cloud.google.com/go/compute/metadata v0.5.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-chi/cors v1.2.2 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/golang-migrate/migrate/v4 v4.19.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect

6
go.sum
View File

@@ -1,5 +1,3 @@
cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc=
cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k=
cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY=
cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
@@ -34,8 +32,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=

16
version/version.go Normal file
View File

@@ -0,0 +1,16 @@
// version/version.go
package version
import "time"
var Version string
var Date string
func init() {
if Version == "" {
Version = "0.0.0-dev"
}
if Date == "" {
Date = time.Now().Format("2006-01-02 15:04:05")
}
}