nothingworry commited on
Commit
852c966
Β·
1 Parent(s): 97637c6

Deploy IntegraChat to Hugging Face Spaces - Full deployment with Docker, MCP server, FastAPI backend, and Gradio UI

Browse files
Files changed (2) hide show
  1. NEXT_STEPS.md +172 -0
  2. QUICK_PUSH_GUIDE.md +74 -0
NEXT_STEPS.md ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # πŸš€ Next Steps to Deploy to Hugging Face Spaces
2
+
3
+ ## βœ… What's Ready
4
+ - βœ… Dockerfile created
5
+ - βœ… .dockerignore created
6
+ - βœ… README_HF_SPACES.md created
7
+ - βœ… All deployment files committed
8
+ - βœ… Git remote configured: `hf` β†’ `https://huggingface.co/spaces/nothingworry/IntegraChat`
9
+
10
+ ## πŸ“‹ Step-by-Step Instructions
11
+
12
+ ### Step 1: Create Your Hugging Face Space
13
+
14
+ 1. **Go to**: https://huggingface.co/new-space
15
+ 2. **Fill in the form**:
16
+ - **Space name**: `IntegraChat` (must match your remote)
17
+ - **SDK**: Select **Docker** ⚠️ (IMPORTANT!)
18
+ - **Hardware**:
19
+ - **CPU basic** (free) - for testing
20
+ - **CPU upgrade** (paid) - for better performance
21
+ - **Visibility**: Public or Private
22
+ 3. **Click "Create Space"**
23
+
24
+ ### Step 2: Authenticate with Hugging Face
25
+
26
+ You need to authenticate before pushing. Choose one method:
27
+
28
+ #### Option A: Using Hugging Face CLI (Recommended)
29
+ ```powershell
30
+ # Install HF CLI if not already installed
31
+ pip install huggingface_hub
32
+
33
+ # Login
34
+ huggingface-cli login
35
+ # Enter your token when prompted
36
+ ```
37
+
38
+ #### Option B: Using Git Credentials
39
+ ```powershell
40
+ # Set your HF token as credential helper
41
+ git config --global credential.helper store
42
+ # Then push - it will prompt for username and token
43
+ ```
44
+
45
+ #### Option C: Use Token in URL (One-time)
46
+ ```powershell
47
+ git remote set-url hf https://USERNAME:TOKEN@huggingface.co/spaces/nothingworry/IntegraChat
48
+ ```
49
+
50
+ **Get your token from**: https://huggingface.co/settings/tokens
51
+ - Create a token with **"Write"** permissions
52
+
53
+ ### Step 3: Push to Hugging Face
54
+
55
+ Once the Space is created and you're authenticated:
56
+
57
+ ```powershell
58
+ git push hf main
59
+ ```
60
+
61
+ If you get authentication errors, try:
62
+ ```powershell
63
+ # Force push (if Space exists but is empty)
64
+ git push hf main --force
65
+ ```
66
+
67
+ ### Step 4: Configure Environment Variables
68
+
69
+ After pushing, go to your Space page:
70
+ **https://huggingface.co/spaces/nothingworry/IntegraChat**
71
+
72
+ 1. Click **"Settings"** tab
73
+ 2. Scroll to **"Repository secrets"** section
74
+ 3. Add these environment variables:
75
+
76
+ #### Required:
77
+ ```
78
+ POSTGRESQL_URL=postgresql://user:password@host:port/database
79
+ OLLAMA_URL=http://your-ollama-server:11434
80
+ OLLAMA_MODEL=llama3.1:latest
81
+ ```
82
+
83
+ **OR** (if using Groq instead):
84
+ ```
85
+ GROQ_API_KEY=your_groq_api_key
86
+ LLM_BACKEND=groq
87
+ ```
88
+
89
+ #### Optional:
90
+ ```
91
+ SUPABASE_URL=https://your-project.supabase.co
92
+ SUPABASE_SERVICE_KEY=your_service_role_key
93
+ GOOGLE_SEARCH_API_KEY=your_google_api_key
94
+ GOOGLE_SEARCH_CX_ID=your_search_engine_id
95
+ ```
96
+
97
+ ### Step 5: Wait for Build
98
+
99
+ 1. Go to **"Logs"** tab in your Space
100
+ 2. Monitor the build progress (5-10 minutes for first build)
101
+ 3. Look for:
102
+ - βœ… "Starting MCP server..."
103
+ - βœ… "Starting FastAPI backend..."
104
+ - βœ… "Starting Gradio UI..."
105
+ 4. Once build completes, your Space will be live!
106
+
107
+ ### Step 6: Test Your Deployment
108
+
109
+ 1. **Access your Space**: https://huggingface.co/spaces/nothingworry/IntegraChat
110
+ 2. **Test the UI**: Should see Gradio interface
111
+ 3. **Test API**: Go to `https://your-space-url/api/docs` for FastAPI docs
112
+ 4. **Test Health**: Check `https://your-space-url/api/health`
113
+
114
+ ## πŸ”§ Troubleshooting
115
+
116
+ ### "Repository not found" Error
117
+ - **Solution**: Create the Space first at https://huggingface.co/new-space
118
+ - Make sure Space name matches: `IntegraChat`
119
+
120
+ ### Authentication Errors
121
+ - **Solution**: Run `huggingface-cli login` and enter your token
122
+ - Or use token in remote URL: `git remote set-url hf https://USERNAME:TOKEN@huggingface.co/spaces/nothingworry/IntegraChat`
123
+
124
+ ### Build Fails
125
+ - Check **Logs** tab for specific errors
126
+ - Common issues:
127
+ - Missing environment variables
128
+ - Database connection errors
129
+ - Port conflicts
130
+
131
+ ### Services Not Starting
132
+ - Check environment variables are set correctly
133
+ - Verify database is accessible from HF servers
134
+ - Check LLM service (Ollama/Groq) is accessible
135
+
136
+ ## πŸ“ž Quick Commands Reference
137
+
138
+ ```powershell
139
+ # Check remotes
140
+ git remote -v
141
+
142
+ # Check status
143
+ git status
144
+
145
+ # View commits
146
+ git log --oneline -5
147
+
148
+ # Push to HF (after Space is created)
149
+ git push hf main
150
+
151
+ # If authentication needed
152
+ huggingface-cli login
153
+
154
+ # Check Space exists
155
+ # Visit: https://huggingface.co/spaces/nothingworry/IntegraChat
156
+ ```
157
+
158
+ ## βœ… Checklist
159
+
160
+ - [ ] Created Hugging Face Space (Docker SDK)
161
+ - [ ] Authenticated with HF (huggingface-cli login)
162
+ - [ ] Pushed code to Space (git push hf main)
163
+ - [ ] Added environment variables in Space Settings
164
+ - [ ] Build completed successfully
165
+ - [ ] Tested Space is working
166
+
167
+ ---
168
+
169
+ **Your Space URL**: https://huggingface.co/spaces/nothingworry/IntegraChat
170
+
171
+ **Need Help?** Check the Logs tab in your Space for detailed error messages.
172
+
QUICK_PUSH_GUIDE.md ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # πŸš€ Quick Guide: Push to Hugging Face Spaces
2
+
3
+ ## ⚠️ The Space doesn't exist yet! Create it first:
4
+
5
+ ### Step 1: Create the Space (2 minutes)
6
+
7
+ 1. **Open your browser** and go to:
8
+ ```
9
+ https://huggingface.co/new-space
10
+ ```
11
+
12
+ 2. **Fill in the form**:
13
+ - **Space name**: `IntegraChat`
14
+ - **SDK**: Select **"Docker"** (IMPORTANT!)
15
+ - **Hardware**: Choose **"CPU basic"** (free) or upgrade
16
+ - **Visibility**: Public or Private
17
+
18
+ 3. **Click "Create Space"**
19
+
20
+ 4. **Wait 10-20 seconds** for the Space to be created
21
+
22
+ ### Step 2: Authenticate (if needed)
23
+
24
+ If you get authentication errors when pushing, run:
25
+
26
+ ```powershell
27
+ huggingface-cli login
28
+ ```
29
+
30
+ Enter your token from: https://huggingface.co/settings/tokens
31
+
32
+ ### Step 3: Push Your Code
33
+
34
+ Once the Space is created, run:
35
+
36
+ ```powershell
37
+ git push hf main
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 🎯 Alternative: Use Token in URL (One-time)
43
+
44
+ If you prefer to authenticate via token:
45
+
46
+ 1. Get your token: https://huggingface.co/settings/tokens
47
+ 2. Run this command (replace YOUR_TOKEN):
48
+
49
+ ```powershell
50
+ git remote set-url hf https://nothingworry:YOUR_TOKEN@huggingface.co/spaces/nothingworry/IntegraChat
51
+ ```
52
+
53
+ 3. Then push:
54
+ ```powershell
55
+ git push hf main
56
+ ```
57
+
58
+ ---
59
+
60
+ ## βœ… After Pushing
61
+
62
+ 1. Go to: https://huggingface.co/spaces/nothingworry/IntegraChat
63
+ 2. Click **"Settings"** tab
64
+ 3. Add environment variables in **"Repository secrets"**:
65
+ - `POSTGRESQL_URL`
66
+ - `OLLAMA_URL` (or `GROQ_API_KEY`)
67
+ - `OLLAMA_MODEL`
68
+ 4. Wait for build (5-10 minutes)
69
+ 5. Check **"Logs"** tab for progress
70
+
71
+ ---
72
+
73
+ **Your Space URL**: https://huggingface.co/spaces/nothingworry/IntegraChat
74
+