diff --git a/helpers/annotate-pvc-backup.sh b/helpers/annotate-pvc-backup.sh index a237e7d1e4..a4f388c6f2 100644 --- a/helpers/annotate-pvc-backup.sh +++ b/helpers/annotate-pvc-backup.sh @@ -7,4 +7,4 @@ oc get pvc --all-namespaces | grep solr | sed '1d' | awk '{ print $2, "--namespace", $1 }' | while read line; do oc annotate --overwrite pvc $line appuio.ch/backup="true"; done oc get pvc --all-namespaces | grep nginx | sed '1d' | awk '{ print $2, "--namespace", $1 }' | while read line; do oc annotate --overwrite pvc $line appuio.ch/backup="true"; done -oc get --all-namespaces pod -l 'service in (cli)' | sed '1d' | awk '{ print "--namespace", $1, $2 }' | while read line; do oc annotate --overwrite pod $line appuio.ch/backupcommand='/bin/bash -c "if [[ $MARIADB_HOST ]]; then mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD $MARIADB_DATABASE; fi"'; done \ No newline at end of file +oc get --all-namespaces pod -l 'service in (cli)' | sed '1d' | awk '{ print "--namespace", $1, $2 }' | while read line; do oc annotate --overwrite pod $line appuio.ch/backupcommand='/bin/bash -c "if [[ $MARIADB_HOST ]]; then mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD $MARIADB_DATABASE; fi"'; done \ No newline at end of file diff --git a/helpers/mariadb-single2shared.sh b/helpers/mariadb-single2shared.sh index 8a102436d8..34785a3822 100755 --- a/helpers/mariadb-single2shared.sh +++ b/helpers/mariadb-single2shared.sh @@ -71,7 +71,7 @@ DB_PORT=$(cat $SECRETS | shyaml get-value data.DB_PORT | base64 -D) echo "*** Transfering 'drupal' database from $OLD_POD to $DB_HOST" # transfer database between from old to new -oc exec $OLD_POD -- bash -c "mysqldump --no-create-db drupal | mysql -h $DB_HOST -u $DB_USER -p${DB_PASSWORD} -P $DB_PORT $DB_NAME" +oc exec $OLD_POD -- bash -c "mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db drupal | mysql -h $DB_HOST -u $DB_USER -p${DB_PASSWORD} -P $DB_PORT $DB_NAME" CONFIG_BAK="/tmp/${PROJECT_NAME}-$(date +%F-%T)-lagoon-env.yaml" echo "*** Backing up configmap in case we need to revert: ${CONFIG_BAK}" diff --git a/images/mariadb-galera/mysql-backup.sh b/images/mariadb-galera/mysql-backup.sh index 4b96c623f2..bf66958096 100755 --- a/images/mariadb-galera/mysql-backup.sh +++ b/images/mariadb-galera/mysql-backup.sh @@ -78,7 +78,7 @@ function backup_database(){ backup_file="$BACKUP_DIR/$TIMESTAMP.$database.sql.gz" output="${output}${database} => $backup_file\n" echo_status "...backing up $count of $total databases: $database" - $(mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction $(mysql_login) $database | gzip -9 > $backup_file) + $(mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction $(mysql_login) $database | gzip -9 > $backup_file) } function backup_databases(){ diff --git a/images/mariadb/mysql-backup.sh b/images/mariadb/mysql-backup.sh index 4b96c623f2..bf66958096 100755 --- a/images/mariadb/mysql-backup.sh +++ b/images/mariadb/mysql-backup.sh @@ -78,7 +78,7 @@ function backup_database(){ backup_file="$BACKUP_DIR/$TIMESTAMP.$database.sql.gz" output="${output}${database} => $backup_file\n" echo_status "...backing up $count of $total databases: $database" - $(mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction $(mysql_login) $database | gzip -9 > $backup_file) + $(mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction $(mysql_login) $database | gzip -9 > $backup_file) } function backup_databases(){ diff --git a/images/oc-build-deploy-dind/openshift-templates/cli-persistent/deployment.yml b/images/oc-build-deploy-dind/openshift-templates/cli-persistent/deployment.yml index 8ec5b5b40b..710801553a 100644 --- a/images/oc-build-deploy-dind/openshift-templates/cli-persistent/deployment.yml +++ b/images/oc-build-deploy-dind/openshift-templates/cli-persistent/deployment.yml @@ -73,7 +73,7 @@ objects: template: metadata: annotations: - appuio.ch/backupcommand: /bin/sh -c "if [[ $MARIADB_HOST ]]; then mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD $MARIADB_DATABASE; fi" + appuio.ch/backupcommand: /bin/sh -c "if [[ $MARIADB_HOST ]]; then mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD $MARIADB_DATABASE; fi" backup.appuio.ch/file-extension: .mysql.sql creationTimestamp: null labels: diff --git a/images/oc-build-deploy-dind/openshift-templates/cli/deployment.yml b/images/oc-build-deploy-dind/openshift-templates/cli/deployment.yml index c16826a674..8ed12a6b15 100644 --- a/images/oc-build-deploy-dind/openshift-templates/cli/deployment.yml +++ b/images/oc-build-deploy-dind/openshift-templates/cli/deployment.yml @@ -59,7 +59,7 @@ objects: template: metadata: annotations: - appuio.ch/backupcommand: /bin/sh -c "if [[ $MARIADB_HOST ]]; then mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD $MARIADB_DATABASE; fi" + appuio.ch/backupcommand: /bin/sh -c "if [[ $MARIADB_HOST ]]; then mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD $MARIADB_DATABASE; fi" backup.appuio.ch/file-extension: .mysql.sql creationTimestamp: null labels: diff --git a/images/oc-build-deploy-dind/openshift-templates/mariadb-galera/deployment.yml b/images/oc-build-deploy-dind/openshift-templates/mariadb-galera/deployment.yml index 65d21737a2..4f4b10b4bc 100644 --- a/images/oc-build-deploy-dind/openshift-templates/mariadb-galera/deployment.yml +++ b/images/oc-build-deploy-dind/openshift-templates/mariadb-galera/deployment.yml @@ -59,7 +59,7 @@ objects: template: metadata: annotations: - appuio.ch/backupcommand: /bin/sh -c "mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction --all-databases" + appuio.ch/backupcommand: /bin/sh -c "mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction --all-databases" backup.appuio.ch/file-extension: .${SERVICE_NAME}.sql creationTimestamp: null labels: diff --git a/images/oc-build-deploy-dind/openshift-templates/mariadb-single/deployment.yml b/images/oc-build-deploy-dind/openshift-templates/mariadb-single/deployment.yml index 2c3572c2a5..d1d40b0e6b 100644 --- a/images/oc-build-deploy-dind/openshift-templates/mariadb-single/deployment.yml +++ b/images/oc-build-deploy-dind/openshift-templates/mariadb-single/deployment.yml @@ -62,7 +62,7 @@ objects: template: metadata: annotations: - appuio.ch/backupcommand: /bin/sh -c "mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction --all-databases" + appuio.ch/backupcommand: /bin/sh -c "mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction --all-databases" backup.appuio.ch/file-extension: .${SERVICE_NAME}.sql creationTimestamp: null labels: