# 🚀 LittleShop Portainer Deployment Steps

## Immediate Actions Required

### Step 1: Access Portainer
1. Open browser and go to: `http://10.0.0.51:9000`
2. Login with:
   - Username: `sysadmin`
   - Password: `Phenom12#.`

### Step 2: Create New Stack
1. Click **Stacks** in the left sidebar
2. Click **Add stack** button
3. Configure:
   - **Name**: `littleshop`
   - **Build method**: Web editor

### Step 3: Copy Docker Compose Configuration
Copy this exact content into the web editor:

```yaml
version: '3.8'

services:
  littleshop:
    build: .
    image: littleshop:latest
    container_name: littleshop
    restart: unless-stopped
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_URLS=http://+:8080
      - JWT_SECRET_KEY=${JWT_SECRET_KEY:-YourSuperSecretKeyThatIsAtLeast32CharactersLong!}
      - BTCPAY_SERVER_URL=${BTCPAY_SERVER_URL:-}
      - BTCPAY_STORE_ID=${BTCPAY_STORE_ID:-}
      - BTCPAY_API_KEY=${BTCPAY_API_KEY:-}
      - BTCPAY_WEBHOOK_SECRET=${BTCPAY_WEBHOOK_SECRET:-}
    volumes:
      - littleshop_data:/app/data
      - littleshop_uploads:/app/wwwroot/uploads
      - littleshop_logs:/app/logs
    networks:
      - traefik
      - default
    labels:
      # Traefik configuration
      - "traefik.enable=true"
      - "traefik.docker.network=traefik"
      
      # HTTP Router
      - "traefik.http.routers.littleshop.rule=Host(`littleshop.silverlabs.uk`)"
      - "traefik.http.routers.littleshop.entrypoints=websecure"
      - "traefik.http.routers.littleshop.tls=true"
      - "traefik.http.routers.littleshop.tls.certresolver=letsencrypt"
      
      # Service
      - "traefik.http.services.littleshop.loadbalancer.server.port=8080"
      
      # Middleware for forwarded headers
      - "traefik.http.routers.littleshop.middlewares=littleshop-headers"
      - "traefik.http.middlewares.littleshop-headers.headers.customrequestheaders.X-Forwarded-Proto=https"
      - "traefik.http.middlewares.littleshop-headers.headers.customrequestheaders.X-Forwarded-Host=littleshop.silverlabs.uk"

volumes:
  littleshop_data:
    driver: local
  littleshop_uploads:
    driver: local
  littleshop_logs:
    driver: local

networks:
  traefik:
    external: true
  default:
    driver: bridge
```

### Step 4: Add Environment Variables
In the **Environment variables** section, add:

| Name | Value |
|------|-------|
| `JWT_SECRET_KEY` | `YourSuperSecretKeyThatIsAtLeast32CharactersLong!` |
| `BTCPAY_SERVER_URL` | *(Leave empty for now)* |
| `BTCPAY_STORE_ID` | *(Leave empty for now)* |
| `BTCPAY_API_KEY` | *(Leave empty for now)* |
| `BTCPAY_WEBHOOK_SECRET` | *(Leave empty for now)* |

### Step 5: Upload Source Code
**⚠️ IMPORTANT**: You need to upload the LittleShop source code to the server.

**Option A - Git Repository** (Recommended):
1. In Stack configuration, choose **Repository** instead of **Web editor**
2. Enter your Git repository URL
3. Set Compose path: `docker-compose.yml`

**Option B - Manual Upload**:
1. Zip the entire LittleShop folder
2. Upload via Portainer's file manager to `/opt/stacks/littleshop/`

### Step 6: Deploy
1. Click **Deploy the stack**
2. Wait for the build and deployment to complete

### Step 7: Verify Deployment
1. Go to **Containers** to see the running `littleshop` container
2. Check logs for any errors
3. Visit `https://littleshop.silverlabs.uk`

### Step 8: Initial Setup
1. Go to `https://littleshop.silverlabs.uk/Admin`
2. Login with: `admin` / `admin`
3. **IMMEDIATELY** change the password
4. Configure your shop (categories, products, etc.)

## Troubleshooting

### Build Issues
- Ensure source code is properly uploaded
- Check container logs in Portainer
- Verify all files are present in the build context

### SSL Certificate Issues
- Ensure DNS `littleshop.silverlabs.uk` points to your Traefik server
- Check Traefik logs for Let's Encrypt errors
- Verify `traefik` network exists

### Application Errors
- Check container logs in Portainer
- Verify environment variables are set correctly
- Ensure volumes are properly mounted

## Success Indicators
- ✅ Container status: **Running**
- ✅ Application accessible at: `https://littleshop.silverlabs.uk`
- ✅ Admin panel accessible at: `https://littleshop.silverlabs.uk/Admin`
- ✅ SSL certificate valid
- ✅ Database initialized with default admin user

---
**Ready to deploy!** 🚀