Last active
July 16, 2019 07:06
-
-
Save davemac/b9e1b000f0f1402a60d7e48ba26792a3 to your computer and use it in GitHub Desktop.
initial deploy of local site to staging server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for initial site deployment to staging server, excludes dev tools and build files | |
# uses current directory as theme path and ssh alias | |
# 3 user inputs: dbname, dbuser, dbpass | |
firstdeploy() { | |
current=${PWD##*/} | |
cd ~/Sites/$current || return | |
echo "Staging database name:" | |
read dbname | |
echo "Staging database user:" | |
read dbuser | |
echo "Staging database password:" | |
read dbpass | |
# rsync the local database to staging site | |
wp db export $current.sql | |
rsync $current.sql $current-s:~/ | |
wp @stage core download --path=www --skip-content | |
wp @stage config create --dbname="$dbname" --dbuser="$dbuser" --dbpass="$dbpass" --skip-check --extra-php <<PHP | |
define( 'WP_DEBUG', false ); | |
define('SAVEQUERIES', false); | |
define( 'DISALLOW_FILE_EDIT', true ); | |
define( 'WP_POST_REVISIONS', 5 ); | |
define( 'JETPACK_STAGING_MODE', true); | |
PHP | |
wp @stage db import $current.sql | |
wp @stage search-replace "$current.localhost" "$current.dmctest.com.au" --all-tables | |
rsync --exclude-from "rsync-exclude.txt" wp-content $current-s:~/www | |
# remove plugins that aren't needed | |
wp @stage plugin deactivate debug-bar query-monitor acf-theme-code-pro wordpress-seo | |
wp @stage plugin delete debug-bar query-monitor acf-theme-code-pro wordpress-seo | |
# Discourage search engines from indexing this site | |
wp @stage option update blog_public 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment