Compare commits
No commits in common. "d231870bca426a7cc3a0939155dbb6da7d09649e" and "187fa93ffcac0b60a32c074934a5074b837a38ea" have entirely different histories.
d231870bca
...
187fa93ffc
|
@ -1 +0,0 @@
|
|||
old/
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
Development environment base packages:
|
||||
|
||||
* nvm
|
||||
* lf
|
||||
* lazygit
|
||||
|
||||
## TODO
|
||||
|
||||
* make sure to use export in all config files (the newer ones aren't)
|
|
@ -1,5 +1,5 @@
|
|||
## php configuration
|
||||
#
|
||||
## uncomment if using php
|
||||
export php_version='latest'
|
||||
php_version='latest'
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
export apache2_version='latest'
|
||||
apache2_version='latest'
|
||||
|
||||
#export nginx_version='latest'
|
||||
#nginx_version='latest'
|
||||
|
||||
## specify specific version from latest, 54, 55, 56, 70, 71, 72, 73 or 74
|
||||
#export litespeed_version='latest'
|
|
@ -1,5 +1,5 @@
|
|||
## php configuration
|
||||
#
|
||||
## uncomment if using php
|
||||
#export php_version='latest'
|
||||
# php_version='latest'
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#export apache2_version='latest'
|
||||
# apache2_version='latest'
|
||||
|
||||
#export nginx_version='latest'
|
||||
#nginx_version='latest'
|
||||
|
||||
## specify specific version from latest, 54, 55, 56, 70, 71, 72, 73 or 74
|
||||
#export litespeed_version='latest'
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -z "$1" ] ; then
|
||||
echo "error: must specify configuration file to use"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
. ./"$1"
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_root" ] && echo "Error: no root ssh configuration specified" && exit 5
|
||||
|
||||
ssh -T $ssh_root << EOSSH
|
||||
|
||||
ufw allow http && ufw allow https
|
||||
|
||||
if [ "$litespeed_version" != 'latest' ] ; then
|
||||
echo "TODO install specific litespeed version"
|
||||
echo ""
|
||||
echo "Specify \"litespeed_version='latest'\" to install current version."
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "$wp_user" ] ; then
|
||||
wget --no-check-certificate https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh && bash ols1clk.sh \
|
||||
--adminpassword "$ls_webadmin_pass" \
|
||||
--lsphp "$ls_lsphp_version" \
|
||||
--wordpressplus "$url" \
|
||||
--wordpresspath "$wp_path" \
|
||||
--dbrootpassword "$db_root_pass" \
|
||||
--dbpassword "$db_pass" \
|
||||
--dbname "$db_name" \
|
||||
--dbuser "$db_user" \
|
||||
--wpuser "$wp_user" \
|
||||
--wppassword "$wp_pass" \
|
||||
&& ufw allow 7080
|
||||
else
|
||||
echo "TODO install litespeed without WordPress"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
EOSSH
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -z "$1" ] ; then
|
||||
echo "error: must specify configuration file to use"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
. ./"$1"
|
||||
|
||||
ssh -T $src_ssh << EOSSH
|
||||
|
||||
ufw allow http && ufw allow https
|
||||
|
||||
echo "TODO install nginx"
|
||||
exit 1
|
||||
|
||||
EOSSH
|
|
@ -0,0 +1,75 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./config
|
||||
|
||||
if [ "$1" = 'local' ] ; then
|
||||
src_url="$local_url";
|
||||
dest_url="$remote_url";
|
||||
src_ssh="$local_ssh"
|
||||
dest_ssh="$remote_ssh"
|
||||
elif [ "$1" = 'remote' ] ; then
|
||||
src_url="$remote_url";
|
||||
dest_url="$local_url";
|
||||
src_ssh="$remote_ssh"
|
||||
dest_ssh="$local_ssh"
|
||||
else
|
||||
echo "error: must specify local or remote"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
db_file="$wp_path/data.sql"
|
||||
tar_file="/tmp/wordpress.tar.gz"
|
||||
|
||||
############## source
|
||||
|
||||
ssh -T $src_ssh << EOSSH
|
||||
wp db export \
|
||||
--path="$wp_path" \
|
||||
--dbuser="$wp_db_user" \
|
||||
--dbpass="$wp_db_pass" \
|
||||
--add-drop-table \
|
||||
--allow-root \
|
||||
"$db_file"
|
||||
tar czf "$tar_file" "$wp_path"
|
||||
EOSSH
|
||||
|
||||
scp "$src_ssh:$tar_file" "$tar_file"
|
||||
|
||||
ssh -T $src_ssh << EOSSH
|
||||
rm "$db_file"
|
||||
rm "$tar_file"
|
||||
EOSSH
|
||||
|
||||
############## destination
|
||||
|
||||
scp "$tar_file" "$dest_ssh:$tar_file"
|
||||
|
||||
ssh -T $dest_ssh << EOSSH
|
||||
rm -Rf "$wp_path"
|
||||
cd /
|
||||
tar xzf "$tar_file"
|
||||
|
||||
wp db import \
|
||||
--path="$wp_path" \
|
||||
--dbuser="$wp_db_user" \
|
||||
--dbpass="$wp_db_pass" \
|
||||
--allow-root \
|
||||
"$db_file"
|
||||
rm "$db_file"
|
||||
rm "$tar_file"
|
||||
wp search-replace \
|
||||
--path="$wp_path" \
|
||||
--allow-root \
|
||||
--skip-columns=guid \
|
||||
"$src_url" \
|
||||
"$dest_url"
|
||||
wp option update home \
|
||||
--path="$wp_path" \
|
||||
--allow-root
|
||||
wp option update home \
|
||||
--path="$wp_path" \
|
||||
--allow-root
|
||||
EOSSH
|
||||
|
||||
|
||||
mv "$tar_file" ./wordpress-"$(date +%s)".tar.gz
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./config-urls
|
||||
|
||||
(
|
||||
echo "export local_url=\"$local_ur\""; \
|
||||
echo "export remote_url=\"$remote_url\""; \
|
||||
cat config "$2" \
|
||||
) | ssh root@"$local_url" -T /bin/sh
|
||||
|
||||
(
|
||||
echo "export local_url=\"$remote_url\""; \
|
||||
echo "export remote_url=\"$local_url\""; \
|
||||
cat config "$2" \
|
||||
) | ssh root@"$remote_url" -T /bin/sh
|
||||
|
||||
db_file="$wp_path/data.sql"
|
||||
|
||||
wp db export --dbuser=wordpress --dbpass=$db_pass --add-drop-table --alow-root "$db_file"
|
||||
tar czf /tmp/wordpress.tar.gz "$wp_path"
|
||||
# scp
|
||||
rm "$db_file"
|
||||
rm /tmp/wordpress.tar.gz
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
_target="$1"
|
||||
|
||||
if ! [ "$_target" = local ] && ! [ "$_target" = remote ] ; then
|
||||
echo "Error: must specify 'local' or 'remote' target"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Loading $_target configuration"
|
||||
|
||||
# source our config files
|
||||
for _file in ./config/$_target/* ; do
|
||||
[ -e "$_file" ] || continue
|
||||
. "$_file"
|
||||
done
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_user" ] && echo "Error: no user ssh configuration specified" && exit 5
|
||||
|
||||
if [ -n "$wp_user" ] ; then
|
||||
. ./scripts/export-wp.sh
|
||||
fi
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "Exporting from $url .."
|
||||
|
||||
_timestamp="$(date +%s)"
|
||||
_db_filename="wordpress-$_timestamp.db"
|
||||
_archive_filename="wordpress-$_timestamp.tar.gz"
|
||||
_local_dest_dir="./data/$_target"
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_user" ] && echo "Error: no user ssh configuration specified" && exit 5
|
||||
|
||||
ssh -T $ssh_user << EOSSH
|
||||
cd "$wp_path"
|
||||
wp db export \
|
||||
--path="$wp_path" \
|
||||
--dbuser="$db_user" \
|
||||
--dbpass="$db_pass" \
|
||||
--add-drop-table \
|
||||
--allow-root \
|
||||
"/tmp/$_db_filename"
|
||||
tar czf "/tmp/$_archive_filename" "$wp_path"
|
||||
EOSSH
|
||||
|
||||
scp "$ssh_user:/tmp/$_archive_filename" "$_local_dest_dir/$_archive_filename"
|
||||
scp "$ssh_user:/tmp/$_db_filename" "$_local_dest_dir/$_db_filename"
|
||||
|
||||
exit
|
||||
ssh -T $ssh_user << EOSSH
|
||||
rm "/tmp/$_db_filename"
|
||||
rm "/tmp/$_archive_filename"
|
||||
EOSSH
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
Installation scripts for local/remote servers with development environment.
|
|
@ -1,3 +0,0 @@
|
|||
Exports a local WordPress installation's database and
|
||||
`wp-content/` files to a remote installation.
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
remote_domain='some.cloudwaysapps.com'
|
||||
remote_ssh='user@some.cloudwaysapps.com'
|
||||
remote_wp_path='/home/some.cloudwaysapps.com/aabbccddee/public_html'
|
||||
|
||||
local_domain='example.local'
|
||||
local_wp_path='/var/www/html/wordpress'
|
||||
|
||||
rsync -azP wp-content/ "$remote_ssh:$remote_wp_path/wp-content" --delete-before
|
||||
|
||||
echo "DB size before:"
|
||||
wp db size --ssh="$remote_ssh$remote_wp_path"
|
||||
wp db export --path="$local_wp_path" --add-drop-table - | wp db import --ssh="$remote_ssh$remote_wp_path" -
|
||||
echo "DB size after:"
|
||||
wp db size --ssh="$remote_ssh$remote_wp_path"
|
||||
|
||||
wp search-replace "$local_domain" "$remote_domain" \
|
||||
--ssh="$remote_ssh$remote_wp_path" \
|
||||
--skip-columns=guid
|
Loading…
Reference in New Issue