Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add resticprofile with ddev support #646

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions profiles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# yaml-language-server: $schema=https://creativeprojects.github.io/resticprofile/jsonschema/config-1.json

version: "1"

groups:
ddev:
- ddev-db
- ddev-files

default:
repository: "s3:blr1.digitaloceanspaces.com/axl-backup-contrib-tracker/{{ .Profile.Name }}"
insecure-no-password: true
Kalaiselvan88 marked this conversation as resolved.
Show resolved Hide resolved
backup:
source-relative: true

run-before:
- 'echo "AWS_ACCESS_KEY_ID=$(op read "op://Platform Engineering/Contrib Tracker S3 Backup/username")" >> "{{env}}"'
- 'echo "AWS_SECRET_ACCESS_KEY=$(op read "op://Platform Engineering/Contrib Tracker S3 Backup/credential")" >> "{{env}}"'

env:
TMPDIR: /tmp

# We need to have two profiles: one for db and other for files.
# This is because the paths are different for both.
# And we want to use `delete` with the files profile.
# Setting `delete` on a base path will delete everything
# in that directory. The common base directory here is
# the project directory and using `delete` for this will
# delete all the source files, not just the ones backed up.
ddev-db:
inherit: default
backup:
run-before:
- mkdir -p .ddev/.downloads
- ddev export-db --file=.ddev/.downloads/db-{{ .Profile.Name }}.sql.gz
run-after:
- rm .ddev/.downloads/db-{{ .Profile.Name }}.sql.gz
source-base: "{{ .ConfigDir }}"
source:
- ".ddev/.downloads/db-{{ .Profile.Name }}.sql.gz"

restore:
target: "{{ .ConfigDir }}"
run-after:
- ddev import-db --file=.ddev/.downloads/db-{{ .Profile.Name }}.sql.gz
- rm .ddev/.downloads/db-{{ .Profile.Name }}.sql.gz

ddev-files:
Kalaiselvan88 marked this conversation as resolved.
Show resolved Hide resolved
inherit: default
backup:
source-base: "{{ .ConfigDir }}/web/sites/default/files"
source: "."

restore:
delete: true
target: "{{ .ConfigDir }}/web/sites/default/files"

# TODO: Sections for platform (just backup) and platform-to-ddev (special case)
Loading