Metadrop / scripthor

Swiss knife of scripts for speed up the development on drupal projects.
1 stars 10 forks source link

Save databases as gzip #16

Closed Eduardo-Morales-Alberti closed 1 year ago

Eduardo-Morales-Alberti commented 3 years ago

Save databases as gzip, scripthor download each month the database uncompress, could be better save the file as gzip.

Proposed changes https://github.com/Metadrop/scripthor/blob/1.x/bin/reload-local.sh#L297

if [ ${REFRESH_LOCAL_DUMP} = true ] || [ ! -f $LOCAL_FILE ]
  then
    echo "Updating local dump."
    $DOCKER_EXEC_PHP drush @${LOCAL_ALIAS} sql:dump --result-file=../$LOCAL_FILE
fi
if [ ${REFRESH_LOCAL_DUMP} = true ] || [ ! -f $LOCAL_FILE ]
  then
    echo "Updating local dump."
    $DOCKER_EXEC_PHP drush @${LOCAL_ALIAS} sql:dump --gzip --result-file=../$LOCAL_FILE
fi
omarlopesino commented 3 years ago

Those are good changes, if you make a pull request I'll review it. Thank you!

omarlopesino commented 3 years ago

To uncompress, it would be needed to alter the script here https://github.com/Metadrop/scripthor/blob/1.x/bin/reload-local.sh#L263 so it uncompress the files before

Eduardo-Morales-Alberti commented 3 years ago

@mistermoper Ready to review the pull request

Eduardo-Morales-Alberti commented 2 years ago

@mistermoper @rsanzante Ready to review again the changes https://github.com/Metadrop/scripthor/pull/17/files

Eduardo-Morales-Alberti commented 1 year ago

@mistermoper @rsanzante @jorgetutor I tested de script and is working and compressing the dumps with the latest changes.

As @juanjol says, compressed dumps can lead to slower loads, so we gain local space but maybe lose performance. It is a monthly dump, because of the granularity of the dump, so maybe is more important the time to load instead of the local space.

Should we add a COMPRESSED param to give the user the option to choose? Is it interesting to add or should I close the issue?

rsanzante commented 1 year ago

I think this would only be useful for huge databases. However, the day you need this you'll be happy to be able to disable gzip. Given that it should be easy to add that param I would go for it.

However, I think by default DB dump should compressed. The param should allow to disable compression.

Of course, we could use other compressors like xv or pigz but this means more complexity and dependencies. I would stick to gzip.

Eduardo-Morales-Alberti commented 1 year ago

@mistermoper @juanjol @rsanzante Added parameter "uncompressed" to allow the user to load and save the backup uncompressed, by default it will be compressed. Please review the PR https://github.com/Metadrop/scripthor/pull/17