Administration of XtendWeb plugin

The end user and administrator has an intuitive UI for managing domains hosted on cPanel and other settings

XtendWeb does not require constant maintenance .It is meant to do things on its own with input from cPanel end users

Quick Reference of scripts for sysadmins

# Enable or disable the plugin .
/opt/nDeploy/scripts/cpanel-nDeploy-setup.sh disable
/opt/nDeploy/scripts/cpanel-nDeploy-setup.sh enable

# Automatically fix all errors.Can be run if you notice nginx config error or php error etc
# Following will regenerate all config and restart associated services. Use force only if normal run does not fix
/opt/nDeploy/scripts/attempt_autofix.sh
/opt/nDeploy/scripts/attempt_autofix.sh force  # force regenerate
/opt/nDeploy/scripts/init_backends.py autofix # fix php-fpm app server issue


# A best effort to switch as many websites as possible to native nginx
# See file /opt/nDeploy/conf/appsignatures.yaml for switching logic
# Add username to /opt/nDeploy/conf/auto_config.exclude to exclude a specific user
/opt/nDeploy/scripts/switch_to_native_nginx.sh


#Install various application servers
/opt/nDeploy/scripts/easy_php_setup.sh
/opt/nDeploy/scripts/easy_hhvm_setup.sh
/opt/nDeploy/scripts/easy_passenger_setup.sh

#Install netdata monitoring
/opt/nDeploy/scripts/easy_netdata_setup.sh

# Restart application server .note that Passenger apps gets restarted with nginx
systemctl restart ndeploy_backends  # PHP
systemctl restart ndeploy_hhvm@USER  #HHVM

# Retart cluster file syncing service
systemctl restart ndeploy_unison


# Adding/removing application servers
/opt/nDeploy/scripts/update_backend.py [add|del] backend_category backend_name backend_path

# Adding/removing application template (generic)
/opt/nDeploy/scripts/update_profiles.py [add|del] [root|cpanelusername] [main|subdir] [backend] [templatefilename] [quoted description]
# Examples
/opt/nDeploy/scripts/update_profiles.py add root main PHP 5001.j2 "Wordpress"
/opt/nDeploy/scripts/update_profiles.py add root subdir PHP 5001_subdir.j2 "Wordpress in subdir"
/opt/nDeploy/scripts/update_profiles.py add cpanelusername main PHP 5001.j2 "Wordpress"
/opt/nDeploy/scripts/update_profiles.py add cpanelusername subdir PHP 5001_subdir.j2 "Wordpress in subdir"

Config Generation logic and customizations

Config generation is based on Templates and YAML settings ( Jinja2 templating engine and YAML settings ) For generating a single nginx vhost following files are parsed in order .The customization filename are mentioned beside them in brackets If the file mentioned in brackets is present, it is used instead of the Xtendweb package provided one A Sysadmin mostly only need to add /edit application templates and this use minimum template logic for easy manipulation

/opt/nDeploy/domain-data/domain.com # User settings for domain
# if above file is not present ,it is created with default settings from
/opt/nDeploy/conf/domain_data_default.yaml  # ( plan/package based customization can be done from WHM UI )
/opt/nDeploy/conf/domain_data_suspended.yaml # ( /opt/nDeploy/conf/domain_data_suspended_local.yaml )

# Following file generate /etc/nginx/sites-enabled/domain.com.conf
/opt/nDeploy/conf/server.j2 # ( /opt/nDeploy/conf/server_local.j2 )

# The application template defined in domain_data setting file is used for generating /etc/nginx/sites-enabled/domain.com.include
/opt/nDeploy/conf/APPTEMPLATENAME.j2

# Default vhost template
/opt/nDeploy/conf/default_server.conf.j2 # ( /opt/nDeploy/conf/default_server_local.conf.j2 )

Layer7(Application layer) DDOS mitigation

# only do this when under a attack and revert the file when system is normal
mv /etc/nginx/conf.d/dos_mitigate_systemwide.disabled /etc/nginx/conf.d/dos_mitigate_systemwide.enabled
nginx -s reload

Upgrading XtendWeb and Nginx

nDeploy-nginx is mated with a phusion passenger ruby gem . So we don’t encourage unmanned upgrades and have therefore set enable=0 in the yum repository. The upgrade must be done manually by running the following commands

