Spaces:
Running
Running
Add Modal deployment setup guide
Browse files- MODAL_SETUP.md +123 -0
MODAL_SETUP.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ποΈ HERMES Modal Deployment Setup
|
| 2 |
+
|
| 3 |
+
## β
Prerequisites Completed
|
| 4 |
+
|
| 5 |
+
- β
Python 3.13 virtual environment created (`.venv/`)
|
| 6 |
+
- β
Modal CLI installed (version 1.2.2)
|
| 7 |
+
- β
MCP server code ready ([mcp_server.py](mcp_server.py))
|
| 8 |
+
|
| 9 |
+
## π Next Steps - Authentication Required
|
| 10 |
+
|
| 11 |
+
### 1. Authenticate with Modal
|
| 12 |
+
|
| 13 |
+
Run this command to set up your Modal account:
|
| 14 |
+
|
| 15 |
+
```bash
|
| 16 |
+
source .venv/bin/activate
|
| 17 |
+
modal token new
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
This will:
|
| 21 |
+
- Open a browser window
|
| 22 |
+
- Prompt you to sign up/sign in to Modal (it's free!)
|
| 23 |
+
- Create API credentials on your machine
|
| 24 |
+
- Link your local environment to your Modal workspace
|
| 25 |
+
|
| 26 |
+
### 2. Verify Authentication
|
| 27 |
+
|
| 28 |
+
After authenticating, check that it worked:
|
| 29 |
+
|
| 30 |
+
```bash
|
| 31 |
+
source .venv/bin/activate
|
| 32 |
+
modal profile list
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
You should see your workspace name in the table.
|
| 36 |
+
|
| 37 |
+
### 3. Deploy HERMES MCP Server
|
| 38 |
+
|
| 39 |
+
Once authenticated, deploy the server:
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
source .venv/bin/activate
|
| 43 |
+
modal deploy mcp_server.py
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
This will:
|
| 47 |
+
- Package your code and dependencies
|
| 48 |
+
- Deploy to Modal's serverless infrastructure
|
| 49 |
+
- Give you a live URL for your MCP functions
|
| 50 |
+
|
| 51 |
+
### 4. Test the Deployment
|
| 52 |
+
|
| 53 |
+
Test your deployed functions locally:
|
| 54 |
+
|
| 55 |
+
```bash
|
| 56 |
+
source .venv/bin/activate
|
| 57 |
+
modal run mcp_server.py
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
This runs the local test suite that calls your deployed functions.
|
| 61 |
+
|
| 62 |
+
### 5. (Optional) Set Up Secrets for AI Features
|
| 63 |
+
|
| 64 |
+
If you want to use OpenAI/Anthropic/ElevenLabs features in the MCP server:
|
| 65 |
+
|
| 66 |
+
```bash
|
| 67 |
+
source .venv/bin/activate
|
| 68 |
+
modal secret create hermes-secrets \
|
| 69 |
+
OPENAI_API_KEY=your-openai-key \
|
| 70 |
+
ANTHROPIC_API_KEY=your-anthropic-key \
|
| 71 |
+
ELEVENLABS_API_KEY=your-elevenlabs-key
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
Then update [mcp_server.py](mcp_server.py) to use the secrets.
|
| 75 |
+
|
| 76 |
+
## π― What Modal Gives You
|
| 77 |
+
|
| 78 |
+
- **Serverless Functions**: Your astrology calculations run on-demand
|
| 79 |
+
- **Automatic Scaling**: Handles 1 user or 1000 users seamlessly
|
| 80 |
+
- **Free Tier**: 30 free credits/month (plenty for development)
|
| 81 |
+
- **MCP Integration**: Functions are exposed as MCP tools
|
| 82 |
+
- **No Infrastructure**: No servers to manage
|
| 83 |
+
|
| 84 |
+
## π Available MCP Functions
|
| 85 |
+
|
| 86 |
+
Once deployed, these functions will be available:
|
| 87 |
+
|
| 88 |
+
1. `calculate_full_dignities` - Complete essential dignity analysis
|
| 89 |
+
2. `get_bound_ruler` - Egyptian bounds (terms) calculation
|
| 90 |
+
3. `get_decan_ruler` - Decan (face) calculation
|
| 91 |
+
4. `calculate_zodiacal_releasing` - Time-lord periods from Vettius Valens
|
| 92 |
+
5. `calculate_firdaria` - Persian time-lord system
|
| 93 |
+
6. `find_fixed_stars` - Fixed star conjunctions
|
| 94 |
+
|
| 95 |
+
## π° Cost Estimate
|
| 96 |
+
|
| 97 |
+
Based on the current configuration:
|
| 98 |
+
- **CPU**: 1 vCPU @ 0.1 credits/hour
|
| 99 |
+
- **Memory**: 1GB RAM (included)
|
| 100 |
+
- **Typical Request**: ~0.5 seconds = ~0.00001 credits
|
| 101 |
+
- **Free Tier**: 30 credits/month β 300,000 requests
|
| 102 |
+
|
| 103 |
+
## π Resources
|
| 104 |
+
|
| 105 |
+
- **Modal Docs**: https://modal.com/docs
|
| 106 |
+
- **Modal Dashboard**: https://modal.com/apps
|
| 107 |
+
- **Billing**: https://modal.com/settings/billing
|
| 108 |
+
- **Support**: https://modal.com/slack
|
| 109 |
+
|
| 110 |
+
## π Troubleshooting
|
| 111 |
+
|
| 112 |
+
**Problem**: `modal token new` doesn't work
|
| 113 |
+
- **Solution**: Make sure you're in the virtual environment (`source .venv/bin/activate`)
|
| 114 |
+
|
| 115 |
+
**Problem**: Deployment fails
|
| 116 |
+
- **Solution**: Check [mcp_server.py](mcp_server.py) syntax with `python mcp_server.py`
|
| 117 |
+
|
| 118 |
+
**Problem**: Functions timeout
|
| 119 |
+
- **Solution**: Increase timeout in `modal_config.py` (currently 300 seconds)
|
| 120 |
+
|
| 121 |
+
---
|
| 122 |
+
|
| 123 |
+
**Ready to deploy?** Start with step 1 above! π
|