deploy container successfully

This commit is contained in:
Ray Elliott 2020-03-12 19:31:36 +00:00
parent ce426e3f30
commit d3e61d9983
2 changed files with 8 additions and 3 deletions

View File

@ -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"

View File

@ -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"