Establish clean homelab infrastructure baseline
Reorganize the brownfield repository, remove retired and generated artifacts, harden ignore rules, and record the GitOps/IaC redesign.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
FROM pytorch/pytorch:2.5.1-cuda12.1-cudnn9-runtime
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
TORCH_DEVICE=cuda
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
poppler-utils \
|
||||
libgl1 \
|
||||
libglib2.0-0 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN pip install --upgrade pip && \
|
||||
pip install marker-pdf fastapi uvicorn python-multipart
|
||||
|
||||
EXPOSE 8001
|
||||
|
||||
CMD ["marker_server", "--port", "8001"]
|
||||
@@ -0,0 +1,35 @@
|
||||
# Marker (GPU service)
|
||||
|
||||
**Goal**
|
||||
- Run `marker` locally on the NVIDIA GPU and expose its API in Kubernetes.
|
||||
- Keep the pod single-replica and single-worker so it fits in 4 GB VRAM.
|
||||
|
||||
**Resources**
|
||||
| File | Description |
|
||||
| --- | --- |
|
||||
| `Dockerfile` | CUDA-based image built from `pytorch/pytorch` and `marker-pdf`. |
|
||||
| `deployment.yaml` | Single GPU-backed `Deployment` for `marker_server`. |
|
||||
| `service.yaml` | ClusterIP service on port 8001. |
|
||||
|
||||
**How to use**
|
||||
1. Build and push the image:
|
||||
```bash
|
||||
docker build -t <your-registry>/marker:latest ~/services/apps/marker
|
||||
docker push <your-registry>/marker:latest
|
||||
```
|
||||
2. Update `deployment.yaml` with that image tag.
|
||||
3. Apply the manifests:
|
||||
```bash
|
||||
kubectl apply -f ~/services/apps/marker/deployment.yaml
|
||||
kubectl apply -f ~/services/apps/marker/service.yaml
|
||||
```
|
||||
4. Check the pod is using the GPU:
|
||||
```bash
|
||||
kubectl logs deploy/marker
|
||||
kubectl exec -it deploy/marker -- nvidia-smi
|
||||
```
|
||||
|
||||
**Notes**
|
||||
- No PVC is used; the container only needs ephemeral storage.
|
||||
- Keep `replicas: 1` and avoid concurrent jobs on this 4 GB card.
|
||||
- If the server needs an explicit bind address in your build, change the container args to `0.0.0.0:8001` equivalent for `marker_server`.
|
||||
@@ -0,0 +1,52 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: marker
|
||||
namespace: default
|
||||
labels:
|
||||
app: marker
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: marker
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: marker
|
||||
spec:
|
||||
containers:
|
||||
- name: marker
|
||||
image: <your-registry>/marker:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- marker_server
|
||||
args:
|
||||
- --port
|
||||
- "8001"
|
||||
env:
|
||||
- name: TORCH_DEVICE
|
||||
value: cuda
|
||||
- name: PYTHONUNBUFFERED
|
||||
value: "1"
|
||||
ports:
|
||||
- containerPort: 8001
|
||||
resources:
|
||||
requests:
|
||||
cpu: "1"
|
||||
memory: 2Gi
|
||||
nvidia.com/gpu: "1"
|
||||
limits:
|
||||
cpu: "2"
|
||||
memory: 4Gi
|
||||
nvidia.com/gpu: "1"
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: 8001
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: 8001
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 20
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: marker
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
app: marker
|
||||
ports:
|
||||
- name: http
|
||||
port: 8001
|
||||
targetPort: 8001
|
||||
Reference in New Issue
Block a user