Spaces:
Sleeping
Download DEPLOYMENT_GUIDE.md from StrategyStack/README: direct link, hf CLI and curl.
- Browser
- Download file 9.19 kB
-
https://huggingface.co/spaces/StrategyStack/README/resolve/main/DEPLOYMENT_GUIDE.md
- Command line
-
hf download hf://spaces/StrategyStack/README/DEPLOYMENT_GUIDE.md
-
curl -L -o DEPLOYMENT_GUIDE.md https://huggingface.co/spaces/StrategyStack/README/resolve/main/DEPLOYMENT_GUIDE.md
A newer version of the Gradio SDK is available: 6.32.0
StrategyStack Deployment Guide
Customer-Ready Multi-Tenant Platform
This guide explains how to deploy and configure the StrategyStack Recovery, Enrichment & Outreach Platform for production use with Hugging Face Spaces.
β What's Already Implemented
The platform now includes:
1. OAuth Authentication
- π Sign in with Hugging Face button
- Automatic user authentication via
gr.OAuthProfile - All dashboard panels protected behind authentication
- Unauthenticated users see clear login prompts
2. Per-User Data Isolation
- Each user's data stored in
/data/users/{username}/ - Zero data sharing between users
- Customer data ownership model (you don't hold their data)
- Automatic user directory creation on first access
3. Multi-Tenant Architecture
- Session-based data loading
- Username displayed in all panels
- Sample data for seamless new user onboarding
- Refresh buttons for manual data reloading
4. Data Types Supported
- Consent events (consent_events.json)
- Cadence branches (branches.json)
- Diagnostic logs (diagnostics.json)
- Extensible to any JSON-serializable data
π Deployment Steps
Step 1: Enable Persistent Storage
CRITICAL: Hugging Face Spaces must have persistent storage enabled for user data to persist between sessions.
- Go to your Space: https://huggingface.co/spaces/StrategyStack/README
- Click on Settings tab
- Scroll to Storage section
- Enable Persistent storage
- Select storage size (recommended: 20GB minimum for multi-tenant use)
- Save changes
Note: Persistent storage is mounted at /data and persists across Space restarts.
Step 2: Configure Space Secrets (Optional)
If your application needs API keys for external services:
Go to Settings tab
Scroll to Variables and secrets section
Add secrets:
LINKEDIN_API_KEY(if using LinkedIn integration)TWILIO_API_KEY(if using Twilio integration)SALESFORCE_API_KEY(if using Salesforce integration)- Any other API keys your agents require
Access in code:
import os
linkedin_key = os.getenv('LINKEDIN_API_KEY')
Step 3: Verify OAuth Configuration
The OAuth setup is already complete:
- β
README.md has
hf_oauth: truein metadata (line 9) - β
app.py has
gr.LoginButton()component - β
All functions accept
gr.OAuthProfileparameter
No additional OAuth configuration needed!
Step 4: Test Multi-User Access
Open the Space: https://huggingface.co/spaces/StrategyStack/README
Click Sign in with Hugging Face
Verify you see:
- Your username displayed in panels
- Sample data (since you're a new user)
- All four dashboard tabs accessible
Test with a second account:
- Sign out
- Sign in with different HF account
- Verify data is separate from first account
π Monitoring & Operations
Viewing Logs
- Go to Space page
- Click on Logs dropdown (top right)
- Select:
- Build - See build logs
- Container - See runtime application logs
Space Status
- π’ Running - Space is live and accepting users
- π΅ Building - Space is being rebuilt after code changes
- π΄ Runtime Error - Check container logs for errors
Restarting the Space
If you need to restart:
- Go to Settings tab
- Scroll to Sleep time settings
- Click Restart Space
Note: Persistent storage data survives restarts!
πΎ Data Management
User Data Structure
/data/
βββ users/
βββ username1/
β βββ consent_events.json
β βββ branches.json
β βββ diagnostics.json
βββ username2/
β βββ consent_events.json
β βββ branches.json
β βββ diagnostics.json
βββ ...
Accessing User Data
The app provides helper functions:
# Load user data
user_events = load_user_data(username, "consent_events")
# Save user data
save_user_data(username, "consent_events", data)
# Get user directory
user_dir = get_user_dir(username)
Backup Strategy
Important: While persistent storage is durable, implement regular backups:
Option A - Manual Backup:
- Use Hugging Face Hub's file browser
- Download
/datadirectory contents - Store securely off-platform
Option B - Automated Backup (Future Enhancement):
- Add scheduled backup function
- Export to external cloud storage
- Implement via Space cron or external scheduler
βοΈ Configuration Options
Customizing Data Storage Location
Edit app.py line 9:
DATA_DIR = Path("/data") # Change if needed
Adding New Data Types
- Define new data structure (JSON-serializable)
- Use existing functions:
# Save new data type
save_user_data(username, "campaigns", campaign_data)
# Load new data type
campaigns = load_user_data(username, "campaigns")
- Create UI panel to display/edit
Customizing Authentication Messages
Edit the authentication check in panel functions (app.py):
if profile is None:
return "Your custom auth message here"
π‘οΈ Security Considerations
Data Isolation
- β Users cannot access other users' data
- β File paths use username for isolation
- β No centralized data storage (privacy by design)
Authentication
- β OAuth via Hugging Face (no password management needed)
- β Profile information provided by HF OAuth
- β Automatic session management
API Keys
- β οΈ Store API keys in Space Secrets (not in code)
- β οΈ Never commit API keys to repository
- β οΈ Use environment variables for all sensitive data
π Customer Setup Instructions
Provide these steps to your customers:
For End Users:
Access the Platform:
- Visit: https://huggingface.co/spaces/StrategyStack/README
- Click "Sign in with Hugging Face"
- Create free HF account if needed
First Login:
- You'll see sample data to understand the interface
- Your personal data directory is automatically created
- All your data is isolated from other users
Using the Dashboard:
- Consent/Event Audit: View compliance events
- Cadence Branching Composer: Design outreach sequences
- Live Diagnostics: Monitor system health
- Audit Trail Export: Download compliance reports
Data Refresh:
- Click "Refresh Data" button in any tab
- Reloads your latest data from storage
For Administrators:
- Access Space settings for configuration
- Monitor logs for user activity
- Manage Space resources (storage, compute)
- Configure API keys for integrations
π Troubleshooting
Issue: "Authentication Required" message persists
Solution:
- Ensure you've clicked "Sign in with Hugging Face"
- Check browser cookies are enabled
- Try hard refresh (Cmd+Shift+R / Ctrl+Shift+R)
Issue: Data not persisting between sessions
Solution:
- Verify persistent storage is enabled in Space settings
- Check storage quota hasn't been exceeded
- Review container logs for write errors
Issue: Space shows "Runtime Error"
Solution:
- Click on "Logs" β "Container"
- Look for Python errors or exceptions
- Check if
/datadirectory is accessible - Verify all dependencies in requirements.txt
Issue: Slow performance
Solution:
- Upgrade Space hardware tier in Settings
- Optimize data loading (lazy loading)
- Implement caching for frequently accessed data
π Next Steps / Future Enhancements
Phase 1: Enhanced Data Management
- CSV export functionality
- Data import from external sources
- Bulk operations for large datasets
- Data visualization charts
Phase 2: Integration Capabilities
- Connect actual LinkedIn API
- Twilio SMS integration
- Salesforce sync
- Email campaign management
Phase 3: Advanced Features
- Team collaboration (share data with team members)
- Role-based access control
- Automated backup to cloud storage
- Advanced analytics dashboard
Phase 4: Enterprise Features
- SSO integration
- Compliance certifications (SOC 2, GDPR)
- White-label branding
- Custom domain support
π Support
For technical support:
- Documentation: See README.md for API documentation
- Issues: Report bugs via Hugging Face Space discussions
- Questions: Contact via Space community tab
π Summary
Your StrategyStack platform is now customer-ready with:
β Zero-config deployment - Works out of the box on HF Spaces β Secure authentication - OAuth via Hugging Face β Data privacy - Per-user isolated storage β Multi-tenant - Unlimited users, isolated data β No external dependencies - Everything on HF Spaces β Persistent storage - Data survives restarts β Compliance-ready - Full audit trails
Just enable persistent storage and you're ready to onboard customers!
Last Updated: 2025-01-06 Platform Version: 1.0.0 (OAuth-enabled) Hugging Face Spaces: β Production Ready