From d3e61d99838723060bb5b1948344d0ba97f4d62a Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 12 Mar 2020 19:31:36 +0000 Subject: [PATCH] deploy container successfully --- dev/export-data.sh | 5 ++++- production/export-to-production.sh | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dev/export-data.sh b/dev/export-data.sh index 58f723e..2a276f9 100755 --- a/dev/export-data.sh +++ b/dev/export-data.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -e + if [ -z "$1" ] ; then _target_filename='.' else @@ -11,8 +13,9 @@ _cmd_wp_export="wp db export --dbuser=wordpress --dbpass=$_wp_db_passwd --add-dr _ssh_cmd="sshpass -p$_passwd_www ssh $_user_www@$_host" _scp_cmd="sshpass -p$_passwd_www scp $_user_www@$_host:/tmp/wordpress.tar.gz" -echo "Exporting data ..." +echo "Exporting database ..." $_ssh_cmd "cd /var/www/html/wordpress &&" $_cmd_wp_export +echo "Exporting files ..." $_ssh_cmd 'cd /var/www/html/wordpress && tar czf /tmp/wordpress.tar.gz .' $_ssh_cmd "rm /var/www/html/wordpress/data.sql" $_scp_cmd "$_target_filename" diff --git a/production/export-to-production.sh b/production/export-to-production.sh index cdfb1b7..6a00b1c 100755 --- a/production/export-to-production.sh +++ b/production/export-to-production.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -e + _docker_dir="$_docker_base_dir/$_remote_host" _ssh_cmd="ssh root@$_remote_host.$_domain" @@ -49,12 +51,12 @@ echo "Configuring WordPress ..." # TODO does docker always assign ips in range 172.% ???? # TODO - sort this mess out - use functions or something -_ssh_shell_cmd='echo "GRANT ALL PRIVILEGES ON wordpress."*" TO \"wordpress\"@\"172.%\" IDENTIFIED BY \"wordpress\";" | mysql -uroot -pdb' +_ssh_shell_cmd='echo "GRANT ALL PRIVILEGES ON wordpress."*" TO \"wordpress\"@\"172.%\" IDENTIFIED BY \"'"$_wp_db_passwd"'\";" | mysql -uroot -p'"$_mysql_root_passwd" _cmd_docker_exec="cd $_docker_dir && docker exec -t $_remote_host-mysql /bin/sh -c '$_ssh_shell_cmd'" echo "$_ssh_cmd $_cmd_docker_exec" $_ssh_cmd $_cmd_docker_exec -_cmd_wp="wp db import --dbuser=wordpress --dbpass=$_wp_db_passwd data.sql" +_cmd_wp="wp db import --dbuser=wordpress --dbpass=$_wp_db_passwd data.sql && rm data.sql" _cmd_docker_exec="cd $_docker_dir && docker exec -t $_remote_host-wordpress /bin/sh -c '$_cmd_wp'" echo "$_ssh_cmd $_cmd_docker_exec" $_ssh_cmd "$_cmd_docker_exec"