add new versions

This commit is contained in:
2024-10-23 15:21:55 +01:00
parent d663cdb266
commit 236dc62bc9
12 changed files with 207 additions and 74 deletions
@@ -1,14 +0,0 @@
apiVersion: v1
data:
export_calendar.sh: |
#!/usr/bin/env bash
apk update
apk add curl
list='capgemini birmingham cesi papa blueberry personal-1 prometheus birthday maman capgemini_ca-gip shared_shared_by_calendar_sync'
for element in $list;do
curl -u $PI_USER_USERNAME:$PI_USER_PASSWORD https://nextcloud.tryton.geeraert.eu/remote.php/dav/calendars/pi/$element/\?export -o /backup/calendar_$element.ics
done
#curl -u $PI_USER_USERNAME:$PI_USER_PASSWORD https://nextcloud.tryton.geeraert.eu/remote.php/dav/calendars/pi/capgemini_ca-gip/\?export -o /backup/calendar.ics
kind: ConfigMap
metadata:
name: nextcloud-calendar-export-script
+11 -6
View File
@@ -21,19 +21,24 @@ spec:
secretKeyRef:
name: nextcloud-credentials
key: PI_USER_PASSWORD
command: ["/bin/sh","/config/export_calendar.sh"]
command: ["/bin/sh","/config/export_notes.sh"]
volumeMounts:
- name: calendar
- name: nextcloud-webserver
mountPath: /var/www/html
- name: notes
mountPath: /backup
- name: scripts
mountPath: /config
volumes:
- name: calendar
- name: notes
persistentVolumeClaim:
claimName: calendar
claimName: notes
- name: nextcloud-webserver
persistentVolumeClaim:
claimName: nextcloud-webserver
- name: scripts
configMap:
name: nextcloud-calendar-export-script
name: nextcloud-export-scripts
defaultMode: 0555
restartPolicy: Never
backoffLimit: 4
@@ -41,7 +46,7 @@ spec:
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: calendar
name: notes
namespace: nextcloud
spec:
storageClassName: nfs-backup-storage-intelligent
@@ -1,53 +0,0 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: nextcloud-contact-backup
namespace: nextcloud
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- name: contact-backup
image: alpine/curl
env:
- name: PI_USER_USERNAME
valueFrom:
secretKeyRef:
name: nextcloud-credentials
key: PI_USER_USERNAME
- name: PI_USER_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-credentials
key: PI_USER_PASSWORD
args:
- -u
- $(PI_USER_USERNAME):$(PI_USER_PASSWORD)
- https://nextcloud.tryton.geeraert.eu/remote.php/dav/addressbooks/users/pi/contacts/?export
- -o
- /backup/contact.vcf
volumeMounts:
- name: contact
mountPath: /backup
volumes:
- name: contact
persistentVolumeClaim:
claimName: contact
restartPolicy: Never
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: contact
namespace: nextcloud
spec:
storageClassName: nfs-backup-storage-intelligent
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
@@ -17,6 +17,13 @@ data:
today_date=$(date "+%Y-%m-%d")
mkdir /backup/$today_date
curl -u $PI_USER_USERNAME:$PI_USER_PASSWORD https://nextcloud.tryton.geeraert.eu/remote.php/dav/addressbooks/users/pi/contacts/?export -o /backup/$today_date/contact_$today_date.vcf
export_notes.sh: |
#!/usr/bin/env bash
today_date=$(date "+%Y-%m-%d")
mkdir /backup/$today_date
cp /var/www/html/data/pi/files/Notes/*.md /backup/$today_date/
# curl -u $PI_USER_USERNAME:$PI_USER_PASSWORD https://nextcloud.tryton.geeraert.eu/remote.php/dav/addressbooks/users/pi/contacts/?export -o /backup/$today_date/contact_$today_date.vcf
kind: ConfigMap
metadata:
creationTimestamp: null
@@ -83,9 +83,12 @@ spec:
- name: paperless-export
persistentVolumeClaim:
claimName: paperless-export
# - name: documents
# persistentVolumeClaim:
# claimName: documents
- name: documents
persistentVolumeClaim:
claimName: documents
claimName: paperless-documents-backup
restartPolicy: Never
---
@@ -101,3 +104,18 @@ spec:
resources:
requests:
storage: 10Gi
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: paperless-documents-backup
namespace: paperless
annotations:
fileType: Backup
spec:
storageClassName: nfs-storage-fastaccess
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
+18
View File
@@ -0,0 +1,18 @@
FROM debian
WORKDIR /usr/src/app
#COPY requirements.txt ./
#RUN pip install --no-cache-dir -r requirements.txt
RUN apt -y update
RUN apt -y install npm
RUN npm -y install -g @bitwarden/cli
RUN export BW_key=$(bw login valvankart@orange.fr Impreza555 --raw)
#COPY . .
#RUN echo "nameserver 8.8.8.8" >> /etc/resolv.conf
#CMD [ "python", "./nextcloud_ics_sync.py",">>","/var/log/nextcloud-ics-sync.log"]
CMD [ "sleep","3600" ]
#CMD echo "==================================================================================" >> /var/log/nextcloud-ics-sync.log 2>&1 ; echo $(date) >> /var/log/nextcloud-ics-sync.log 2>&1 ; python ./nextcloud_ics_sync.py >> /var/log/nextcloud-ics-sync.log 2>&1 ; echo "==================================================================================" >> /var/log/nextcloud-ics-sync.log 2>&1
@@ -0,0 +1,11 @@
apiVersion: v1
data:
export_bitwarden.sh: |
#!/usr/bin/env bash
bw config server https://bitwarden.tryton.geeraert.eu/
export BW_key=$(bw login valvankart@orange.fr Impreza555 --raw)
bw list items --session $BW_key >> /tmp/backup.json
kind: ConfigMap
metadata:
creationTimestamp: null
name: bitwarden-export-scripts
+26
View File
@@ -0,0 +1,26 @@
FROM debian
WORKDIR /usr/src/app
#COPY requirements.txt ./
#RUN pip install --no-cache-dir -r requirements.txt
RUN apt -y update
RUN apt -y update && apt install -y curl unzip libsecret-1-0 jq
RUN export VER=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/bitwarden/clients/releases | jq -r .[4].name | sed 's:.*v::') && \
curl -LO "https://github.com/bitwarden/clients/releases/download/cli-v{$VER}/bw-linux-{$VER}.zip" \
&& unzip bw-linux-*.zip && chmod +x ./bw
RUN rm bw-linux-*.zip
RUN mv /bw /usr/local/bin
RUN bw --version
#COPY . .
#RUN echo "nameserver 8.8.8.8" >> /etc/resolv.conf
#CMD [ "python", "./nextcloud_ics_sync.py",">>","/var/log/nextcloud-ics-sync.log"]
CMD [ "sleep","3600" ]
#CMD echo "==================================================================================" >> /var/log/nextcloud-ics-sync.log 2>&1 ; echo $(date) >> /var/log/nextcloud-ics-sync.log 2>&1 ; python ./nextcloud_ics_sync.py >> /var/log/nextcloud-ics-sync.log 2>&1 ; echo "==================================================================================" >> /var/log/nextcloud-ics-sync.log 2>&1
+32
View File
@@ -0,0 +1,32 @@
apiVersion: v1
kind: Namespace
metadata:
name: bwbackup
---
apiVersion: v1
kind: Pod
metadata:
name: debian
namespace: bwbackup
spec:
containers:
# - image: localhost:31795/bitwarden_cli
- image: gitea.tryton.geeraert.eu/pi-ux-ce/bitwarden_cli:1.0.0
command:
- /bin/sh
- "-c"
# - "apt update && apt install -y curl unzip libsecret-1-0 jq"
# - "export VER=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/bitwarden/clients/releases | jq -r .[4].name | sed 's:.*v::') && curl -LO "https://github.com/bitwarden/clients/releases/download/cli-v{$VER}/bw-linux-{$VER}.zip" && unzip bw-linux-*.zip && chmod +x ./bw "
# - "mv /bw /usr/local/bin"
- "sleep 60m"
volumeMounts:
- name: scripts
mountPath: /config
imagePullPolicy: IfNotPresent
name: debian
restartPolicy: Always
volumes:
- name: scripts
configMap:
name: bitwarden-export-scripts
defaultMode: 0555
+25
View File
@@ -0,0 +1,25 @@
FROM vaultwarden/server:latest
RUN apt update && apt install -y curl unzip libsecret-1-0 jq
RUN export VER=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/bitwarden/clients/releases | jq -r .[4].name | sed 's:.*v::') && \
curl -LO "https://github.com/bitwarden/clients/releases/download/cli-v{$VER}/bw-linux-{$VER}.zip" \
&& unzip bw-linux-*.zip && chmod +x ./bw
RUN rm bw-linux-*.zip
RUN mv /bw /usr/local/bin
RUN bw --version
https://www.reddit.com/r/Bitwarden/comments/xhir0q/how_to_install_bw_cli_in_docker/
$sessionkey = bw login valvankart@orange.fr Impreza555 --raw
/bin/sh: 37: =: not found
# export BW_key=$(bw login valvankart@orange.fr Impreza555 --raw)
# echo $BW_key
Q8lQlXFuQKxxYz5UXr+JcU1oM7F53S6AkmTnPFEh5+I2khV1w77hBaDUGvsHcbdqH+tIUEE+r5FZboVNyHMgNg==
# bw list items --session $BW_key
+57
View File
@@ -0,0 +1,57 @@
apiVersion: v1
kind: Namespace
metadata:
name: bwbackup
---
apiVersion: v1
kind: Pod
metadata:
name: node
namespace: bwbackup
spec:
containers:
- image: node:22-alpine
command:
# - "npm install -g @bitwarden/cli@1.0.1"
- "/bin/sh"
- "-c"
- "sleep 60m"
imagePullPolicy: IfNotPresent
name: alpine
restartPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: node
namespace: bwbackup
spec:
replicas: 1
selector:
matchLabels:
app: node
template:
metadata:
labels:
app: node
spec:
hostNetwork: false
containers:
- name: node-d
image: node:22-alpine
imagePullPolicy: Always
command:
# - "npm install -g @bitwarden/cli@1.0.1"
- "/bin/sh"
- "-c"
- "sleep 60m"
securityContext:
# sysctls:
# - name: net.ipv4.conf.all.src_valid_mark
# value: "1"
# - name: net.ipv6.conf.all.disable_ipv6
# value: "1"
privileged: true
capabilities:
add: ["NET_ADMIN", "NET_RAW"]
File diff suppressed because one or more lines are too long