fava service
This commit is contained in:
137
fava/fava.yaml
Normal file
137
fava/fava.yaml
Normal file
@@ -0,0 +1,137 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: fava
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: fava-data
|
||||
namespace: fava
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: fava-init-script
|
||||
namespace: fava
|
||||
data:
|
||||
init.sh: |
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Clone or update the repository
|
||||
if [ ! -d "/data/contabilitat/.git" ]; then
|
||||
echo "Cloning repository..."
|
||||
git clone https://${GITEA_USERNAME}:${GITEA_PASSWORD}@gitea.gitea.svc.cluster.local:3000/${GITEA_USERNAME}/contabilitat.git /data/contabilitat
|
||||
else
|
||||
echo "Repository exists, pulling latest changes..."
|
||||
cd /data/contabilitat
|
||||
git pull
|
||||
fi
|
||||
|
||||
echo "Repository ready at /data/contabilitat"
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: fava
|
||||
namespace: fava
|
||||
labels:
|
||||
app: fava
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: fava
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: fava
|
||||
spec:
|
||||
initContainers:
|
||||
- name: git-sync
|
||||
image: alpine/git:latest
|
||||
command: ["/bin/sh", "/scripts/init.sh"]
|
||||
env:
|
||||
- name: GITEA_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-credentials
|
||||
key: username
|
||||
- name: GITEA_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-credentials
|
||||
key: password
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
- name: init-script
|
||||
mountPath: /scripts
|
||||
containers:
|
||||
- name: fava
|
||||
image: yegle/fava:latest
|
||||
args:
|
||||
- "/data/contabilitat/main.beancount"
|
||||
- "-H"
|
||||
- "0.0.0.0"
|
||||
- "-p"
|
||||
- "5000"
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
name: http
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 5000
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 5000
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: fava-data
|
||||
- name: init-script
|
||||
configMap:
|
||||
name: fava-init-script
|
||||
defaultMode: 0755
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: fava-service
|
||||
namespace: fava
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: fava
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 5000
|
||||
Reference in New Issue
Block a user