wordpress-dev/production/export-to-production.sh

38 lines
909 B
Bash
Raw Normal View History

2020-03-08 17:21:12 +00:00
#!/bin/sh
_docker_user="ray"
_host="wp-stack-two"
_domain="wptest.isnet.uk"
_docker_base_dir="/var/docker"
_docker_dir="$_docker_base_dir/$_host"
# _cmd_wp_export="wp db export --dbuser=wordpress --dbpass=$_wp_db_passwd --add-drop-table data.sql"
_ssh_cmd="ssh root@$_host.$_domain"
_scp_to_base="root@$_host.$_domain:$_docker_dir"
echo "HOST=$_host" > .env
echo "DOMAIN=$_domain" >> .env
$_ssh_cmd "mkdir -p $_docker_dir"
scp -r config "$_scp_to_base"/config
scp Dockerfile "$_scp_to_base"/Dockerfile
scp entrypoint.sh "$_scp_to_base"/entrypoint.sh
scp .env "$_scp_to_base"/.env
scp docker-compose.yml "$_scp_to_base"/docker-compose.yml
$_ssh_cmd "sed -i 's/__HOST__/$_host/g' $_docker_dir/config/nginx.conf"
$_ssh_cmd "chown -R $_docker_user: $_docker_dir"
# export wordpress directory
# import database
# set correct URLS
# ensure HTTP_X_FORWARDED_PROTO header is set in wp-config.php
rm .env