Quick Start Guide
This guide will help you get started with PyRestServer in just a few minutes.
Starting the Server
Local Filesystem Backend
The simplest way to start PyRestServer is with a local filesystem backend:
pyrestserver serve --path /tmp/restic --no-auth
This starts a server on http://localhost:8000 with:
No authentication
Data stored in
/tmp/resticUpload verification enabled
With Authentication
For production use, enable authentication:
# Create htpasswd file first
htpasswd -c /etc/restic/htpasswd myuser
# Start server with authentication
pyrestserver serve --path /srv/restic --htpasswd-file /etc/restic/htpasswd
Custom Port and Address
To use a different port or bind address:
pyrestserver serve --path /srv/restic --listen 192.168.1.100:8080
Using with restic
Initialize a Repository
Once the server is running, initialize a restic repository:
# Set repository password
export RESTIC_PASSWORD="your-secure-password"
# Initialize repository
restic -r rest:http://localhost:8000/myrepo init
This creates a new repository called myrepo on the server.
Create a Backup
Backup your data:
restic -r rest:http://localhost:8000/myrepo backup /home/user/documents
You can backup multiple paths:
restic -r rest:http://localhost:8000/myrepo backup \
/home/user/documents \
/home/user/photos \
/home/user/config
List Snapshots
View your backups:
restic -r rest:http://localhost:8000/myrepo snapshots
Restore Data
Restore from a backup:
# Restore latest snapshot
restic -r rest:http://localhost:8000/myrepo restore latest --target /restore/path
# Restore specific snapshot
restic -r rest:http://localhost:8000/myrepo restore abc123de --target /restore/path
# Restore specific files
restic -r rest:http://localhost:8000/myrepo restore latest \
--target /restore/path \
--include /home/user/documents/important.pdf
With Authentication
If the server requires authentication:
# Set credentials
export RESTIC_PASSWORD="your-secure-password"
export RESTIC_REST_USERNAME="myuser"
export RESTIC_REST_PASSWORD="mypassword"
# Now use restic normally
restic -r rest:http://localhost:8000/myrepo snapshots
Or use the URL format:
restic -r rest:http://myuser:mypassword@localhost:8000/myrepo snapshots
Configuration Management
PyRestServer includes a configuration manager for backend settings.
Interactive Configuration
Launch the interactive configuration wizard:
pyrestserver config
This guides you through setting up backends with password obscuring.
Adding a Backend
From the command line:
# Add a local backend
pyrestserver config add local-backup \
--type local \
--path /srv/restic
# Add a Drime backend
pyrestserver config add drime-backup \
--type drime \
--api-key "your-api-key" \
--workspace-id 0
Listing Backends
View configured backends:
pyrestserver config list
Using a Configured Backend
Start the server with a configured backend:
pyrestserver serve --backend-config local-backup
Drime Cloud Backend
PyRestServer supports Drime Cloud as a backend storage provider.
Prerequisites
Install with Drime support:
pip install pyrestserver[drime]
Starting with Drime
# Configure backend
pyrestserver config add drime-main \
--type drime \
--api-key "your-api-key" \
--workspace-id 0
# Start server
pyrestserver serve --backend-config drime-main --no-auth
Or directly with environment variables:
export DRIME_API_KEY="your-api-key"
pyrestserver serve --backend drime \
--workspace-id 0 \
--no-auth
Common Tasks
Enabling TLS
For secure communication:
pyrestserver serve --path /srv/restic \
--tls \
--tls-cert /etc/restic/cert.pem \
--tls-key /etc/restic/key.pem
Then use HTTPS with restic:
restic -r rest:https://localhost:8000/myrepo snapshots
Append-Only Mode
Prevent deletion of backups:
pyrestserver serve --path /srv/restic --append-only
In this mode, restic can create new backups but cannot delete old ones.
Enable Metrics
For monitoring with Prometheus:
pyrestserver serve --path /srv/restic --prometheus
Metrics are available at http://localhost:8000/metrics
Debug Mode
Enable detailed logging for troubleshooting:
pyrestserver serve --path /srv/restic --debug
Next Steps
Read the Configuration guide for detailed configuration options
Learn about Storage Backends for different storage options
Check Security Best Practices for production deployment best practices
See Command Line Interface for complete command reference