Compare commits
12 Commits
c6efac505c
...
f858776a9e
Author | SHA1 | Date |
---|---|---|
Ray Elliott | f858776a9e | |
Ray Elliott | c477713d94 | |
Ray Elliott | a2e534f552 | |
Ray Elliott | fad8de9d4e | |
Ray Elliott | 4c37540ab5 | |
Ray Elliott | 81edc68811 | |
Ray Elliott | e15ab61d29 | |
Ray Elliott | ce0dc65590 | |
Ray Elliott | 29861e9be2 | |
Ray Elliott | 40f17c5a8e | |
Ray Elliott | b624a6e8cb | |
Ray Elliott | b16fe3f73c |
|
@ -1 +1,2 @@
|
||||||
files/private
|
files/private
|
||||||
|
*.secret
|
||||||
|
|
|
@ -7,6 +7,4 @@ Development environment base packages:
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
* combine install-local.sh and install-remote.sh into one script that takes
|
* make sure to use export in all config files (the newer ones aren't)
|
||||||
an argument of local/remote
|
|
||||||
* get remote working with cloudways
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
## apache configuration
|
## apache configuration
|
||||||
|
#
|
||||||
## uncomment if using apache
|
## uncomment if using apache
|
||||||
#apache2_version='latest'
|
# apache2_version='latest'
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
# cloudways configuration
|
||||||
|
|
||||||
|
. ./config/remote/cloudways.secret
|
||||||
|
|
||||||
|
cloudways_user='cloudways@rayelliott.dev'
|
||||||
|
cloudways_url='https://wordpress-453075-1468300.cloudwaysapps.com'
|
||||||
|
|
||||||
|
cloudways_ssh='test123@wordpress-453075-1468300.cloudwaysapps.com'
|
||||||
|
|
||||||
|
cloudways_db_name='mhhusspndh'
|
||||||
|
cloudways_db_user='mhhusspndh'
|
|
@ -9,5 +9,5 @@
|
||||||
|
|
||||||
## https://openlitespeed.org/kb/1-click-install/
|
## https://openlitespeed.org/kb/1-click-install/
|
||||||
## password used to log into litespeed web interface
|
## password used to log into litespeed web interface
|
||||||
#export ls_webadmin_pass='x7__+85676--Dd'
|
#export ls_webadmin_pass='admin'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
## uncomment if using mariadb
|
## uncomment if using mariadb
|
||||||
#mariadb_version='latest'
|
# mariadb_version='latest'
|
||||||
|
# db_root_pass='9483ujtej0--=0FFFdl'
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
## uncomment if using mysql
|
## uncomment if using mysql
|
||||||
#mysql_version='latest'
|
#mysql_version='latest'
|
||||||
|
#db_root_pass='9483ujtej0--=0FFFdl'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
## php configuration
|
## php configuration
|
||||||
#
|
#
|
||||||
## uncomment if using php
|
## uncomment if using php
|
||||||
#php_version='latest'
|
# php_version='latest'
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
## ssh configuration
|
## ssh configuration
|
||||||
|
|
||||||
## uncomment if connecting via ssh
|
## uncomment if connecting via ssh
|
||||||
#export ssh='root@test123.example.com'
|
# export ssh='root@test123.isnet.uk'
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
## user configuration
|
## user configuration
|
||||||
## uncomment to set user
|
## uncomment to set user
|
||||||
|
|
||||||
## webuser/webgroup
|
# export user='ray'
|
||||||
## leave commented for default
|
# export user_pass='ray'
|
||||||
#export webuser='www-data'
|
# export group='ray'
|
||||||
#export webgroup='www-data'
|
|
||||||
|
|
|
@ -1,24 +1,23 @@
|
||||||
## wordpress configuration - uncomment if using wordpress
|
## wordpress configuration - uncomment if using wordpress
|
||||||
|
|
||||||
# export wp_user='admin'
|
# export wp_user='admin'
|
||||||
# export wp_pass=''
|
# export wp_pass='admin'
|
||||||
|
# export wp_email='myemail@isnet.uk'
|
||||||
|
|
||||||
## leave commented if using default
|
# export wp_version='latest'
|
||||||
# export wp_path='/var/www/html/wordpress'
|
# export wp_path='/var/www/html/wordpress'
|
||||||
|
# export wp_locale='en_GB'
|
||||||
|
# export wp_title='The WordPress'
|
||||||
|
|
||||||
# export db_root_pass='9dn,s93j_UU9--s889d8dUY'
|
|
||||||
# export wp_db_name='wordpress'
|
# export wp_db_name='wordpress'
|
||||||
# export wp_db_user='wordpress'
|
# export wp_db_user='wordpress'
|
||||||
# export wp_db_pass='__d39fhi3nkjdflk8-ddWEs'
|
# export wp_db_pass='wordpress'
|
||||||
|
|
||||||
## list of themes to install - first one will be activate
|
## list of themes to install - first one will be activated
|
||||||
# export wp_themes="twentytwenty"
|
# export wp_themes="twentytwenty"
|
||||||
|
|
||||||
## list of plugins to install
|
## list of plugins to install
|
||||||
# export wp_plugins=""
|
# export wp_plugins="akismet all-in-one-seo-pack"
|
||||||
|
|
||||||
## list of plugins to activate
|
## list of plugins to install and activate
|
||||||
# export wp_plugins_active=""
|
# export wp_plugins_active=""
|
||||||
|
|
||||||
## list of plugins to uninstall
|
|
||||||
# export wp_plugins_uninstall="hello aksimet"
|
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# default scripts to use
|
|
||||||
_script_dir='./scripts/debian10'
|
|
||||||
|
|
||||||
if [ -n "$1" ] ; then
|
|
||||||
_script_dir="./scripts/$1"
|
|
||||||
if ! [ -d "$_script_dir" ] ; then
|
|
||||||
echo "Error: script directory not found '$_script_dir'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Using Scripts in: $_script_dir"
|
|
||||||
|
|
||||||
# source our config files
|
|
||||||
for _file in ./config/local/* ; do
|
|
||||||
. "$_file"
|
|
||||||
done
|
|
||||||
|
|
||||||
# check we have ssh access
|
|
||||||
[ -z "$ssh" ] && echo "Error: no ssh configuration specified" && exit 5
|
|
||||||
|
|
||||||
# update local server
|
|
||||||
echo "Updating .."
|
|
||||||
ssh -T $ssh << EOSSH
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
|
||||||
apt-get -qq -y update && apt-get -qq -y upgrade
|
|
||||||
EOSSH
|
|
||||||
echo "Update complete"
|
|
||||||
|
|
||||||
. "$_script_dir/install-user.sh"
|
|
||||||
. "$_script_dir/install-base.sh"
|
|
||||||
|
|
||||||
if [ -n "$php_version" ] ; then
|
|
||||||
. "$_script_dir/install-php.sh"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$mariadb_version" ] ; then
|
|
||||||
. "$_script_dir/install-mariadb.sh"
|
|
||||||
elif [ -n "$mysql_version" ] ; then
|
|
||||||
. "$_script_dir/install-mysql.sh"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$apache2_version" ] ; then
|
|
||||||
. "$_script_dir/install-apache2.sh"
|
|
||||||
elif [ -n "$nginx_version" ] ; then
|
|
||||||
# TODO nginx install script
|
|
||||||
echo 'TODO - nginx install script'
|
|
||||||
elif [ -n "$litespeed_version" ] ; then
|
|
||||||
# TODO
|
|
||||||
echo 'TODO litespeed install script'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$wp_user" ] ; then
|
|
||||||
. "$_script_dir/install-wordpress.sh"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$dev_env" ] ; then
|
|
||||||
. "$_script_dir/install-dev-base.sh"
|
|
||||||
fi
|
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
_target="$1"
|
||||||
|
_target_os="$2"
|
||||||
|
# default scripts to use
|
||||||
|
_script_dir='./scripts/debian10'
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
if [ "$_target" = remote ] && [ -n "$cloudways_user" ] ; then
|
||||||
|
echo "Using Cloudways - nothing to install"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# source script files
|
||||||
|
if [ -n "$_target_os" ] ; then
|
||||||
|
_script_dir="./scripts/$_target_os"
|
||||||
|
if ! [ -d "$_script_dir" ] ; then
|
||||||
|
echo "Error: script directory not found '$_script_dir'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Using Scripts in: $_script_dir"
|
||||||
|
|
||||||
|
# check we have ssh access
|
||||||
|
[ -z "$ssh" ] && echo "Error: no ssh configuration specified" && exit 5
|
||||||
|
|
||||||
|
# update
|
||||||
|
echo "Updating .."
|
||||||
|
ssh -T $ssh << EOSSH
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get -qq -y update && apt-get -qq -y upgrade
|
||||||
|
EOSSH
|
||||||
|
echo "Update complete"
|
||||||
|
|
||||||
|
. "$_script_dir/install-user.sh"
|
||||||
|
# . "$_script_dir/install-base.sh"
|
||||||
|
#
|
||||||
|
# if [ -n "$php_version" ] ; then
|
||||||
|
# . "$_script_dir/install-php.sh"
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# if [ -n "$mariadb_version" ] ; then
|
||||||
|
# . "$_script_dir/install-mariadb.sh"
|
||||||
|
# elif [ -n "$mysql_version" ] ; then
|
||||||
|
# . "$_script_dir/install-mysql.sh"
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# if [ -n "$apache2_version" ] ; then
|
||||||
|
# . "$_script_dir/install-apache2.sh"
|
||||||
|
# elif [ -n "$nginx_version" ] ; then
|
||||||
|
# # TODO nginx install script
|
||||||
|
# echo 'TODO - nginx install script'
|
||||||
|
# elif [ -n "$litespeed_version" ] ; then
|
||||||
|
# # TODO
|
||||||
|
# echo 'TODO litespeed install script'
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# if [ -n "$wp_user" ] ; then
|
||||||
|
# . "$_script_dir/install-wordpress.sh"
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# if [ -n "$dev_env" ] ; then
|
||||||
|
# . "$_script_dir/install-dev-base.sh"
|
||||||
|
# fi
|
|
@ -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" ] && echo "Error: no ssh configuration specified" && exit 5
|
||||||
|
|
||||||
|
if [ -n "$wp_user" ] ; then
|
||||||
|
. ./scripts/export-wp.sh
|
||||||
|
fi
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
_target="$1"
|
||||||
|
_target_os="$2"
|
||||||
|
# default scripts to use
|
||||||
|
_script_dir='./scripts/debian10'
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# source script files
|
||||||
|
if [ -n "$_target_os" ] ; then
|
||||||
|
_script_dir="./scripts/$_target_os"
|
||||||
|
if ! [ -d "$_script_dir" ] ; then
|
||||||
|
echo "Error: script directory not found '$_script_dir'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Using Scripts in: $_script_dir"
|
||||||
|
|
||||||
|
# check we have ssh access
|
||||||
|
[ -z "$ssh" ] && echo "Error: no ssh configuration specified" && exit 5
|
||||||
|
|
||||||
|
if [ -n "$wp_user" ] ; then
|
||||||
|
# TODO - confirmation prompt
|
||||||
|
echo "IMPORTANT - we need a confirmation prompt here"
|
||||||
|
echo "You are about to reinstall the $_target WordPress installation"
|
||||||
|
echo "Reinstall WordPress (y/N): "
|
||||||
|
. "./scripts/reset-wordpress.sh"
|
||||||
|
. "$_script_dir/install-wordpress.sh"
|
||||||
|
fi
|
|
@ -21,7 +21,7 @@ else
|
||||||
$_mysql_cmd "GRANT ALL PRIVILEGES ON $wp_db_name.* TO '$wp_db_user'@'localhost' IDENTIFIED BY '$wp_db_pass';"
|
$_mysql_cmd "GRANT ALL PRIVILEGES ON $wp_db_name.* TO '$wp_db_user'@'localhost' IDENTIFIED BY '$wp_db_pass';"
|
||||||
$_mysql_cmd "FLUSH PRIVILEGES;"
|
$_mysql_cmd "FLUSH PRIVILEGES;"
|
||||||
else
|
else
|
||||||
echo "ERROR: no installed database found - aborting WordPress install"
|
echo "ERROR: mysql not found - aborting WordPress install"
|
||||||
exit 40
|
exit 40
|
||||||
fi
|
fi
|
||||||
wp core download \
|
wp core download \
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
echo "Removing WordPress .."
|
||||||
|
|
||||||
|
_mysql_cmd="mysql -uroot -p$db_root_pass -e "
|
||||||
|
|
||||||
|
ssh -T $ssh << EOSSH
|
||||||
|
# remove database
|
||||||
|
if command -v mysql ; then
|
||||||
|
$_mysql_cmd "DROP DATABASE $wp_db_name;"
|
||||||
|
else
|
||||||
|
echo "ERROR: no installed database found - aborting WordPress removal"
|
||||||
|
exit 40
|
||||||
|
fi
|
||||||
|
# remove files
|
||||||
|
rm -Rf $wp_path
|
||||||
|
EOSSH
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/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"
|
||||||
|
|
||||||
|
ssh -T $ssh << EOSSH
|
||||||
|
cd "$wp_path"
|
||||||
|
wp db export \
|
||||||
|
--path="$wp_path" \
|
||||||
|
--dbuser="$wp_db_user" \
|
||||||
|
--dbpass="$wp_db_pass" \
|
||||||
|
--add-drop-table \
|
||||||
|
--allow-root \
|
||||||
|
"/tmp/$_db_filename"
|
||||||
|
tar czf "/tmp/$_archive_filename" "$wp_path"
|
||||||
|
EOSSH
|
||||||
|
|
||||||
|
scp "$ssh:/tmp/$_archive_filename" "$_local_dest_dir/$_archive_filename"
|
||||||
|
scp "$ssh:/tmp/$_db_filename" "$_local_dest_dir/$_db_filename"
|
||||||
|
|
||||||
|
exit
|
||||||
|
ssh -T $ssh << EOSSH
|
||||||
|
rm "/tmp/$_db_filename"
|
||||||
|
rm "/tmp/$_archive_filename"
|
||||||
|
EOSSH
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
echo "Removing WordPress .."
|
||||||
|
|
||||||
|
_mysql_cmd="mysql -uroot -p$db_root_pass -e "
|
||||||
|
|
||||||
|
ssh -T $ssh << EOSSH
|
||||||
|
# remove database
|
||||||
|
if command -v mysql ; then
|
||||||
|
$_mysql_cmd "DROP DATABASE $wp_db_name;"
|
||||||
|
else
|
||||||
|
echo "ERROR: no installed database found - aborting WordPress removal"
|
||||||
|
exit 40
|
||||||
|
fi
|
||||||
|
# remove files
|
||||||
|
rm -Rf $wp_path
|
||||||
|
EOSSH
|
Loading…
Reference in New Issue