> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trymondo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Filepizza

## Overview

FilePizza is a browser-based, peer-to-peer file sharing service deployed as part of the Mondo Open Platform Service (MOPS). It allows users to share files directly between browsers using WebRTC technology, without storing files on a central server.

## Service Details

| Component | Value                                                    |
| --------- | -------------------------------------------------------- |
| URL       | [https://pizza.trymondo.com](https://pizza.trymondo.com) |
| Image     | kern/filepizza:latest                                    |
| Container | filepizza                                                |
| Port      | 3000 (internal)                                          |
| Network   | traefik-net (external)                                   |

## Architecture

FilePizza consists of a single container connected to the Traefik network:

```
[Client Browsers] <-- WebRTC P2P --> [Client Browsers]
         ↑                                   ↑
         |                                   |
         +-----------→ [FilePizza] ←---------+
                           ↑
                           |
                       [Traefik]
```

FilePizza acts as a WebRTC signaling server to establish direct peer connections, but the file data transfers directly between browsers.

## Deployment Configuration

### Docker Compose File

```yaml theme={null}
services:
  redis:
    image: redis:7.4.2
    container_name: redis
    restart: unless-stopped
    ports:
      - 127.0.0.1:6379:6379
    healthcheck:
      test: ['CMD', 'redis-cli', 'ping']
      interval: 30s
      timeout: 10s
      retries: 5
    networks:
      - filepizza-net
    volumes:
      - filepizza-redis-data:/data

  # coturn:
  #   image: coturn/coturn:4.6.3
  #   container_name: coturn
  #   restart: unless-stopped
  #   ports:
  #     - 3478:3478
  #     - 3478:3478/udp
  #     - 5349:5349
  #     - 5349:5349/udp
  #     - 60000-60128:60000-60128/udp
  #   environment:
  #     - DETECT_EXTERNAL_IP=yes
  #     - DETECT_RELAY_IP=yes
  #   command: -n --log-file=stdout --redis-userdb="ip=redis connect_timeout=30" --min-port=60000 --max-port=60128
  #   networks:
  #     - traefik-net
  #     - filepizza-net
  #   labels:
  #     - traefik.enable=true
  #     - traefik.http.routers.coturn.rule=Host(`coturn.trymondo.com`)
  #     - traefik.http.routers.coturn.entrypoints=websecure
  #     - traefik.http.routers.coturn.tls=true
  #     - traefik.http.routers.coturn.tls.certresolver=production
  #     - traefik.http.services.coturn.loadbalancer.server.port=3478

  filepizza:
    image: kern/filepizza:7e8650f
    container_name: filepizza
    restart: unless-stopped
    environment:
      - PORT=80
      - REDIS_URL=redis://redis:6379
      - COTURN_ENABLED=false
    networks:
      - traefik-net
      - filepizza-net
    depends_on:
      - redis
    labels:
      - traefik.enable=true
      - traefik.http.routers.filepizza.rule=Host(`pizza.trymondo.com`)
      - traefik.http.routers.filepizza.entrypoints=websecure
      - traefik.http.routers.filepizza.tls=true
      - traefik.http.routers.filepizza.tls.certresolver=production
      - traefik.http.services.filepizza.loadbalancer.server.port=80

networks:
  traefik-net:
    external: true
  filepizza-net:
    external: true

volumes:
  filepizza-redis-data:
```

## Deployment Instructions

1. Create the deployment directory:

   ```bash theme={null}
   mkdir -p /opt/apps/filepizza
   ```

2. Create the `docker-compose.yml` file with the content shown above:

   ```bash theme={null}
   nano /opt/apps/filepizza/docker-compose.yml
   ```

3. Deploy the service:

   ```bash theme={null}
   cd /opt/apps/filepizza
   docker compose up -d
   ```

4. Verify the service is running:
   ```bash theme={null}
   docker compose ps
   ```

## Traefik Integration

FilePizza is configured with the following Traefik settings:

* **Host Rule**: `pizza.trymondo.com`
* **Entrypoint**: websecure (HTTPS)
* **TLS**: Enabled with production certificate resolver
* **Backend Port**: 3000

## Usage

1. Access the service at `https://pizza.trymondo.com`
2. File senders can:
   * Select a file to share
   * Receive a unique URL to share with recipients
3. File recipients:
   * Open the shared URL
   * Download the file directly from the sender's browser

## Important Notes

<Warning>
  FilePizza requires WebRTC support in browsers. Some corporate firewalls or
  restrictive networks might block WebRTC connections.
</Warning>

<Note>
  FilePizza is a stateless application. No persistent volumes are needed as
  files are never stored on the server.
</Note>

## Resource Usage

FilePizza is a lightweight application with minimal resource requirements:

* **Memory**: Typically less than 100MB
* **CPU**: Minimal usage during idle periods, moderate during connection establishment

## Maintenance

### Updates

To update FilePizza to the latest version:

```bash theme={null}
cd /opt/apps/filepizza
docker compose pull
docker compose up -d
```

### Troubleshooting

If the service is inaccessible:

1. Check container status:

   ```bash theme={null}
   docker compose ps
   ```

2. View container logs:

   ```bash theme={null}
   docker compose logs
   ```

3. Verify Traefik routing:
   ```bash theme={null}
   curl -I -H "Host: pizza.trymondo.com" https://pizza.trymondo.com
   ```

## Security Considerations

* FilePizza doesn't store files, reducing data exposure risks
* All communications go through HTTPS via Traefik
* WebRTC connections are encrypted by default
* Consider adding Traefik middleware for additional security:
  ```yaml theme={null}
  - traefik.http.routers.filepizza.middlewares=secureHeaders@file
  ```

## Additional Resources

* [FilePizza GitHub Repository](https://github.com/kern/filepizza)
* [WebRTC Documentation](https://webrtc.org/)