yum -y install https://github.com/AnoopAlias/XtendWeb/raw/ndeploy4/nDeploy-release-centos-1.0-6.noarch.rpm
yum -y remove simpler-nDeploy nginx-nDeploy-module-naxsi
yum --enablerepo=ndeploy upgrade
#Following step is required only if you use PageSpeed module
#PageSpeed will be using memcached instead of Redis and memcached need to be restarted
chkconfig memcached on
service memcached restart
/opt/nDeploy/scripts/migrate_simpler_to_xtendweb.sh # One time migration script if you were using SimpleR
#For setups using Phusion Passenger app server
/opt/nDeploy/scripts/easy_passenger_setup.sh
#Lets regenerate config to enable changes in config Templates
/opt/nDeploy/scripts/attempt_autofix.sh
nginx -t && /opt/nDeploy/scripts/nginx_upgrade_inplace.sh

#Do step below only if you use HHVM . HHVM is updated from 3.15 to 3.21
/opt/nDeploy/scripts/easy_hhvm_setup.sh
killall -9 hhvm
/opt/nDeploy/scripts/attempt_autofix.sh

XtendWeb cluster upgrade

On All slaves

yum -y install https://github.com/AnoopAlias/XtendWeb/raw/ndeploy4/nDeploy-release-centos-1.0-6.noarch.rpm
yum -y remove nginx-nDeploy-module-naxsi
yum --enablerepo=ndeploy upgrade
#For setups using Phusion Passenger app server
/opt/nDeploy/scripts/easy_passenger_setup.sh
#Following step is required only if you use PageSpeed module
#PageSpeed will be using memcached instead of Redis and memcached need to be restarted
chkconfig memcached on
service memcached restart
nginx -t && /opt/nDeploy/scripts/nginx_upgrade_inplace.sh

#Do step below only if you use HHVM . HHVM is updated from 3.15 to 3.21
/opt/nDeploy/scripts/easy_hhvm_setup.sh
killall -9 hhvm
/opt/nDeploy/scripts/attempt_autofix.sh

On master

yum -y install https://github.com/AnoopAlias/XtendWeb/raw/ndeploy4/nDeploy-release-centos-1.0-6.noarch.rpm
yum -y remove simpler-nDeploy nginx-nDeploy-module-naxsi
yum --enablerepo=ndeploy upgrade
#Following step is required only if you use PageSpeed module
#PageSpeed will be using memcached instead of Redis and memcached need to be restarted
chkconfig memcached on
service memcached restart
/opt/nDeploy/scripts/migrate_simpler_to_xtendweb.sh # One time migration script if you were using SimpleR
#For setups using Phusion Passenger app server
/opt/nDeploy/scripts/easy_passenger_setup.sh
#Lets regenerate config to enable changes in config Templates
/opt/nDeploy/scripts/attempt_autofix.sh
nginx -t && /opt/nDeploy/scripts/nginx_upgrade_inplace.sh
cd /opt/nDeploy/conf/nDeploy-cluster
ansible-playbook -i ./hosts cluster.yml

#Do step below only if you use HHVM . HHVM is updated from 3.15 to 3.21
/opt/nDeploy/scripts/easy_hhvm_setup.sh
killall -9 hhvm
/opt/nDeploy/scripts/attempt_autofix.sh

Migrating Xtendweb settings

In case you are migrating the entire cPanel accounts to a new server.

  1. Do the cPanel migration
  2. Install Xtendweb on the new server
  3. Edit the file /opt/nDeploy/scripts/migrate_xtendweb_settings.sh and change REMOTE_SERVER=’ip.ip.ip.ip’ and SSH_PORT with the new servers ip and ssh port
  4. Run the script /opt/nDeploy/scripts/migrate_xtendweb_settings.sh #Input password of remote server whenever prompted

Temporarily disable the plugin

/opt/nDeploy/scripts/cpanel-nDeploy-setup.sh disable

Uninstall the plugin

/opt/nDeploy/scripts/cpanel-nDeploy-setup.sh disable
yum remove nginx-nDeploy nDeploy

Remove Obsolete PHP-FPM selector plugin

/opt/nDeploy/scripts/init_backends.py httpd-php-uninstall
/opt/nDeploy/scripts/attempt_autofix.sh
/usr/local/cpanel/scripts/uninstall_plugin /opt/nDeploy/PHPfpmSelector