Compare commits

...

5 Commits

Author SHA1 Message Date
Ray Elliott ce0dc65590 add cloudways config 2020-09-05 12:01:33 +01:00
Ray Elliott 29861e9be2 update 2020-09-05 11:47:08 +01:00
Ray Elliott 40f17c5a8e load configuration based on target 2020-09-05 11:46:59 +01:00
Ray Elliott b624a6e8cb comment out options 2020-09-05 11:46:17 +01:00
Ray Elliott b16fe3f73c combine install-local.sh and install-remote.sh 2020-09-05 11:10:14 +01:00
14 changed files with 106 additions and 84 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
files/private
*.secret

View File

@ -7,6 +7,4 @@ Development environment base packages:
## TODO
* combine install-local.sh and install-remote.sh into one script that takes
an argument of local/remote
* get remote working with cloudways

View File

@ -1,4 +1,4 @@
## apache configuration
#
## uncomment if using apache
#apache2_version='latest'
# apache2_version='latest'

8
config/remote/cloudways Normal file
View File

@ -0,0 +1,8 @@
# cloudways configuration
. ./config/remote/cloudways.secret
cloudways_user='cloudways@rayelliott.dev'
cloudways_url='https://wordpress-453075-1468300.cloudwaysapps.com'
cloudways_db_name='mhhusspndh'
cloudways_db_user='mhhusspndh'

View File

@ -9,5 +9,5 @@
## https://openlitespeed.org/kb/1-click-install/
## password used to log into litespeed web interface
#export ls_webadmin_pass='x7__+85676--Dd'
#export ls_webadmin_pass='admin'

View File

@ -1,3 +1,4 @@
## uncomment if using mariadb
#mariadb_version='latest'
# mariadb_version='latest'
# db_root_pass='9483ujtej0--=0FFFdl'

View File

@ -1,2 +1,3 @@
## uncomment if using mysql
#mysql_version='latest'
#db_root_pass='9483ujtej0--=0FFFdl'

View File

@ -1,5 +1,5 @@
## php configuration
#
## uncomment if using php
#php_version='latest'
# php_version='latest'

View File

@ -1,5 +1,5 @@
## ssh configuration
## uncomment if connecting via ssh
#export ssh='root@test123.example.com'
# export ssh='root@test123.isnet.uk'

View File

@ -1,7 +1,6 @@
## user configuration
## uncomment to set user
## webuser/webgroup
## leave commented for default
#export webuser='www-data'
#export webgroup='www-data'
# export user='ray'
# export user_pass='ray'
# export group='ray'

View File

@ -1,24 +1,23 @@
## wordpress configuration - uncomment if using wordpress
# 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_locale='en_GB'
# export wp_title='The WordPress'
# export db_root_pass='9dn,s93j_UU9--s889d8dUY'
# export wp_db_name='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"
## 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=""
## list of plugins to uninstall
# export wp_plugins_uninstall="hello aksimet"

View File

@ -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

View File

77
install.sh Executable file
View File

@ -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