CRITICAL FIXES: - Fixed JWT key configuration issue causing HTTP 500 on login - Changed environment variable from JWT_SECRET_KEY to Jwt__Key (double underscore) - Increased JWT key length to >32 bytes (256 bits) as required by HMAC-SHA256 - Fixed ASPNETCORE_URLS configuration (not ASPNETCORE_HTTP_PORTS) DOCUMENTATION CREATED: - TROUBLESHOOTING.md: Complete troubleshooting guide with common issues and solutions - deploy-littleshop.sh: Automated deployment script with working configuration - docker-compose.hostinger.yml: Docker Compose file with all correct environment variables - Updated WORKING_BASELINE_2024-09-24.md: Added HTTP 500 fix details ROOT CAUSES IDENTIFIED: 1. JWT key environment variable naming mismatch (Jwt__Key vs JWT_SECRET_KEY) 2. JWT key too short (was 17 bytes, needs >32 bytes) 3. ASP.NET Core URL configuration issue (ASPNETCORE_URLS vs HTTP_PORTS) 4. Database file permissions (must be owned by UID 1654) WORKING CONFIGURATION: - Jwt__Key with 79-byte key - ASPNETCORE_URLS=http://+:8080 - Proper Docker network configuration (littleshop-network) - SilverPay integration on port 8000 (not 8001) This commit ensures we have a stable, documented baseline for future updates and addresses the concern about "one step forward, two steps back" by providing comprehensive documentation of all fixes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
190 lines
6.5 KiB
Markdown
190 lines
6.5 KiB
Markdown
# Working Baseline - September 24, 2024
|
|
|
|
## 🎯 System Status: FULLY OPERATIONAL
|
|
|
|
This document captures the current working state of the LittleShop/TeleBot/SilverPay integrated system.
|
|
|
|
## ✅ All Systems Working
|
|
|
|
### 1. **TeleBot** - Telegram Bot Interface
|
|
- **Status**: ✅ Operational
|
|
- **Container**: `telebot:latest`
|
|
- **Bot**: @Littleshop_tom_bot
|
|
- **Key Fixes Applied**:
|
|
- ✅ Checkout flow collects all address details in one message (not Step 1/5)
|
|
- ✅ No duplicate `/review` commands
|
|
- ✅ Currency display shows proper conversion notes
|
|
- ✅ Connected to LittleShop API successfully
|
|
- ✅ Tor proxy available via `telebot-tor` container
|
|
|
|
### 2. **LittleShop Admin** - E-commerce Backend
|
|
- **Status**: ✅ Operational
|
|
- **URL**: https://admin.thebankofdebbie.giize.com
|
|
- **Container**: `littleshop-admin`
|
|
- **Key Fixes Applied**:
|
|
- ✅ CSRF tokens on all forms (delete, update status)
|
|
- ✅ Pending Payment orders tab
|
|
- ✅ Rebranded to "TeleShop Admin"
|
|
- ✅ SilverPay integration fixed (fiat_amount field)
|
|
- ✅ Connected to both `littleshop-network` and `bridge` networks
|
|
- ✅ **HTTP 500 Login Fixed**: Username parameter case-insensitive
|
|
- ✅ **JWT Configuration Fixed**: Use Jwt__Key environment variable (not JWT_SECRET_KEY)
|
|
- ✅ **JWT Key Length**: Must be > 32 bytes/256 bits
|
|
|
|
### 3. **SilverPay** - Cryptocurrency Payment Gateway
|
|
- **Status**: ✅ Operational
|
|
- **URL**: https://pay.thebankofdebbie.giize.com
|
|
- **Container**: `silverpay-api`
|
|
- **Key Fixes Applied**:
|
|
- ✅ Connected to `littleshop-network` for container name resolution
|
|
- ✅ API accepting orders with correct field names
|
|
- ✅ Currency conversion working (GBP → BTC/ETH)
|
|
- ✅ Generating payment addresses successfully
|
|
|
|
## 🔧 Critical Configuration
|
|
|
|
### Docker Networks
|
|
All containers must be on `littleshop-network` for inter-container communication:
|
|
```bash
|
|
docker network connect littleshop-network [container-name]
|
|
```
|
|
|
|
### Environment Variables (LittleShop) - CRITICAL
|
|
```
|
|
ASPNETCORE_ENVIRONMENT=Production
|
|
ASPNETCORE_URLS=http://+:8080
|
|
ConnectionStrings__DefaultConnection=Data Source=/app/data/littleshop-production.db
|
|
Jwt__Key=ThisIsAVeryLongSecretKeyThatIsDefinitelyLongerThan32BytesForSure123456789ABCDEF
|
|
SilverPay__BaseUrl=http://silverpay-api:8000
|
|
SilverPay__ApiKey=7703aa7a62fa4b40a87e9cfd867f5407147515c0986116ea54fc00c0a0bc30d8
|
|
SilverPay__WebhookSecret=Thefa1r1esd1d1twebhooks2024
|
|
```
|
|
**IMPORTANT**: Use `Jwt__Key` (double underscore) NOT `JWT_SECRET_KEY`!
|
|
|
|
### API Field Names (SilverPay)
|
|
Request must include:
|
|
- `fiat_amount` (not `amount`)
|
|
- `fiat_currency` (e.g., "GBP")
|
|
- `currency` (crypto: "BTC", "ETH")
|
|
- `external_id`
|
|
- `webhook_url`
|
|
|
|
## 📊 Recent Fixes (Git Commits)
|
|
|
|
1. **7809b6e** - Fix SilverPay payment creation - use fiat_amount instead of amount
|
|
2. **5013e60** - Fix TeleBot compilation errors - use RequiredAmount property
|
|
3. **ddff649** - Fix TeleBot checkout flow and currency display
|
|
4. **bc708bb** - Fix missing CSRF tokens in all delete forms
|
|
5. **6e3c11a** - Add Pending Payment tab and rebrand to TeleShop Admin
|
|
|
|
## 🧪 Verification Tests
|
|
|
|
### Test 1: Payment Creation
|
|
```bash
|
|
curl -X POST http://silverpay-api:8000/api/v1/orders \
|
|
-H "Content-Type: application/json" \
|
|
-H "X-API-Key: 7703aa7a62fa4b40a87e9cfd867f5407147515c0986116ea54fc00c0a0bc30d8" \
|
|
-d '{
|
|
"external_id": "test-001",
|
|
"fiat_amount": 10.00,
|
|
"fiat_currency": "GBP",
|
|
"currency": "BTC",
|
|
"webhook_url": "https://admin.thebankofdebbie.giize.com/webhook"
|
|
}'
|
|
```
|
|
**Expected**: 200 OK with crypto_amount and payment_address
|
|
|
|
### Test 2: Container Connectivity
|
|
```bash
|
|
docker exec littleshop-admin curl http://silverpay-api:8000/health
|
|
```
|
|
**Expected**: {"status":"healthy"...}
|
|
|
|
### Test 3: TeleBot Order Flow
|
|
1. Message @Littleshop_tom_bot
|
|
2. Browse products and add to cart
|
|
3. Checkout - provides all address details in one message
|
|
4. Select payment method (BTC/ETH)
|
|
5. Receive payment address with converted crypto amount
|
|
|
|
## 🚀 Deployment Commands
|
|
|
|
### Working Docker Run Command (LittleShop Admin)
|
|
```bash
|
|
docker run -d \
|
|
--name littleshop-admin \
|
|
--restart unless-stopped \
|
|
--network littleshop-network \
|
|
-p 127.0.0.1:5100:8080 \
|
|
-v /opt/littleshop/data:/app/data \
|
|
-v /opt/littleshop/logs:/app/logs \
|
|
-v /opt/littleshop/uploads:/app/wwwroot/uploads \
|
|
-e ASPNETCORE_ENVIRONMENT=Production \
|
|
-e ASPNETCORE_URLS="http://+:8080" \
|
|
-e ConnectionStrings__DefaultConnection="Data Source=/app/data/littleshop-production.db" \
|
|
-e Jwt__Key="ThisIsAVeryLongSecretKeyThatIsDefinitelyLongerThan32BytesForSure123456789ABCDEF" \
|
|
-e SilverPay__BaseUrl="http://silverpay-api:8000" \
|
|
-e SilverPay__ApiKey="7703aa7a62fa4b40a87e9cfd867f5407147515c0986116ea54fc00c0a0bc30d8" \
|
|
-e SilverPay__WebhookSecret="Thefa1r1esd1d1twebhooks2024" \
|
|
littleshop:latest
|
|
```
|
|
|
|
### Restart All Services
|
|
```bash
|
|
# On Hostinger server (srv1002428.hstgr.cloud)
|
|
docker restart littleshop-admin
|
|
docker restart telebot
|
|
docker restart silverpay-api
|
|
```
|
|
|
|
### Check Status
|
|
```bash
|
|
docker ps --format "table {{.Names}}\t{{.Status}}" | grep -E "littleshop|telebot|silverpay"
|
|
```
|
|
|
|
### View Logs
|
|
```bash
|
|
docker logs --tail 50 littleshop-admin
|
|
docker logs --tail 50 telebot
|
|
docker logs --tail 50 silverpay-api
|
|
```
|
|
|
|
## 📝 Known Working Configuration
|
|
|
|
### Container Versions (as of Sept 24, 2024)
|
|
- **LittleShop**: Built from commit 7809b6e
|
|
- **TeleBot**: Built from commit 7809b6e
|
|
- **SilverPay**: localhost:5000/silverpay:latest
|
|
|
|
### Database
|
|
- **LittleShop**: SQLite at `/opt/littleshop/data/littleshop-production.db`
|
|
- **SilverPay**: PostgreSQL (silverpay-postgres container)
|
|
|
|
### File Permissions
|
|
- LittleShop data: owned by UID 1654
|
|
- TeleBot data: owned by UID 1001
|
|
- Use `chown -R [uid]:[uid] /path` to fix permission issues
|
|
|
|
## ⚠️ Critical Points to Remember
|
|
|
|
1. **Network Connectivity**: Containers must be on the same Docker network
|
|
2. **Field Names**: SilverPay expects `fiat_amount`, not `amount`
|
|
3. **CSRF Tokens**: All forms need `@Html.AntiForgeryToken()`
|
|
4. **Currency Display**: Shows GBP with conversion note for amounts > 1.0
|
|
5. **Checkout Flow**: Single message for address, not multi-step
|
|
|
|
## 🎉 System Capabilities
|
|
|
|
Users can now:
|
|
1. ✅ Browse products via TeleBot
|
|
2. ✅ Add items to cart
|
|
3. ✅ Complete checkout with single address entry
|
|
4. ✅ Select cryptocurrency for payment
|
|
5. ✅ Receive correct crypto amounts with live exchange rates
|
|
6. ✅ Get unique payment addresses for each order
|
|
7. ✅ Admin can manage orders through TeleShop Admin panel
|
|
8. ✅ View pending payments in dedicated tab
|
|
|
|
## 📅 Baseline Date: September 24, 2024, 20:15 UTC
|
|
|
|
All systems confirmed working at this timestamp. |