Compare commits
21 Commits
reset-remo
...
master
Author | SHA1 | Date |
---|---|---|
Ray Elliott | 69dd1e066c | |
Ray Elliott | 4c4a3d350c | |
Ray Elliott | 04c0fb169e | |
Ray Elliott | 1cd155dcb4 | |
Ray Elliott | 7e1701bc1f | |
Ray Elliott | eebea4ce0d | |
Ray Elliott | 60dabf5084 | |
Ray Elliott | a6619f05f5 | |
Ray Elliott | 114a10445f | |
Ray Elliott | 0e526b2454 | |
Ray Elliott | b2e95eb294 | |
Ray Elliott | f1f3d31fbe | |
Ray Elliott | 88d2314a8c | |
Ray Elliott | d231870bca | |
Ray Elliott | 708e1b3fa5 | |
Ray Elliott | c3351b557d | |
Ray Elliott | c107c755fc | |
Ray Elliott | 89d8286021 | |
Ray Elliott | 187fa93ffc | |
Ray Elliott | 6aaf86df78 | |
Ray Elliott | 8a3c354254 |
|
@ -1,2 +1 @@
|
|||
files/private
|
||||
data/
|
||||
old/
|
||||
|
|
10
README.md
10
README.md
|
@ -1,10 +0,0 @@
|
|||
|
||||
Development environment base packages:
|
||||
|
||||
* nvm
|
||||
* lf
|
||||
* lazygit
|
||||
|
||||
## TODO
|
||||
|
||||
* make sure to use export in all config files (the newer ones aren't)
|
|
@ -1,8 +0,0 @@
|
|||
export mariadb_version='latest'
|
||||
#mysql_version='latest'
|
||||
|
||||
export db_root_pass='9483ujtej0--=0FFFdl'
|
||||
|
||||
export db_name='wordpress'
|
||||
export db_user='wordpress'
|
||||
export db_pass='wordpress'
|
|
@ -1,18 +0,0 @@
|
|||
# local specific options
|
||||
|
||||
## export if using local development environment
|
||||
export domain='thecampsitebible.home'
|
||||
export url='http://thecampsitebible.home'
|
||||
|
||||
# set to anything other than the empty string to set up a dev environment
|
||||
export dev_env='true'
|
||||
|
||||
## user configuration
|
||||
export user='ray'
|
||||
export user_pass='ray'
|
||||
export group='ray'
|
||||
|
||||
## ssh configuration
|
||||
export ssh_root='root@thecampsitebible.home'
|
||||
export ssh_user='ray@thecampsitebible.home'
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
## php configuration
|
||||
#
|
||||
## uncomment if using php
|
||||
php_version='latest'
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
apache2_version='latest'
|
||||
|
||||
#nginx_version='latest'
|
||||
|
||||
## specify specific version from latest, 54, 55, 56, 70, 71, 72, 73 or 74
|
||||
#export litespeed_version='latest'
|
||||
|
||||
######################
|
||||
# litespeed specific #
|
||||
######################
|
||||
|
||||
## litespeed php version
|
||||
#export ls_lsphp_version='73'
|
||||
|
||||
## https://openlitespeed.org/kb/1-click-install/
|
||||
## password used to log into litespeed web interface
|
||||
#export ls_webadmin_pass='admin'
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
## wordpress configuration - uncomment if using wordpress
|
||||
|
||||
export wp_user='admin'
|
||||
export wp_pass='admin'
|
||||
export wp_email='myemail@isnet.uk'
|
||||
|
||||
export wp_version='latest'
|
||||
export wp_path='/var/www/html/wordpress'
|
||||
export wp_locale='en_GB'
|
||||
export wp_title='The WordPress'
|
||||
|
||||
export wp_db_name='wordpress'
|
||||
export wp_db_user='wordpress'
|
||||
export wp_db_pass='wordpress'
|
||||
|
||||
## list of themes to install - first one will be activated
|
||||
export wp_themes="twentytwenty"
|
||||
|
||||
## list of plugins to install
|
||||
export wp_plugins="akismet all-in-one-seo-pack"
|
||||
|
||||
## list of plugins to install and activate
|
||||
export wp_plugins_active=""
|
|
@ -1,8 +0,0 @@
|
|||
# export mariadb_version='latest'
|
||||
# export mysql_version='latest'
|
||||
|
||||
# export db_root_pass='9483ujtej0--=0FFFdl'
|
||||
|
||||
export db_name='mhhusspndh'
|
||||
export db_user='mhhusspndh'
|
||||
export db_pass='w9Chzh6fR4'
|
|
@ -1,5 +0,0 @@
|
|||
## php configuration
|
||||
#
|
||||
## uncomment if using php
|
||||
# php_version='latest'
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
# remote specific options
|
||||
|
||||
#export domain='test123.example.com'
|
||||
#export url='http://test123.example.com'
|
||||
|
||||
## user configuration
|
||||
## uncomment to set user
|
||||
# export user='ray'
|
||||
# export user_pass='ray'
|
||||
# export group='ray'
|
||||
|
||||
## ssh configuration
|
||||
# export ssh_root='root@wordpress-453075-1468300.cloudwaysapps.com' # we do not have root access
|
||||
export ssh_user='test123@wordpress-453075-1468300.cloudwaysapps.com'
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# apache2_version='latest'
|
||||
|
||||
#nginx_version='latest'
|
||||
|
||||
## specify specific version from latest, 54, 55, 56, 70, 71, 72, 73 or 74
|
||||
#export litespeed_version='latest'
|
||||
|
||||
######################
|
||||
# litespeed specific #
|
||||
######################
|
||||
|
||||
## litespeed php version
|
||||
#export ls_lsphp_version='73'
|
||||
|
||||
## https://openlitespeed.org/kb/1-click-install/
|
||||
## password used to log into litespeed web interface
|
||||
#export ls_webadmin_pass='admin'
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
## wordpress configuration - uncomment if using wordpress
|
||||
|
||||
# export wp_user='admin'
|
||||
# export wp_pass='admin'
|
||||
# export wp_email='myemail@isnet.uk'
|
||||
|
||||
# export wp_version='latest'
|
||||
# export wp_path='/var/www/html/wordpress'
|
||||
# export wp_locale='en_GB'
|
||||
# export wp_title='The WordPress'
|
||||
|
||||
# export wp_db_name='wordpress'
|
||||
# export wp_db_user='wordpress'
|
||||
# export wp_db_pass='wordpress'
|
||||
|
||||
## list of themes to install - first one will be activated
|
||||
# export wp_themes="twentytwenty"
|
||||
|
||||
## list of plugins to install
|
||||
# export wp_plugins="akismet all-in-one-seo-pack"
|
||||
|
||||
## list of plugins to install and activate
|
||||
# export wp_plugins_active=""
|
|
@ -1 +0,0 @@
|
|||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEwwL1J52P0IuAWa+Ar3tCFOmT3A+V4F6/nz3JwGozCGaPrIqyOW7R3R+Y9UZZrxHYT7pt71lhNDQdN4Elhiix6Zkzrf4ZJRDfcyGvg7ZQGOG2nODybmW0TilnELtfjmtiaJ/2wBxNCiwdZAzFCb0kNKyXsUqx3b4NA7nKoxlVEdK1SZyaqwpe4oO6eoj6Nl2fPpLJ7Xq7VX83UJJPofPs3qUYOB2ywhKMljjbHDbQrRr+7Z3vQwmSs8sGI6qh1OHR7HZ2x8kVK507uwKXKPBlLGVKT2RDTslQiooNuuInBD/+DDegme+2arfnHIKB+GWK4Sun6aeN8UcMqA03GsRj dev-scripts@dev
|
|
@ -1,2 +0,0 @@
|
|||
|1|3oVXnt29xONh6+jmV3anxv2jUlE=|6FMJKCQKcgMN0RKsZPt4QcX/Dcw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEon87+GR5+/I0SwUrsf7TlKQFXkgyYxqnHC4YyZ2i9LbuCrGi3hPibV1tZL4FTyqrI87+uxnZRDznXY2lpLP8Y=
|
||||
|1|3oVXnt29xONh6+jmV3anxv2jUlE=|6FMJKCQKcgMN0RKsZPt4QcX/Dcw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEon87+GR5+/I0SwUrsf7TlKQFXkgyYxqnHC4YyZ2i9LbuCrGi3hPibV1tZL4FTyqrI87+uxnZRDznXY2lpLP8Y=
|
|
@ -1,3 +0,0 @@
|
|||
Files in here are not kept under version control.
|
||||
|
||||
Sensitive files should be kept in here.
|
72
install.sh
72
install.sh
|
@ -1,72 +0,0 @@
|
|||
#!/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_root" ] && echo "Error: no root ssh configuration specified" && exit 5
|
||||
|
||||
# update
|
||||
echo "Updating .."
|
||||
ssh -T $ssh_root << 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
|
|
@ -1,41 +0,0 @@
|
|||
#!/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
|
|
@ -1,17 +0,0 @@
|
|||
#!/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
|
|
@ -1,75 +0,0 @@
|
|||
#!/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
|
|
@ -1,23 +0,0 @@
|
|||
#!/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
|
23
pull-from.sh
23
pull-from.sh
|
@ -1,23 +0,0 @@
|
|||
#!/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
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
39
reset.sh
39
reset.sh
|
@ -1,39 +0,0 @@
|
|||
#!/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"
|
||||
|
||||
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
|
|
@ -1,26 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$apache2_version" != 'latest' ] ; then
|
||||
echo 'ERROR: unable to install Apache2 - only '"'latest'"' version currently supported'
|
||||
exit 30
|
||||
fi
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_root" ] && echo "Error: no root ssh configuration specified" && exit 5
|
||||
|
||||
ssh -T $ssh_root << EOSSH
|
||||
echo "Installing Apache2"
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
echo "Installing packages .."
|
||||
apt-get install -qq -y apache2
|
||||
echo "Packages installed"
|
||||
ufw allow in "WWW Full"
|
||||
|
||||
sed -i '/export APACHE_RUN_USER=/c\export APACHE_RUN_USER='"$user" /etc/apache2/envvars
|
||||
sed -i '/export APACHE_RUN_GROUP=/c\export APACHE_RUN_GROUP='"$group" /etc/apache2/envvars
|
||||
chown -R "$user:$group" "/var/www/html"
|
||||
echo "Nothing here ..." > /var/www/html/index.html
|
||||
systemctl restart apache2
|
||||
EOSSH
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_root" ] && echo "Error: no root ssh configuration specified" && exit 5
|
||||
|
||||
ssh -T $ssh_root << EOSSH
|
||||
|
||||
sed -i '/PubkeyAuthentication/c\PubkeyAuthentication yes' /etc/ssh/sshd_config
|
||||
sed -i '/PasswordAuthentication/c\PasswordAuthentication no' /etc/ssh/sshd_config
|
||||
sed -i '/PermitRootLogin/c\PermitRootLogin prohibit-password' /etc/ssh/sshd_config
|
||||
systemctl restart sshd
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
echo "Installing packages .."
|
||||
apt-get install -qq -y ufw || (echo "ERROR while installing ufw" ; exit 15)
|
||||
echo "Packages installed"
|
||||
|
||||
ufw allow ssh || (echo "Error while configuring ufw to allow ssh" ; exit 20 )
|
||||
yes | ufw enable
|
||||
|
||||
EOSSH
|
|
@ -1,79 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
_home_dir="/home/$user"
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_user" ] || [ -z "$ssh_root" ] && echo "Error: user and root ssh configuration must be specified" && exit 5
|
||||
|
||||
ssh -T $ssh_root << EOSSH
|
||||
|
||||
echo "Installing packages .."
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
echo "Installing packages .."
|
||||
apt-get -qq -y install curl gnupg2 ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip python-pip python3-pip fzf vim ctags
|
||||
echo "Packages installed"
|
||||
|
||||
echo "Installing lazygit .."
|
||||
curl -fsSL https://github.com/jesseduffield/lazygit/releases/download/v0.22.1/lazygit_0.22.1_Linux_x86_64.tar.gz --output /tmp/lazygit.tar.gz
|
||||
tar xf /tmp/lazygit.tar.gz -C /usr/local/bin/
|
||||
rm -v /tmp/lazygit.tar.gz
|
||||
|
||||
echo "Installing lf ..."
|
||||
curl -fsSL https://github.com/gokcehan/lf/releases/download/r16/lf-linux-amd64.tar.gz --output /tmp/lf.tar.gz
|
||||
tar xf /tmp/lf.tar.gz -C /usr/local/bin/
|
||||
rm -v /tmp/lf.tar.gz
|
||||
|
||||
echo "Installing neovim ..."
|
||||
git clone https://github.com/neovim/neovim /tmp/neovim
|
||||
cd /tmp/neovim
|
||||
make -s CMAKE_BUILD_TYPE=Release
|
||||
make -s install
|
||||
echo "Neovim installed"
|
||||
|
||||
if command -v php ; then
|
||||
echo "Installing composer .."
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
php -r "if (hash_file('sha384', 'composer-setup.php') === '8a6138e2a05a8c28539c9f0fb361159823655d7ad2deecb371b04a83966c61223adc522b0189079e3e9e277cd72b8897') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
|
||||
php composer-setup.php --filename=composer --install-dir=/usr/local/bin
|
||||
php -r "unlink('composer-setup.php');"
|
||||
fi
|
||||
|
||||
EOSSH
|
||||
ssh -T $ssh_root << EOSSH
|
||||
|
||||
su "$user"
|
||||
|
||||
echo "Installing nvm ..."
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
echo 'export NVM_DIR="\$HOME/.nvm"' >> "$_home_dir/.profile"
|
||||
echo '[ -s "\$NVM_DIR/nvm.sh" ] && \. "\$NVM_DIR/nvm.sh"' >> "$_home_dir/.profile"
|
||||
|
||||
EOSSH
|
||||
ssh -T $ssh_root << EOSSH
|
||||
|
||||
su --login "$user"
|
||||
. ./.profile
|
||||
nvm install --lts --latest-npm
|
||||
|
||||
EOSSH
|
||||
ssh -T $ssh_user << EOSSH
|
||||
. ./.profile
|
||||
echo "Configuring neovim ..."
|
||||
npm install -g neovim
|
||||
python2 -m pip install --user --upgrade pynvim
|
||||
python3 -m pip install --user --upgrade pynvim
|
||||
python3 -m pip install --user --upgrade neovim-remote
|
||||
git clone ssh://git@git.rayelliott.dev:3222/dots/nvim.git $_home_dir/.config/nvim
|
||||
curl -fLo $_home_dir/.config/nvim/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
nvim --headless +PlugInstall +qall
|
||||
|
||||
echo "Configuring lf .."
|
||||
lf config
|
||||
if [ -e "$_home_dir/.config/lf" ] ; then
|
||||
mv -v "$_home_dir/.config/lf" "$_home_dir/.config/lf-original-$(date +%s)"
|
||||
fi
|
||||
git clone ssh://git@git.rayelliott.dev:3222/dots/lf.git "$_home_dir/.config/lf"
|
||||
|
||||
EOSSH
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$mariadb_version" != 'latest' ] ; then
|
||||
echo 'ERROR: unable to install MariaDB - only '"'latest'"' version currently supported'
|
||||
exit 30
|
||||
fi
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_root" ] && echo "Error: no root ssh configuration specified" && exit 5
|
||||
|
||||
_mysql_cmd="mysql -uroot -e "
|
||||
|
||||
ssh -T $ssh_root << EOSSH
|
||||
if mysql --version ; then
|
||||
echo "ERROR: unable to install MariaDb, 'mysql' already installed - aborting install"
|
||||
exit 35
|
||||
fi
|
||||
echo "Installing MariaDB"
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
echo "Installing packages .."
|
||||
apt-get install -qq -y mariadb-server
|
||||
echo "Packages installed"
|
||||
|
||||
$_mysql_cmd "DELETE FROM mysql.user WHERE User='';"
|
||||
$_mysql_cmd "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
|
||||
$_mysql_cmd "DROP DATABASE IF EXISTS test;"
|
||||
$_mysql_cmd "DELETE FROM mysql.db WHERE Db='test' OR Db='"'test\\_%'"'"
|
||||
|
||||
$_mysql_cmd "CREATE DATABASE $db_name;"
|
||||
$_mysql_cmd "GRANT ALL PRIVILEGES ON $db_name.* TO '$db_user'@'localhost' IDENTIFIED BY '$db_pass';"
|
||||
$_mysql_cmd "FLUSH PRIVILEGES;"
|
||||
|
||||
mysqladmin --user=root password "$db_root_pass"
|
||||
mysqladmin --user=root --password="$db_root_pass" flush-privileges
|
||||
EOSSH
|
|
@ -1,36 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$mysql_version" != 'latest' ] ; then
|
||||
echo 'ERROR: unable to install MySQL - only '"'latest'"' version currently supported'
|
||||
exit 30
|
||||
fi
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_root" ] && echo "Error: no root ssh configuration specified" && exit 5
|
||||
|
||||
_mysql_cmd="mysql -uroot -e "
|
||||
|
||||
ssh -T $ssh_root << EOSSH
|
||||
if mysql --version ; then
|
||||
echo "ERROR: unable to install MySQL, 'mysql' already installed - aborting install"
|
||||
exit 35
|
||||
fi
|
||||
echo "Installing MySQL"
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
echo "Installing packages .."
|
||||
apt-get install -qq -y mysql-server
|
||||
echo "Packages installed"
|
||||
|
||||
$_mysql_cmd "DELETE FROM mysql.user WHERE User='';"
|
||||
$_mysql_cmd "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
|
||||
$_mysql_cmd "DROP DATABASE IF EXISTS test;"
|
||||
$_mysql_cmd "DELETE FROM mysql.db WHERE Db='test' OR Db='"'test\\_%'"'"
|
||||
|
||||
$_mysql_cmd "CREATE DATABASE $db_name;"
|
||||
$_mysql_cmd "GRANT ALL PRIVILEGES ON $db_name.* TO '$db_user'@'localhost' IDENTIFIED BY '$db_pass';"
|
||||
$_mysql_cmd "FLUSH PRIVILEGES;"
|
||||
|
||||
mysqladmin --user=root password "$db_root_pass"
|
||||
mysqladmin --user=root --password="$db_root_pass" flush-privileges
|
||||
EOSSH
|
|
@ -1,37 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$php_version" != 'latest' ] ; then
|
||||
echo 'ERROR: unable to install PHP - only '"'latest'"' version currently supported'
|
||||
exit 30
|
||||
fi
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_root" ] && echo "Error: no root ssh configuration specified" && exit 5
|
||||
|
||||
if [ -n "$wp_user" ] ; then
|
||||
echo 'Installing PHP for WordPress ...'
|
||||
|
||||
ssh -T $ssh_root << 'EOSSH'
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
echo "Installing packages .."
|
||||
apt-get install -qq -y php libapache2-mod-php php-fpm php-bcmath php-curl php-gd php-imagick php-mbstring \
|
||||
php-mysql php-soap php-xml php-zip
|
||||
echo "Packages installed"
|
||||
|
||||
_php_config_file=$(php --ini | grep Loaded | awk '{ print $4 }')
|
||||
sed -i '/memory_limit/c\memory_limit = 256M' "$_php_config_file"
|
||||
sed -i '/upload_max_filesize/c\upload_max_filesize = 64M' "$_php_config_file"
|
||||
sed -i '/post_max_size/c\post_max_size = 64M' "$_php_config_file"
|
||||
sed -i '/max_execution_time/c\max_execution_time = 300M' "$_php_config_file"
|
||||
sed -i '/max_input_time/c\max_input_time = 1000' "$_php_config_file"
|
||||
EOSSH
|
||||
else
|
||||
echo 'Installing default PHP ...'
|
||||
|
||||
ssh -T $ssh_root << EOSSH
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
echo "Installing packages .."
|
||||
apt-get install -qq -y php libapache2-mod-php php-mysql
|
||||
echo "Packages installed"
|
||||
EOSSH
|
||||
fi
|
|
@ -1,73 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_root" ] && echo "Error: no root ssh configuration specified" && exit 5
|
||||
|
||||
_home_dir="/home/$user"
|
||||
|
||||
ssh -T $ssh_root << EOSSH
|
||||
echo "Creating user .."
|
||||
useradd -m -d "$_home_dir" "$user"
|
||||
echo "$user:$user_pass" | chpasswd
|
||||
usermod -aG sudo "$user"
|
||||
EOSSH
|
||||
|
||||
echo "Configuring ssh .."
|
||||
|
||||
ssh $ssh_root mkdir -v -p "$_home_dir/.ssh"
|
||||
scp files/private/id_rsa "$ssh_root:$_home_dir/.ssh/"
|
||||
scp files/id_rsa.pub "$ssh_root:$_home_dir/.ssh/"
|
||||
scp files/known_hosts "$ssh_root:$_home_dir/.ssh/"
|
||||
|
||||
ssh -T $ssh_root << EOSSH
|
||||
cp -v /root/.ssh/authorized_keys "$_home_dir/.ssh/authorized_keys"
|
||||
chown -v -R "$user:$group" "$_home_dir/.ssh"
|
||||
|
||||
echo "Adding user: $user"
|
||||
|
||||
if [ -f /etc/locale.gen ] && command -v locale-gen ; then
|
||||
echo 'en_GB.UTF-8 UTF-8' > /etc/locale.gen
|
||||
locale-gen
|
||||
echo 'LANG="en_GB.UTF-8"' > /etc/default/locale
|
||||
else
|
||||
echo 'Warning: cannot set locale'
|
||||
fi
|
||||
|
||||
echo "Installing required packages .."
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
echo "Installing packages .."
|
||||
apt-get -qq -y install sudo git tmux zsh curl
|
||||
echo "Packages installed"
|
||||
|
||||
echo "Cloning configuration files .."
|
||||
su --login "$user"
|
||||
git config --global user.name rayelliott
|
||||
git config --global user.email dev@rayelliott.dev
|
||||
mkdir -v -p "$_home_dir/.config"
|
||||
|
||||
if [ -e "$_home_dir/.config/profile" ] ; then
|
||||
mv -v "$_home_dir/.config/profile" "$_home_dir/.config/profile-original-$(date +%s)"
|
||||
fi
|
||||
git clone ssh://git@git.rayelliott.dev:3222/dots/profile.git "$_home_dir/.config/profile"
|
||||
"$_home_dir/.config/profile/install.sh"
|
||||
|
||||
if [ -e "$_home_dir/.config/tmux" ] ; then
|
||||
mv -v "$_home_dir/.config/tmux" "$_home_dir/.config/tmux-original-$(date +%s)"
|
||||
fi
|
||||
git clone ssh://git@git.rayelliott.dev:3222/dots/tmux.git "$_home_dir/.config/tmux"
|
||||
"$_home_dir/.config/tmux/install.sh"
|
||||
|
||||
if [ -e "$_home_dir/.config/zsh" ] ; then
|
||||
mv -v "$_home_dir/.config/zsh" "$_home_dir/.config/zsh-original-$(date +%s)"
|
||||
fi
|
||||
git clone ssh://git@git.rayelliott.dev:3222/dots/zsh.git "$_home_dir/.config/zsh"
|
||||
"$_home_dir/.config/zsh/install.sh"
|
||||
EOSSH
|
||||
|
||||
ssh -T $ssh_root << EOSSH
|
||||
chsh -s /usr/bin/zsh "$user"
|
||||
EOSSH
|
||||
|
||||
echo "Configuring wakatime plugin .."
|
||||
pwd
|
||||
scp files/private/wakatime.cfg "$user@$domain:/home/$user/.wakatime.cfg"
|
|
@ -1,114 +0,0 @@
|
|||
echo "Installing WordPress .."
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_user" ] || [ -z "$ssh_root" ] && echo "Error: user and root ssh configuration must be specified" && exit 5
|
||||
|
||||
ssh -T $ssh_root << EOSSH
|
||||
|
||||
# install wp-cli first
|
||||
if [ ! -f /usr/local/bin/wp ] ; then
|
||||
wget -nv -O /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
|
||||
&& chmod +x /usr/local/bin/wp
|
||||
fi
|
||||
EOSSH
|
||||
|
||||
ssh -T $ssh_user << EOSSH
|
||||
if wp core is-installed --quiet --path="$wp_path" ; then
|
||||
echo "WordPress already installed"
|
||||
else
|
||||
wp core download \
|
||||
--version="$wp_version" \
|
||||
--path="$wp_path" \
|
||||
--skip-content \
|
||||
--locale="$wp_locale"
|
||||
wp config create \
|
||||
--path="$wp_path" \
|
||||
--dbname="$db_name" \
|
||||
--dbuser="$db_user" \
|
||||
--dbpass="$db_pass" \
|
||||
--locale="$wp_locale" \
|
||||
--extra-php <<PHP
|
||||
define( 'WP_DEBUG', true );
|
||||
define( 'WP_DEBUG_LOG', true );
|
||||
PHP
|
||||
wp core install \
|
||||
--path="$wp_path" \
|
||||
--url="$domain" \
|
||||
--title="$wp_title" \
|
||||
--admin_user="$wp_user" \
|
||||
--admin_password="$wp_pass" \
|
||||
--admin_email="$wp_email"
|
||||
fi
|
||||
EOSSH
|
||||
|
||||
if [ -n "$wp_themes" ] ; then
|
||||
printf "\nInstalling themes ..."
|
||||
option='--activate'
|
||||
for theme in $wp_themes ; do
|
||||
echo " installing $theme ..."
|
||||
ssh -T $ssh_user << EOSSH
|
||||
wp theme install $theme "$option" --path="$wp_path"
|
||||
EOSSH
|
||||
option=''
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$wp_plugins" ] ; then
|
||||
printf "\nInstalling plugins ..."
|
||||
for plugin in $wp_plugins ; do
|
||||
echo " installing $plugin ..."
|
||||
ssh -T $ssh_user << EOSSH
|
||||
wp plugin install $plugin --path="$wp_path"
|
||||
EOSSH
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$wp_plugins_active" ] ; then
|
||||
printf "\nInstalling plugins to activate ..."
|
||||
for plugin in $wp_plugins_active ; do
|
||||
echo " installing $plugin ..."
|
||||
ssh -T $ssh_user << EOSSH
|
||||
wp plugin install $plugin --activate --path="$wp_path"
|
||||
EOSSH
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$wp_plugins_active" ] ; then
|
||||
printf "\nUninstalling plugins ..."
|
||||
for plugin in $wp_plugins_uninstall ; do
|
||||
echo " installing $plugin ..."
|
||||
ssh -T $ssh_user << EOSSH
|
||||
wp plugin deactivate $plugin --path="$wp_path"
|
||||
wp plugin uninstall $plugin --path="$wp_path"
|
||||
EOSSH
|
||||
done
|
||||
fi
|
||||
|
||||
config_path='/etc/apache2/sites-available/wordpress.conf'
|
||||
ssh -T $ssh_root << EOSSH
|
||||
if [ -n "$apache2_version" ] ; then
|
||||
mkdir -p /var/log/wordpress/
|
||||
cat << EOF > $config_path
|
||||
<VirtualHost *:80>
|
||||
ServerName $domain
|
||||
DocumentRoot $wp_path
|
||||
ErrorLog /var/log/wordpress/error.log
|
||||
CustomLog /var/log/wordpress/access.log combined
|
||||
<Directory $wp_path/>
|
||||
AllowOverride All
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /index.php [L]
|
||||
</IfModule>
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
EOF
|
||||
a2enmod rewrite
|
||||
a2ensite wordpress
|
||||
a2dissite 000-default
|
||||
systemctl reload apache2
|
||||
fi
|
||||
EOSSH
|
|
@ -1,19 +0,0 @@
|
|||
echo "Removing WordPress .."
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_user" ] && echo "Error: no user ssh configuration specified" && exit 5
|
||||
|
||||
_mysql_cmd="mysql -u$db_user -p$db_pass -e "
|
||||
|
||||
ssh -T $ssh_user << EOSSH
|
||||
# remove database
|
||||
if command -v mysql ; then
|
||||
$_mysql_cmd "DROP DATABASE $db_name;"
|
||||
$_mysql_cmd "CREATE DATABASE $db_name;"
|
||||
else
|
||||
echo "ERROR: mysql not found - aborting WordPress removal"
|
||||
exit 40
|
||||
fi
|
||||
# remove files
|
||||
rm -Rf $wp_path
|
||||
EOSSH
|
|
@ -1,32 +0,0 @@
|
|||
#!/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
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/sh
|
||||
|
||||
_user="www-data"
|
||||
_home_dir="/home/$_user"
|
||||
|
||||
echo "Installing packages .."
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
echo "Installing packages .."
|
||||
apt-get -qq -y install curl gnupg2 ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip python-pip python3-pip fzf vim ctags git
|
||||
|
||||
echo "----------------------------------------------------------------------------"
|
||||
echo "Installing lazygit .."
|
||||
curl -fsSL https://github.com/jesseduffield/lazygit/releases/download/v0.22.1/lazygit_0.22.1_Linux_x86_64.tar.gz --output /tmp/lazygit.tar.gz
|
||||
tar xf /tmp/lazygit.tar.gz -C /usr/local/bin/
|
||||
rm -v /tmp/lazygit.tar.gz
|
||||
|
||||
echo "----------------------------------------------------------------------------"
|
||||
echo "Installing lf ..."
|
||||
curl -fsSL https://github.com/gokcehan/lf/releases/download/r16/lf-linux-amd64.tar.gz --output /tmp/lf.tar.gz
|
||||
tar xf /tmp/lf.tar.gz -C /usr/local/bin/
|
||||
rm -v /tmp/lf.tar.gz
|
||||
|
||||
echo "----------------------------------------------------------------------------"
|
||||
echo "Installing neovim ..."
|
||||
git clone https://github.com/neovim/neovim /tmp/neovim
|
||||
cd /tmp/neovim
|
||||
make -s CMAKE_BUILD_TYPE=Release
|
||||
make -s install
|
||||
|
||||
if command -v php ; then
|
||||
echo "Installing composer .."
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
# php -r "if (hash_file('sha384', 'composer-setup.php') === '8a6138e2a05a8c28539c9f0fb361159823655d7ad2deecb371b04a83966c61223adc522b0189079e3e9e277cd72b8897') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
|
||||
php composer-setup.php --filename=composer --install-dir=/usr/local/bin
|
||||
php -r "unlink('composer-setup.php');"
|
||||
fi
|
||||
|
||||
echo "----------------------------------------------------------------------------"
|
||||
echo "Installing nvm ..."
|
||||
su --login "$_user" -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash'
|
||||
echo 'export NVM_DIR="$HOME/.nvm"' >> "$_home_dir/.profile"
|
||||
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> "$_home_dir/.profile"
|
||||
su --login "$_user" -c 'nvm install --lts --latest-npm'
|
||||
|
||||
echo "----------------------------------------------------------------------------"
|
||||
echo "Configuring neovim ..."
|
||||
su --login "$_user" -c 'npm install -g neovim \
|
||||
&& python2 -m pip install --user --upgrade pynvim \
|
||||
&& python3 -m pip install --user --upgrade pynvim \
|
||||
&& python3 -m pip install --user --upgrade neovim-remote'
|
||||
su --login "$_user" -c 'git clone https://git.rayelliott.dev/dots/nvim.git "$HOME"/.config/nvim \
|
||||
&& curl -fLo "$HOME"/.config/nvim/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim \
|
||||
&& nvim --headless +PlugInstall +qall'
|
||||
|
||||
echo "----------------------------------------------------------------------------"
|
||||
echo "Configuring lf .."
|
||||
su --login "$_user" -c 'git clone https://git.rayelliott.dev/dots/lf.git "$HOME"/.config/lf'
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
_remote_mysql_user='qfyjgprzay'
|
||||
_remote_mysql_pass='XgxJ5vTbz2'
|
||||
_remote_mysql_db='qfyjgprzay'
|
||||
|
||||
ssh octobercms@staging.rayelliott.dev "mysqldump -u$_remote_mysql_user -p$_remote_mysql_pass $_remote_mysql_db | gzip -9" > dbremote.sql.gz
|
||||
gunzip dbremote.sql.gz
|
||||
mysql -uroot october < dbremote.sql
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
_remote_base_dir='public_html'
|
||||
_remote_ssh='octobercms@staging.rayelliott.dev'
|
||||
|
||||
rsync -azP "$_remote_ssh:$_remote_base_dir/storage $_remote_base_dir/themes $_remote_base_dir/plugins" /srv/octobercms/ --delete-before
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
|
||||
# NOTE - if changing the user, then the will need to edit apache config also
|
||||
_user="www-data"
|
||||
|
||||
sudo apt install -y php php-ctype php-fileinfo php-sqlite3 php-cli php-mysql php-zip php-json php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-pdo openssl mariadb-server vim unzip curl
|
||||
|
||||
sudo mysql -uroot << EOSQL
|
||||
UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE User = 'root';
|
||||
CREATE USER 'october'@'localhost' IDENTIFIED BY 'october';
|
||||
CREATE DATABASE october;
|
||||
GRANT ALL ON october.* TO 'october'@'localhost' WITH GRANT OPTION;
|
||||
FLUSH PRIVILEGES;
|
||||
EOSQL
|
||||
|
||||
sudo apt -y install apache2 libapache2-mod-php
|
||||
|
||||
mkdir /srv/octobercms && cd /srv/octobercms
|
||||
php -r "eval('?>'.file_get_contents('https://octobercms.com/api/installer'));"
|
||||
sudo chown -R "$_user":"$_user" /srv/octobercms
|
||||
sudo -u "$_user" php artisan october:install
|
||||
|
||||
cat << 'EOF' > octobercms.conf
|
||||
<VirtualHost *:80>
|
||||
DocumentRoot /srv/octobercms/
|
||||
ServerName october.home
|
||||
ServerAlias october.home
|
||||
|
||||
<Directory /srv/octobercms/>
|
||||
Options +FollowSymlinks
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
ErrorLog /var/log/apache2/octobercms-error.log
|
||||
CustomLog /var/log/apache2/octobercms-access.log combined
|
||||
</VirtualHost>
|
||||
EOF
|
||||
|
||||
sudo mv octobercms.conf /etc/apache2/sites-enabled/
|
||||
sudo chown root:root /etc/apache2/sites-enabled/octobercms.conf
|
||||
sudo rm /etc/apache2/sites-available/000-default.conf
|
||||
sudo a2enmod rewrite
|
||||
sudo systemctl restart apache2
|
||||
|
||||
echo "Now open 'http://localhost/backend/'"
|
|
@ -1,19 +0,0 @@
|
|||
echo "Removing WordPress .."
|
||||
|
||||
# check we have ssh access
|
||||
[ -z "$ssh_user" ] && echo "Error: no user ssh configuration specified" && exit 5
|
||||
|
||||
_mysql_cmd="mysql -u$db_user -p$db_pass -e "
|
||||
|
||||
ssh -T $ssh_user << EOSSH
|
||||
# remove database
|
||||
if command -v mysql ; then
|
||||
$_mysql_cmd "DROP DATABASE $db_name;"
|
||||
$_mysql_cmd "CREATE DATABASE $db_name;"
|
||||
else
|
||||
echo "ERROR: mysql not found - aborting WordPress removal"
|
||||
exit 40
|
||||
fi
|
||||
# remove files
|
||||
rm -Rf $wp_path
|
||||
EOSSH
|
|
@ -0,0 +1,3 @@
|
|||
Tools to export/import and backup/restore local and remote WordPress installations' database and
|
||||
`wp-content/` files.
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./config
|
||||
|
||||
time="$(date +%s)"
|
||||
[ -n "$1" ] && base_filename="$1-$time" || base_filename="backup-$time"
|
||||
|
||||
echo "backing up to $base_filename"
|
||||
|
||||
ssh "$remote_ssh" mkdir "/tmp/$base_filename"
|
||||
ssh "$remote_ssh" tar -czf "/tmp/$base_filename/$base_filename.tar" "$remote_wp_path/wp-content"
|
||||
wp db export "/tmp/$base_filename/$base_filename.sql" --ssh="$remote_ssh$remote_wp_path" --add-drop-table
|
||||
|
||||
scp -r "$remote_ssh:/tmp/$base_filename" . && ssh "$remote_ssh" rm -r "/tmp/$base_filename"
|
|
@ -0,0 +1,8 @@
|
|||
remote_protocol='https'
|
||||
remote_domain='remote.cloudwaysapps.com'
|
||||
remote_ssh='user@remote.cloudwaysapps.com'
|
||||
remote_wp_path='/home/remote.cloudwaysapps.com/aabbccddee/public_html'
|
||||
|
||||
local_protocol='http'
|
||||
local_domain='local.local'
|
||||
local_wp_path='/var/www/html/wordpress'
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./config
|
||||
|
||||
rsync -azP "$local_wp_path/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_protocol://$local_domain" "$remote_protocol://$remote_domain" \
|
||||
--ssh="$remote_ssh$remote_wp_path" \
|
||||
--skip-columns=guid
|
||||
--quiet
|
||||
|
||||
wp search-replace "$local_domain" "$remote_domain" \
|
||||
--ssh="$remote_ssh$remote_wp_path" \
|
||||
--skip-columns=guid
|
||||
--quiet
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./config
|
||||
|
||||
rsync -azP "$remote_ssh:$remote_wp_path/wp-content/" "$local_wp_path/wp-content" --delete-before
|
||||
|
||||
echo "DB size before:"
|
||||
wp db size --path="$local_wp_path"
|
||||
wp db export --ssh="$remote_ssh$remote_wp_path" --add-drop-table - | wp db import --path="$local_wp_path" -
|
||||
echo "DB size after:"
|
||||
wp db size --path="$local_wp_path"
|
||||
|
||||
wp search-replace "$remote_protocol://$remote_domain" "$local_protocol://$local_domain" \
|
||||
--path="$local_wp_path" \
|
||||
--skip-columns=guid \
|
||||
--quiet
|
||||
|
||||
wp search-replace "$remote_domain" "$local_domain" \
|
||||
--path="$local_wp_path" \
|
||||
--skip-columns=guid \
|
||||
--quiet
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./config
|
||||
|
||||
[ -z "$1" ] && echo "Error - must supply backup directory" && exit 45
|
||||
! [ -d "$1" ] && echo "Error - '$1' not a directory" && exit 65
|
||||
|
||||
backup_dir="$1"
|
||||
timestamp="$(date +%s)"
|
||||
backup_dir_dest="/tmp/wp-content-$timestamp"
|
||||
backup_db_dest="/tmp/wp-db-$timestamp"
|
||||
|
||||
echo "restoring from $backup_dir"
|
||||
|
||||
ssh "$remote_ssh" "mv $remote_wp_path/wp-content $backup_dir_dest"
|
||||
# TODO - only continue if backup succesful
|
||||
echo "remote wp-content backed up as: $backup_dir_dest"
|
||||
cat "$backup_dir/$backup_dir.tar" | ssh "$remote_ssh" "cd /; tar zxvf -"
|
||||
|
||||
# TODO - test database backup works
|
||||
ssh "$remote_ssh" "wp db export $backup_db_dest --path=$remote_wp_path"
|
||||
# TODO - only continue if backup succesful
|
||||
echo "remote database backed up as: $backup_db_dest"
|
||||
cat "./$backup_dir/$backup_dir.sql" | wp db import --ssh="$remote_ssh$remote_wp_path" -
|
||||
|
||||
wp search-replace "$local_protocol://$local_domain" "$remote_protocol://$remote_domain" \
|
||||
--ssh="$remote_ssh$remote_wp_path" \
|
||||
--skip-columns=guid \
|
||||
--quiet
|
||||
|
||||
wp search-replace "$local_domain" "$remote_domain" \
|
||||
--ssh="$remote_ssh$remote_wp_path" \
|
||||
--skip-columns=guid \
|
||||
--quiet
|
Loading…
Reference in New Issue