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

fix: rsync example should create db.sql.gz [skip ci] #6022

Merged
merged 1 commit into from Mar 29, 2024

Conversation

rfay
Copy link
Member

@rfay rfay commented Mar 27, 2024

The Issue

It was pointed out that if the rsync provider brings down a file as a name other than db.sql.gz, the database gets created with the filename.

This is by design,

if p.DBImportCommand.Command == "" {
for i, loc := range fileLocation {
// The database name used will be basename of the file.
// For example. `db.sql.gz` will go into the database named 'db'
// xxx.sql will go into database named 'xxx';
b := path.Base(loc)
n := strings.Split(b, ".")
dbName := n[0]
err = p.app.ImportDB(loc, importPath[i], true, false, dbName)
}
} else {

But not useful when the rsync example doesn't explicitly control it.

How This PR Solves The Issue

Change the rsync example to explicitly name the dump file as db.sql.gz

I checked the other examples and integrations and don't find any other example of this ambiguity.

Manual Testing Instructions

Try out this .ddev/providers/rsync.yaml:

environment_variables:
  dburl: rfay@jumphost.thefays.us:~/tmp/xyz.sql.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

Automated Testing Overview

Related Issue Link(s)

Release/Deployment Notes

@rfay rfay marked this pull request as ready for review March 27, 2024 14:21
@rfay rfay requested a review from a team as a code owner March 27, 2024 14:21
@rfay rfay merged commit 826b096 into ddev:master Mar 29, 2024
17 checks passed
@rfay rfay deleted the 20240327_db_import_name branch March 29, 2024 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant