-
-
Notifications
You must be signed in to change notification settings - Fork 595
/
rsync.yaml.example
64 lines (55 loc) · 2.44 KB
/
rsync.yaml.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ddev-generated
# Example rsync provider configuration.
# This will pull a database and files from a network location, for example,
# server or other jumphost. It operates inside the web container and uses
# ssh, so you need to `ddev auth ssh` first.
# To use this configuration,
#
# 1. You need a database dump and/or user-generated files tarball that you
# have access to somewhere on the internet
# 2. Copy rsync.yaml.example to rsync.yaml (or name it as you see fit)
# 3. `ddev auth ssh` (only needs to be done once per ddev session or reboot)
# 4. Use `ddev pull rsync` to pull the project database and files.
# 5. `ddev push rsync` can push the project database and files
# Note that while this is done in the web container (because rsync will always be there)
# it could also be done on the host, and then you wouldn't need the
# `ddev auth ssh`
environment_variables:
dburl: you@yourhost.example.com:tmp/db.sql.gz
filesurl: you@yourhost.example.com:tmp/files.tar.gz
auth_command:
command: |
set -eu -o pipefail
ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 )
db_pull_command:
command: |
# set -x # You can enable bash debugging output by uncommenting
set -eu -o pipefail
rsync -az "${dburl}" /var/www/html/.ddev/.downloads/db.sql.gz
service: web
files_pull_command:
command: |
# set -x # You can enable bash debugging output by uncommenting
set -eu -o pipefail
ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible
pushd /var/www/html/.ddev/.downloads >/dev/null
rm -f files.tar.gz
rsync -avz "${filesurl}" .
tar -xzf files.tar.gz -C files/
service: web
# Pushing a database or files to upstream can be dangerous and not recommended.
# This example is not very dangerous because it's not actually deploying the
# files. But if the db were deployed on production it would overwrite
# the current db or files there.
db_push_command:
command: |
# set -x # You can enable bash debugging output by uncommenting
set -eu -o pipefail
ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible
mysqldump db | gzip >/var/www/html/.ddev/.downloads/db_push.sql.gz
rsync -avz /var/www/html/.ddev/.downloads/db_push.sql.gz "${dburl}"
files_push_command:
command: |
# set -x # You can enable bash debugging output by uncommenting
set -eu -o pipefail
rsync -az "${DDEV_FILES_DIR}/" "${filesurl}/"