PutPlace Assistο
Local assistant daemon for automated file scanning and uploads to the PutPlace server.
Overviewο
PutPlace Assist (ppassist) is a background daemon that runs on client machines to automate file uploads. It provides:
Path Registration: Register directories to be scanned and uploaded
File Watching: Automatic detection of file changes via watchdog
SHA256 Checksums: Automatic calculation and tracking of file hashes
Upload Queue: Background file uploads with retry logic
Real-time Activity: SSE and WebSocket endpoints for monitoring
Web UI: Browser-based dashboard for monitoring and control
SQLite Database: Local tracking of files, upload status, and activity
Offline Operationο
PutPlace Assist is designed to work independently of the PutPlace server (pp_server). This makes it resilient to network issues and allows local-first operation.
What Works Without pp_serverο
Feature |
Works Offline |
|---|---|
Directory watching |
Yes |
File scanning |
Yes |
Metadata collection |
Yes |
SHA256 checksum calculation |
Yes |
Local database storage |
Yes |
Activity logging |
Yes |
Path/exclude management |
Yes |
Web UI dashboard |
Yes |
All local API endpoints |
Yes |
What Requires pp_serverο
Feature |
Requires Server |
|---|---|
Uploading file metadata |
Yes |
Uploading file content |
Yes |
Server authentication |
Yes |
How Offline Mode Worksο
Queue Everything Locally: When you register paths and trigger scans, ppassist stores all file metadata in its local SQLite database.
Calculate Checksums: The SHA256 background processor calculates checksums for all files, regardless of server availability.
Queue Uploads: Upload triggers queue files for upload. These remain queued until a server is configured and reachable.
Sync When Available: Once the server is available, queued uploads are processed automatically.
Example: Starting Without a Serverο
# Start ppassist - works without pp_server
ppassist start
# Verify it's running
curl http://localhost:8765/health
# {"status": "ok", "version": "0.1.0", "database_ok": true}
# Register a path - files are scanned and stored locally
curl -X POST http://localhost:8765/paths \
-H "Content-Type: application/json" \
-d '{"path": "/home/user/Documents", "recursive": true}'
# Check status - shows local file tracking
curl http://localhost:8765/status
# {
# "running": true,
# "files_tracked": 1250,
# "pending_sha256": 50,
# "pending_uploads": 1250
# }
Files remain in pending_uploads until a server is configured and uploads are triggered.
Architectureο
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client Machine β
β β
β βββββββββββββββββ βββββββββββββββββββββββββββββββββββ β
β β pp_client β β ppassist daemon β β
β β (CLI tool) βββββββββΆβ ββββββββββββββββββββββββββββββββ β
β βββββββββββββββββ HTTP β β FastAPI Server ββ β
β β β (port 8765) ββ β
β βββββββββββββββββ β ββββββββββββββββββββββββββββββββ β
β β Web UI βββββββββΆβ ββββββββββββ ββββββββββββββββ β β
β β (Browser) β HTTP β β Watcher β β Uploader ββββΌβββΌβββΆ PutPlace
β βββββββββββββββββ β β(watchdog)β β (queue) β β β Server
β β ββββββββββββ ββββββββββββββββ β β
β β ββββββββββββββββββββββββββββββββ β
β β β SQLite Database ββ β
β β β (paths, files, activity) ββ β
β β ββββββββββββββββββββββββββββββββ β
β βββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Installationο
pip install putplace-assist
Or install from source:
cd packages/putplace-assist
pip install -e '.[dev]'
Quick Startο
Start the Daemonο
# Start in background (daemonized)
ppassist start
# Start in foreground (for development/debugging)
ppassist start --foreground
# Check status
ppassist status
# Stop daemon
ppassist stop
Access the Web UIο
Once the daemon is running, open your browser to:
http://127.0.0.1:8765/ui
The web UI provides:
Real-time statistics dashboard
Live activity feed (via SSE)
Path management (add/remove/scan)
Upload progress monitoring
Register a Pathο
Using the CLI:
pp_client --path /path/to/watch
Using curl:
curl -X POST http://127.0.0.1:8765/paths \
-H "Content-Type: application/json" \
-d '{"path": "/path/to/watch", "recursive": true}'
Trigger Uploadsο
# Upload metadata only
curl -X POST http://127.0.0.1:8765/uploads \
-H "Content-Type: application/json" \
-d '{"upload_content": false}'
# Upload metadata and file content
curl -X POST http://127.0.0.1:8765/uploads \
-H "Content-Type: application/json" \
-d '{"upload_content": true}'
CLI Commandsο
ppassistο
The daemon control CLI:
ppassist [OPTIONS] COMMAND
Commandsο
Command |
Description |
|---|---|
|
Start the daemon |
|
Stop the daemon |
|
Show daemon status |
|
Restart the daemon |
Start Optionsο
Option |
Default |
Description |
|---|---|---|
|
|
Run in foreground (donβt daemonize) |
|
|
Host to bind to |
|
|
Port to bind to |
pp_clientο
The command-line client for interacting with the daemon:
pp_client [OPTIONS]
Optionsο
Option |
Description |
|---|---|
|
Register a directory to watch |
|
Add exclude pattern (repeatable) |
|
Donβt scan recursively |
|
Trigger uploads after registration |
|
Upload file content (not just metadata) |
|
Wait for uploads to complete |
|
Show daemon status |
|
Daemon URL (default: http://127.0.0.1:8765) |
|
Configure remote server credentials |
|
Stream activity events |
Examplesο
# Register a path and trigger upload
pp_client --path ~/Documents --upload --wait
# Add exclude patterns
pp_client --path ~/Projects --exclude "*.log" --exclude ".git" --exclude "node_modules"
# Check daemon status
pp_client --status
# Configure remote server
pp_client --configure-server
# Watch activity in real-time
pp_client --verbose
Web UIο
The web UI is accessible at http://127.0.0.1:8765/ui when the daemon is running.
Featuresο
Dashboardο
Paths Watched: Number of registered directories
Files Tracked: Total files being monitored
Uploads Complete: Successfully uploaded files
In Queue: Files waiting to be uploaded
Watched Paths Panelο
View all registered paths
Add new paths via modal dialog
Remove paths
Trigger manual rescans
See file counts and last scan time
Live Activity Feedο
Real-time event stream via SSE
Color-coded event types:
Blue: Upload events
Green: Successful operations
Yellow: Scan events
Red: Errors
Timestamps and detailed messages
Upload Progressο
Active upload status
Progress bars for in-progress uploads
Queue size indicator
API Referenceο
The daemon exposes a REST API on port 8765.
Status Endpointsο
GET /ο
Root endpoint with version info.
curl http://127.0.0.1:8765/
Response:
{
"name": "PutPlace Assist",
"version": "0.1.0",
"status": "running"
}
GET /healthο
Health check endpoint.
curl http://127.0.0.1:8765/health
Response:
{
"status": "ok",
"version": "0.1.0",
"database_ok": true
}
GET /statusο
Detailed daemon status.
curl http://127.0.0.1:8765/status
Response:
{
"running": true,
"uptime_seconds": 3600.5,
"version": "0.1.0",
"watcher_active": true,
"paths_watched": 3,
"files_tracked": 1250,
"upload_queue_size": 5
}
Path Endpointsο
GET /pathsο
List all registered paths.
curl http://127.0.0.1:8765/paths
POST /pathsο
Register a new path.
curl -X POST http://127.0.0.1:8765/paths \
-H "Content-Type: application/json" \
-d '{"path": "/path/to/watch", "recursive": true}'
GET /paths/{id}ο
Get details for a specific path.
DELETE /paths/{id}ο
Unregister a path.
POST /paths/{id}/scanο
Trigger a rescan of a path.
Exclude Endpointsο
GET /excludesο
List all exclude patterns.
POST /excludesο
Add an exclude pattern.
curl -X POST http://127.0.0.1:8765/excludes \
-H "Content-Type: application/json" \
-d '{"pattern": "*.log"}'
DELETE /excludes/{id}ο
Remove an exclude pattern.
File Endpointsο
GET /filesο
List tracked files with optional filtering.
Query parameters:
path_prefix: Filter by path prefixsha256: Filter by SHA256 hashlimit: Max results (default: 100)offset: Pagination offset
GET /files/statsο
Get file statistics.
curl http://127.0.0.1:8765/files/stats
Response:
{
"total_files": 1250,
"total_size": 5368709120,
"pending_uploads": 10,
"successful_uploads": 1200,
"failed_uploads": 5,
"paths_watched": 3
}
GET /files/{id}ο
Get details for a specific file.
DELETE /files/{id}ο
Remove a file from tracking.
Server Endpointsο
GET /serversο
List configured remote servers.
POST /serversο
Add a server configuration.
curl -X POST http://127.0.0.1:8765/servers \
-H "Content-Type: application/json" \
-d '{
"name": "production",
"url": "https://app.putplace.org",
"username": "user",
"password": "password"
}'
DELETE /servers/{id}ο
Remove a server configuration.
POST /servers/{id}/defaultο
Set a server as the default.
Upload Endpointsο
POST /uploadsο
Trigger file uploads.
curl -X POST http://127.0.0.1:8765/uploads \
-H "Content-Type: application/json" \
-d '{
"path_prefix": "/optional/filter",
"upload_content": true
}'
GET /uploads/statusο
Get current upload status with in-progress details.
GET /uploads/queueο
Get upload queue status.
Activity Endpointsο
GET /activityο
List recent activity events.
Query parameters:
limit: Max results (default: 50)since_id: Get events after this IDevent_type: Filter by event type
GET /activity/streamο
Server-Sent Events (SSE) stream for real-time activity.
curl -N http://127.0.0.1:8765/activity/stream
Event types:
scan_started,scan_completefile_discovered,file_changed,file_deletedupload_started,upload_progress,upload_complete,upload_failederror
WS /ws/activityο
WebSocket endpoint for real-time activity.
Scanning Endpointsο
POST /scanο
Trigger a full scan of all registered paths.
curl -X POST http://127.0.0.1:8765/scan
Configurationο
Configuration can be set via:
Environment variables (prefix:
PPASSIST_)TOML config file (
~/.config/putplace/ppassist.toml)Command-line arguments
Environment Variablesο
Variable |
Default |
Description |
|---|---|---|
|
|
Host to bind to |
|
|
Port to bind to |
|
|
Logging level |
|
|
Database path |
|
|
Enable file watching |
|
|
Debounce delay in seconds |
|
|
Parallel upload workers |
|
|
Retry attempts |
Config Fileο
Create ~/.config/putplace/ppassist.toml:
[server]
host = "127.0.0.1"
port = 8765
log_level = "INFO"
[database]
path = "~/.local/share/putplace/assist.db"
[watcher]
enabled = true
debounce_seconds = 2.0
[uploader]
parallel_uploads = 4
retry_attempts = 3
Data Locationsο
Type |
Default Path |
|---|---|
Database |
|
PID file |
|
Config file |
|
Log file |
|
Use Casesο
Automated Backup Monitoringο
Set up ppassist to watch your backup directories and automatically upload metadata to PutPlace:
# Start daemon
ppassist start
# Register backup directories
pp_client --path /backups/daily --upload
pp_client --path /backups/weekly --upload
# Exclude temporary files
curl -X POST http://127.0.0.1:8765/excludes \
-H "Content-Type: application/json" \
-d '{"pattern": "*.tmp"}'
Development Workflowο
Monitor source code directories and track changes:
# Register project directories
pp_client --path ~/Projects/myapp \
--exclude ".git" \
--exclude "node_modules" \
--exclude "__pycache__" \
--exclude "*.pyc"
Server Fleet Managementο
Deploy ppassist on multiple servers to centralize file tracking:
# Configure remote server
pp_client --configure-server
# Register system directories
pp_client --path /etc --upload
pp_client --path /var/log --exclude "*.gz" --upload
Troubleshootingο
Daemon Wonβt Startο
Check if another process is using port 8765:
lsof -i :8765
Check the log file:
cat ~/.local/share/putplace/ppassist.log
Connection Refusedο
Ensure the daemon is running:
ppassist status
If using a different port, specify it:
pp_client --daemon-url http://127.0.0.1:9000 --status
Files Not Being Detectedο
Check that the watcher is enabled:
curl http://127.0.0.1:8765/status | jq .watcher_active
Trigger a manual rescan:
curl -X POST http://127.0.0.1:8765/scan
Check exclude patterns arenβt too broad:
curl http://127.0.0.1:8765/excludes
Uploads Failingο
Check server configuration:
curl http://127.0.0.1:8765/serversCheck upload status for error messages:
curl http://127.0.0.1:8765/uploads/statusVerify credentials are correct by testing the server directly.
Developmentο
Running Testsο
cd packages/putplace-assist
invoke test
Running Linterο
invoke lint
invoke format
Development Serverο
invoke serve
This starts the daemon in development mode with auto-reload.