Skip to content

Commit

Permalink
backup and uid
Browse files Browse the repository at this point in the history
  • Loading branch information
james-otten committed Aug 8, 2024
1 parent ed10248 commit 9e61f3f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
20 changes: 18 additions & 2 deletions bookstack-helm/templates/backupscript.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,23 @@ data:
mysqldump -h "$DB_HOST" -u "$DB_USER" --password="$DB_PASS" "$DB_DATABASE" > wiki.sql
echo "Creating tarball"
backup_name="wiki_backup_$(date +%s).tar.gz"
tar -chzvf $backup_name wiki.sql /app/www/public/uploads/ /app/www/storage/uploads/
tar -chzvf $backup_name wiki.sql /app/www/public/uploads/ /app/www/storage/uploads/ /app/www/public/img/
echo "push to s3"
apk add aws-cli
aws s3 cp ./$backup_name "$BACKUP_S3_URL"
aws s3 cp ./$backup_name "$BACKUP_S3_URL"
echo "done"
restore.sh: |
echo "Checking if restore is needed"
echo "Restore file is: $RESTORE_S3_URL"
if [ ! -n "$RESTORE_S3_URL" ]; then
echo "Restoring from $RESTORE_S3_URL"
apk add aws-cli
aws s3 cp "$RESTORE_S3_URL" /tmp/restore.tgz
echo "downloaded tarball"
tar -xzf /tmp/restore.tgz -C /
echo "Files restored"
mysql -h "$DB_HOST" -u "$DB_USER" --password="$DB_PASS" < /wiki.sql
else
echo "Not restoring"
fi
echo "done"
10 changes: 10 additions & 0 deletions bookstack-helm/templates/bookstack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ spec:
configMapKeyRef:
name: wikiconfig
key: TZ
- name: PUID
valueFrom:
configMapKeyRef:
name: wikiconfig
key: PUID
- name: PGID
valueFrom:
configMapKeyRef:
name: wikiconfig
key: PGID
- name: APP_URL
valueFrom:
configMapKeyRef:
Expand Down
2 changes: 2 additions & 0 deletions bookstack-helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
namespace: {{ .Values.meshwiki_app_namespace }}
data:
APP_URL: https://{{ .Values.bookstack.fqdn }}
PUID: {{ .Values.bookstack.uid | quote }}
PGID: {{ .Values.bookstack.gid | quote }}
DB_HOST: {{ include "bookstack-helm.fullname" . }}-db.{{ .Values.meshwiki_app_namespace }}.svc.cluster.local
DB_DATABASE: {{ .Values.bookstack.db.database_name | quote }}
TZ: {{ .Values.timezone | quote }}
Expand Down
2 changes: 2 additions & 0 deletions bookstack-helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ bookstack:
app_views_books: list
allowed_iframe_sources: "https://*.draw.io https://*.youtube.com https://*.youtube-nocookie.com https://*.vimeo.com https://*.google.com"
port: 80
uid: 1000
gid: 1000
db:
database_name: bookstackapp
pvc_name: wikidb
Expand Down

0 comments on commit 9e61f3f

Please sign in to comment.