Domain Script for VestaCP + WHMCS (deploy tool)

Section with additional software for Vesta
nosov
Posts: 1
Joined: Thu Oct 27, 2016 5:36 pm

Domain Script for VestaCP + WHMCS (deploy tool)

Postby nosov » Sun Aug 27, 2017 7:58 pm

Hello everyone.
I create tool for install custom wordpress or other cms from whmcs.

Image


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


OR replace

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


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()

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/
}



WordPress
You can install wp-cli by manual http://wp-cli.org and use in WHMCS DomainScript

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="wp@example.com"
$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  "
}



So, you can add more whmcs products for combination wp themes and plugins.




GitRepo: https://github.com/smlex/DomainScript

Phogo
Posts: 32
Joined: Fri Dec 09, 2016 12:40 pm

Re: Domain Script for VestaCP + WHMCS (deploy tool)

Postby Phogo » Mon Aug 28, 2017 10:13 am

Looks great! Thank you will give it a go later.


Return to “3rd Party Software”



Who is online

Users browsing this forum: No registered users and 4 guests