github.com/ddev/ddev@v1.23.2-0.20240519125000-d824ffe36ff3/pkg/ddevapp/dotddev_assets/providers/rsync.yaml.example (about)

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