-
-
Notifications
You must be signed in to change notification settings - Fork 700
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe
Commands like ddev composer create --prefer-dist laravel/laravel can take a minute while DDEV rsyncs the files to the project root directory ( composer-create.go:124), at least on my mac m1 air.
It would be great to see the overall progress of the rsync operation, also to be sure it doesn't got stuck.
Describe the solution you'd like
I found out that there is an rsync argument called --info=progress2, which was introduced with rsync 3.1.0.
There is also a --info=progress2 option that outputs
statistics based on the whole transfer, rather than
individual files. Use this flag without outputting a
filename (e.g. avoid -v or specify --info=name0) if you
want to see how the transfer is doing without scrolling
the screen with a lot of names. (You don't need to specify
the --progress option in order to use --info=progress2.)
Source: manpage rsync
I quickly checked the rsync version of DDEV on Gitpod:
gitpod /workspace/d9simple (main) $ ddev exec rsync --version
rsync version 3.2.3 protocol version 31Unfortunately I'm not sure if DDEV container always use rsync > 3.1.0?
Is it safe to assume this?
Tested it quickly in gitpod and changed composer-create.go, worked on Gitpod:
output.UserOut.Printf("Moving install to composer root")
rsyncArgs := "-rltgopD --info=progress2" // Same as -a
if runtime.GOOS == "windows" {
rsyncArgs = "-rlD --info=progress2" // on windows can't do perms, owner, group, times
}
// output.UserOut.Printf("Running rsync with %s", rsyncArgs)
stdout, stderr, err = app.Exec(&ddevapp.ExecOpts{
Service: "web",
Cmd: fmt.Sprintf(`rsync %s "%s/" "%s/"`, rsyncArgs, containerInstallPath, app.GetComposerRoot(true, false)),
Dir: "/var/www/html",
Tty: isatty.IsTerminal(os.Stdin.Fd()),
})Describe alternatives you've considered
There is also the option to use a pipe with pv, but you need to calculate the number of files beforehand${RSYNC} ${RSYNC_ARGS} ${SOURCES} ${TARGET} | pv -l -e -p -s "$HOW_MANY_FILES". (Source, Demo-Gif see "Use pv command to monitor progress of rsync command" -> here)
Additionally there are maybe third party progressbar packages.
Additional context
Infos about ddev composer create (wrapper for composer create) can be found in DDEV docs
Thanks very much for suggestion & tips!
