Use shared abra backup functions
This commit is contained in:
		
							
								
								
									
										31
									
								
								abra.sh
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								abra.sh
									
									
									
									
									
								
							| @ -11,39 +11,16 @@ sub_wp() { | |||||||
|     error "Can't find a container for ${STACK_NAME}_app" |     error "Can't find a container for ${STACK_NAME}_app" | ||||||
|     exit |     exit | ||||||
|   fi |   fi | ||||||
| 	# shellcheck disable=SC2154,SC2086 |   # shellcheck disable=SC2154,SC2086 | ||||||
| 	docker run -it --volumes-from "$CONTAINER" --network "container:$CONTAINER" wordpress:cli wp ${abra__args_[*]} |   docker run -it --volumes-from "$CONTAINER" --network "container:$CONTAINER" wordpress:cli wp ${abra__args_[*]} | ||||||
| } | } | ||||||
|  |  | ||||||
| abra_backup_app() { | abra_backup_app() { | ||||||
|   # shellcheck disable=SC2034 |   _abra_backup_dir "app:/var/www/html/wp-content" | ||||||
|   { |  | ||||||
| 	abra__src_="app:/var/www/html/wp-content" |  | ||||||
| 	abra__dst_="-" |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   # shellcheck disable=SC2154 |  | ||||||
|   FILENAME="$ABRA_DIR/backups/${abra__app_}_wp-content_$(date +%F).tar.gz" |  | ||||||
|  |  | ||||||
|   sub_app_cp | gzip > "$FILENAME" |  | ||||||
|  |  | ||||||
|   success "Backed up 'app' to $FILENAME" |  | ||||||
| } | } | ||||||
|  |  | ||||||
| abra_backup_db() { | abra_backup_db() { | ||||||
|   # shellcheck disable=SC2034 |   _abra_backup_mysql "db" "wordpress" | ||||||
|   abra__service_="db" |  | ||||||
|   # 3wc: necessary because $abra__service_ won't be set if we're coming from  |  | ||||||
|   # `abra_backup`, i.e. `abra app ... backup --all` |  | ||||||
|  |  | ||||||
|   DB_ROOT_PASSWORD=$(sub_app_run cat /run/secrets/db_root_password) |  | ||||||
|  |  | ||||||
|   # shellcheck disable=SC2154 |  | ||||||
|   FILENAME="$ABRA_DIR/backups/${abra__app_}_$(date +%F).sql.gz" |  | ||||||
|  |  | ||||||
|   sub_app_run mysqldump -u root -p"$DB_ROOT_PASSWORD" wordpress | gzip > "$FILENAME" |  | ||||||
|  |  | ||||||
|   success "Backed up 'db' to $FILENAME" |  | ||||||
| } | } | ||||||
|  |  | ||||||
| abra_backup() { | abra_backup() { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user