Domain Script for VestaCP + WHMCS (deploy tool)
Posted: Sun Aug 27, 2017 7:58 pm
Hello everyone.
I create tool for install custom wordpress or other cms from whmcs.
First.
You need WHMCS and VestaCP.
Second
Install patched vesta module to whmcs
And modify bin/v-add-web-domain. Pls paste this before # Preparing domain aliases
OR replace
P/s. Maybe you need apt-get install dos2unix or yum install dos2unix
Third
Pls setup Module Settings in WHMCS Edit Product. Your script must have function deploy()
GitRepo: https://github.com/smlex/DomainScript
I create tool for install custom wordpress or other cms from whmcs.
First.
You need WHMCS and VestaCP.
Second
Install patched vesta module to whmcs
Code: Select all
cd /home/user/web/whmcs/public_html/modules/server
mkdir vesta
wget https://raw.githubusercontent.com/smlex/DomainScript/master/modules/servers/vesta/vesta.php -O vesta.php
And modify bin/v-add-web-domain. Pls paste this before # Preparing domain aliases
Code: Select all
# Run domain script
if [ -e "$VESTA/data/deploy/v_$domain.sh" ]; then
dos2unix "$VESTA/data/deploy/v_$domain.sh"
chmod +x "$VESTA/data/deploy/v_$domain.sh"
source "$VESTA/data/deploy/v_$domain.sh"
deploy
fi
# Preparing domain aliases
Code: Select all
cd /usr/local/vesta/bin/
wget https://raw.githubusercontent.com/smlex/DomainScript/master/vestacp/bin/v-add-web-domain -O v-add-web-domain
Third
Pls setup Module Settings in WHMCS Edit Product. Your script must have function deploy()
Code: Select all
#!/bin/bash
deploy(){
cp /home/robots.txt $HOMEDIR/$user/web/$domain/public_html/robots.txt
chown -R $user:$user $HOMEDIR/$user/web/$domain
chmod 777 $HOMEDIR/$user/web/$domain/public_html/
}
WordPressShow
You can install wp-cli by manual http://wp-cli.org and use in WHMCS DomainScript
So, you can add more whmcs products for combination wp themes and plugins.
Code: Select all
#!/bin/bash
deploy(){
cnpass=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13)
password=$(LC_CTYPE=C tr -dc A-Za-z0-9_\!\@\#\$\%\^\&\*\(\)-+= < /dev/urandom | head -c 12)
password=$cnpass
dbname=${domain//./}
dbname=`echo $dbname | cut -c1-4`
username=$user"_"$dbname
$BIN/v-add-database $user $dbname $dbname $cnpass mysql localhost
rm -rf $HOMEDIR/$user/web/$domain/public_html/*
WPATH=$HOMEDIR"/"$user"/web/"$domain"/public_html/"
WP_CLI="/usr/local/bin/wp --allow-root --quiet --path="$WPATH
$WP_CLI core download
$WP_CLI core config --dbname=$username --dbuser=$username --dbpass=$cnpass
$WP_CLI db create
$WP_CLI core install --url="http://$domain/" --title="$domain" --admin_user="$user" --admin_password="$password" --admin_email="[email protected]"
$WP_CLI plugin install drafts-scheduler --activate
$WP_CLI plugin install cybersyn --activate
$WP_CLI plugin install rss-post-importer --activate
cp /home/robots.txt $HOMEDIR/$user/web/$domain/public_html/robots.txt
chown -R $user:$user $HOMEDIR/$user/web/$domain
chmod 777 $HOMEDIR/$user/web/$domain/public_html/
log_history "Install wp. <a target="_black" href="http://$domain/wp-admin">$domain</a> $user:$password db $username $cnpass "
}
GitRepo: https://github.com/smlex/DomainScript