# rsyncd

Simple rsync server running in a Docker container.

Image: `harbor.lan/tools/rsyncd:latest`

## Usage modes

### 1. Custom config (mount rsyncd.conf)

If `/etc/rsyncd.conf` is mounted, the container uses it as-is — no env vars needed.

```yaml
services:
  rsyncd:
    image: harbor.lan/tools/rsyncd:latest
    ports:
      - "873:873"
    volumes:
      - ./rsyncd.conf:/etc/rsyncd.conf:ro
      - /srv/backup:/data
```

### 2. Multiple modules via env vars

Modules are defined via `MODULE_1_*`, `MODULE_2_*`, `MODULE_3_*` etc. — add as many as needed, as long as the numbering is consecutive.

```yaml
services:
  rsyncd:
    image: harbor.lan/tools/rsyncd:latest
    ports:
      - "873:873"
    environment:
      - ALLOW=10.0.0.0/8
      - MODULE_1_NAME=backup
      - MODULE_1_PATH=/data/backup
      - MODULE_2_NAME=media
      - MODULE_2_PATH=/data/media
      - MODULE_2_ALLOW=192.168.1.0/24
    volumes:
      - /srv/backup:/data/backup
      - /srv/media:/data/media
```

### 3. Single module (simple)

```yaml
services:
  rsyncd:
    image: harbor.lan/tools/rsyncd:latest
    ports:
      - "873:873"
    environment:
      - VOLUME=backup
      - ALLOW=10.0.0.0/8
      - OWNER=1000
      - GROUP=1000
    volumes:
      - /srv/backup:/volume
```

## Environment variables

| Variable | Default | Description |
|---|---|---|
| `VOLUME` | `volume` | Module name (single-module mode) |
| `ALLOW` | `192.168.0.0/16 172.16.0.0/12` | Allowed IP ranges (global default) |
| `OWNER` | `nobody` | UID for created files |
| `GROUP` | `nogroup` | GID for created files |
| `MODULE_x_NAME` | — | Module name (multi-module mode) |
| `MODULE_x_PATH` | `/volume_x` | Path for module x |
| `MODULE_x_ALLOW` | `$ALLOW` | Allowed IPs for module x |
