> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 5. Deploy Ayakaleaf Pro

> Deploy pod Ayakaleaf Pro, volume datanya, dan Service NodePort.

```yaml title="40-overleaf.yaml" wrap theme={null}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: overleaf-data
  namespace: overleaf
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 20Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: overleaf
  namespace: overleaf
spec:
  replicas: 1
  strategy:
    type: Recreate          # one pod owns the data volume; never run two at once
  selector:
    matchLabels:
      app: overleaf
  template:
    metadata:
      labels:
        app: overleaf
    spec:
      terminationGracePeriodSeconds: 60   # time to flush pending edits, like the Toolkit
      # Keep the environment to what the ConfigMap and Secret set: no REDIS_PORT=tcp://... and the like
      enableServiceLinks: false
      containers:
        - name: sharelatex
          image: ghcr.io/ayaka-notes/overleaf-pro:6.3.2
          envFrom:
            - configMapRef:
                name: overleaf-env
            - secretRef:
                name: overleaf-secrets
          ports:
            - containerPort: 80
          readinessProbe:
            httpGet:
              path: /status
              port: 80
            periodSeconds: 10
          resources:
            requests:
              cpu: 500m
              memory: 1536Mi
            limits:
              memory: 3Gi
          volumeMounts:
            - name: data
              mountPath: /var/lib/overleaf
            - name: compiles
              mountPath: /var/lib/overleaf/data/compiles
            - name: output
              mountPath: /var/lib/overleaf/data/output
            - name: cache
              mountPath: /var/lib/overleaf/data/cache
            - name: docker-sock
              mountPath: /var/run/docker.sock
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: overleaf-data
        # Compile scratch space on the node; same paths as SANDBOXED_COMPILES_HOST_DIR_*
        - name: compiles
          hostPath:
            path: /srv/overleaf/compiles
            type: DirectoryOrCreate
        - name: output
          hostPath:
            path: /srv/overleaf/output
            type: DirectoryOrCreate
        - name: cache
          hostPath:
            path: /srv/overleaf/cache
            type: DirectoryOrCreate
        - name: docker-sock
          hostPath:
            path: /var/run/docker.sock
            type: Socket
---
apiVersion: v1
kind: Service
metadata:
  name: overleaf
  namespace: overleaf
spec:
  type: NodePort
  selector:
    app: overleaf
  ports:
    - name: http
      port: 80
      targetPort: 80
      nodePort: 30080
```

```bash theme={null}
kubectl apply -f 40-overleaf.yaml
kubectl -n overleaf rollout status deployment/overleaf --timeout=10m
kubectl -n overleaf logs deployment/overleaf | grep -E 'Finished migrations|Missing required'
```

Start pertama menjalankan migrasi database dan memakan waktu satu atau dua menit. Pod siap saat `/status` merespons; kemudian buka `OVERLEAF_SITE_URL`.

### Mengapa manifest-nya seperti ini

* **Volume data.** Semua yang ada di bawah `/var/lib/overleaf` (file proyek, riwayat, unggahan) berada di PVC. Data tetap berada di satu node dengan penyimpanan lokal node seperti local-path; dengan block storage jaringan, pod dapat berpindah antar node.
* **Volume kompilasi dan socket Docker.** Ayakaleaf Pro meminta Docker milik node untuk memulai kontainer TeX Live dan memberikan direktori kompilasi proyek **melalui path-nya di node**. Oleh karena itu direktori-direktori ini adalah volume `hostPath`, dan path-nya diulang di `SANDBOXED_COMPILES_HOST_DIR_*`. Isinya adalah data sementara dan tidak perlu dicadangkan.
* **`enableServiceLinks: false`.** Kubernetes menambahkan variabel bergaya Docker untuk setiap Service di namespace ke setiap pod: Service `redis` menjadi `REDIS_PORT=tcp://10.x.x.x:6379`, Service `git-bridge` menjadi `GIT_BRIDGE_PORT=tcp://...`. Beberapa layanan Overleaf membaca variabel dengan nama-nama ini. Di pod ini pengaturan dari `OVERLEAF_REDIS_*` dan ConfigMap yang berlaku, tetapi git-bridge menganggap `GIT_BRIDGE_PORT` sebagai port-nya dan berhenti (lihat [integrasi Git](https://ayakaleaf-pro.mintlify.site/id/on-premises/configuration/kubernetes/integrations/git-integration.md)). Menonaktifkan link ini membatasi lingkungan hanya pada apa yang Anda atur.
* **`Recreate`.** Dua pod tidak boleh menggunakan volume data yang sama atau menjalankan migrasi pada saat yang sama.
* **Mengeksposnya.** Service NodePort merespons di port `30080` pada setiap node. Di produksi, tempatkan ingress controller atau load balancer Anda di depannya dan akhiri TLS di sana; komponen tersebut harus mengizinkan WebSocket, batas waktu permintaan 10 menit (kompilasi panjang), dan unggahan sebesar 50 MB, serta meneruskan `X-Forwarded-For` dan `X-Forwarded-Proto`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.