# Homepage: one service card

LLMS index: [llms.txt](/en/llms.txt)

---

Homelab homepages often turn into crowded link lists, making quick service access a real problem. This note covers surfacing a single service card with docker-compose, health checks and a minimal config. Exact command set, common traps and a verification workflow follow.

## Why one card

For a lone service a full dashboard (homer, UptimeKuma, CasaOS) adds unnecessary resource overhead and extra entry points. One card gives:
- Instant access from any point on the network
- Configuration kept inside a single compose file
- No extra agents required for one container

In practice Lead DevOps teams use this pattern for internal tools, databases or APIs reachable from the network but where spinning up full monitoring isn't justified.

> [!TIP]
> If you need a list of several services consider homer or similar, but for a single instance a minimal compose + static card file is more reliable and lighter on memory.

## Preparing the compose file

Create a minimal `docker-compose.yml` for a Python service (FastAPI example, any container image works). The file lives in `~/service-card/`:

```yaml
version: "3.9"
services:
  app:
    image: python:3.11-slim
    container_name: service-card
    restart: unless-stopped
    ports:
      - "8080:8000"
    environment:
      - PYTHONUNBUFFERED=1
    volumes:
      - ./app:/app
    working_dir: /app
    command: ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/health"] || exit 1
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
```

Apply the configuration:

```bash
cd ~/service-card
docker compose up -d --build
```

> [!NOTE]
> The `--build` flag rebuilds the image when code changes. On a plain start `docker compose up -d` is sufficient.

Check status:

```bash
docker compose ps
# Expected: UP service-card (healthy)
```

## Config and paths setup

To make the card on the homepage point to the right address, set `href` in the local `config.yaml` (or equivalent). Example structure:

```yaml
service_card:
  name: "My API"
  href: "http://192.168.1.50:8080"
  description: "FastAPI service for internal tasks"
```

Here `href` is built from the host and port defined in `compose` (`8080` maps to internal `8000`). If the host changes, just update the address in the config – the container keeps running without restart.

> [!WARNING]
> A common mistake is setting `href` to a port already occupied by another container on the host. Before changing check `docker compose port app 8000` and confirm the external port is free.

Mount the config into the container if needed:

```yaml
volumes:
  - ./config.yaml:/app/config.yaml:ro
```

After changes restart the service:

```bash
docker compose restart app
```

## Workability check scenario

After the service comes up verify accessibility with `curl` and the health check:

```bash
# Direct request
curl -s http://192.168.1.50:8080/health
# Expected: {"status":"ok"}

# Through docker compose
docker compose exec app curl -s http://localhost:8000/health

# Real-time logs
docker compose logs -f app
```

If the healthy flag in `docker compose ps` shows `healthy` the check passed. Otherwise proceed to typical failure diagnostics.

## Typical breakdown solution

The following table lists three frequent failure scenarios and their resolution:

| Problem | Cause | Fix |
|---|---|---|
| Port `8080` already used by another container | Port mapping conflict on the host | `docker compose down` → change `ports` in `compose.yml` to a free port (e.g., `8081`) → `docker compose up -d` |
| `curl` returns `Connection refused` | Container failed to start or crashed | `docker compose logs app` → fix `command` or `environment` error → `docker compose up -d --force-recreate app` |
| Health check times out | Service starts slowly or `/health` endpoint missing | Increase `start_period` in `healthcheck` or replace with `curl -f http://localhost:8000/docs` if docs are available |

> [!WARNING]
| If after fixing the port the service won't start, check volume permissions with `chown -R 1000:1000 ./app` (replace UID/GID as needed) and repeat `docker compose up -d`. |

## Conclusion and findings

A single-service card built on docker-compose offers a controlled, lightweight way to reach the exact application without extra functionality. Key benefits:

- Full state resides in repo files (`compose.yml`, `config.yaml`, app code)
- Service health is auto-checked via the built-in `healthcheck`
- Typical issues (port conflicts, env mistakes, permission errors) get resolved in one or two commands, no image rebuild needed
- `href` in the external config lets you change the entry point without rebuilding the container

For homelab projects where response speed and minimal resource use matter, this approach wins over heavy dashboards. Should more services be required later the same `compose` file can be extended while keeping structure and check logic intact.
