Beispiel #1
0
__author__ = "Anoop P Alias"
__copyright__ = "Copyright Anoop P Alias"
__license__ = "GPL"
__email__ = "*****@*****.**"

installation_path = "/opt/nDeploy"  # Absolute Installation Path
cpaneluser = os.environ["USER"]

cgitb.enable()
close_cpanel_liveapisock()

print_simple_header()

# Setup SSH keys
terminal_call(installation_path + '/scripts/cluster_user_ssh_keyadd.sh')
# Try loading the main userdata cache file
cpuserdatajson = "/var/cpanel/userdata/" + cpaneluser + "/main.cache"
if os.path.isfile(cpuserdatajson):
    with open(cpuserdatajson) as cpaneluser_data_stream:
        json_parsed_cpaneluser = json.load(cpaneluser_data_stream)
    main_domain = json_parsed_cpaneluser.get('main_domain')
    sub_domains = json_parsed_cpaneluser.get('sub_domains')
    cpdomainjson = "/var/cpanel/userdata/" + cpaneluser + "/" + main_domain + ".cache"
    with open(cpdomainjson, 'r') as cpaneldomain_data_stream:
        json_parsed_cpaneldomain = json.load(cpaneldomain_data_stream)
    maindom_docroot = json_parsed_cpaneldomain.get('documentroot')
    the_raw_cmd = 'ansible -i /opt/nDeploy/conf/nDeploy-cluster/hosts --key-file "~/.ssh/clusterkey" ndeployslaves -m synchronize -a "src=' + maindom_docroot + '/ dest=' + maindom_docroot + '/"'
    terminal_call(the_raw_cmd)
    for mydomain in sub_domains:
        cpdomainjson = "/var/cpanel/userdata/" + cpaneluser + "/" + mydomain + ".cache"
Beispiel #2
0
import cgi
import cgitb
import subprocess
from commoninclude import print_simple_header, print_simple_footer, close_cpanel_liveapisock, print_success, print_error, terminal_call


__author__ = "Anoop P Alias"
__copyright__ = "Copyright Anoop P Alias"
__license__ = "GPL"
__email__ = "*****@*****.**"


installation_path = "/opt/nDeploy"  # Absolute Installation Path

cgitb.enable()

cpanelhome = os.environ['HOME']
close_cpanel_liveapisock()
form = cgi.FieldStorage()

print_simple_header()

nginx_log = cpanelhome+'/logs/nginx.log'
if os.path.isfile(nginx_log):
    terminal_call('/usr/bin/tail -100 '+nginx_log, 'Displaying last 100 lines of '+nginx_log, 'Nginx log dump complete!')
    print_success('Displaying last 100 lines in the terminal window below.')
else:
    print_error('Nginx log file is not present!')

print_simple_footer()
Beispiel #3
0
__email__ = "*****@*****.**"


cgitb.enable()

close_cpanel_liveapisock()
form = cgi.FieldStorage()

print_simple_header()

if form.getvalue('domain') and form.getvalue('backend_category') and form.getvalue('backend_version') and form.getvalue('document_root'):
    mydomain = form.getvalue('domain')
    mybackend = form.getvalue('backend_category')
    mybackendversion = form.getvalue('backend_version')
    mydocroot = form.getvalue('document_root')
    terminal_call('','Project root: '+mydocroot,'')

    if mybackend == 'RUBY':

        if os.path.isfile(mydocroot+'/Gemfile'):

            if os.path.isfile('/usr/local/rvm/gems/'+mybackendversion+'/bin/bundle'):
                install_cmd = '/usr/local/rvm/bin/rvm '+mybackendversion+' do bundle install --path vendor/bundle'
                terminal_call(install_cmd, 'Installing Ruby project dependencies','Ruby project dependencies install complete!','',mydocroot)
                terminal_call('','','If the install failed, run the following command in your shell to proceed with manual installation: <kbd>cd '+mydocroot+';/usr/local/rvm/bin/rvm '+mybackendversion+' do bundle install --path vendor/bundle</kbd>')
                print_success('Ruby project dependencies install complete!')
            else:
                print_error('Bundler command not found!')

        else:
            terminal_call('','','Gemfile not found for <kbd>RUBY</kbd> project. Specify project dependencies in: '+mydocroot+'/Gemfile')
Beispiel #4
0
from commoninclude import print_simple_header, print_simple_footer, close_cpanel_liveapisock, terminal_call, print_success, print_info


__author__ = "Anoop P Alias"
__copyright__ = "Copyright Anoop P Alias"
__license__ = "GPL"
__email__ = "*****@*****.**"


cpanelhome = os.environ["HOME"]
php_log = cpanelhome+"/logs/php_error_log"

cgitb.enable()

close_cpanel_liveapisock()

form = cgi.FieldStorage()

print_simple_header()


if os.path.isfile(php_log):
    print_success('The PHP log has been written to the terminal!')
    terminal_call('/usr/bin/tail -100 '+php_log, 'Showing last 100 entries of '+cpanelhome+'/logs/php_error_log', 'PHP log dump completed!')
else:
    print_info('No PHP log file detected!')
    terminal_call('ls '+cpanelhome+'/logs/', 'Showing contents of '+cpanelhome+'/logs/', 'No PHP log file detected!')

print_simple_footer()
Beispiel #5
0
            the_subdir_dict = subdir_apps_dict.get(thesubdir)
        else:
            the_subdir_dict = {}

        # Ok lets save everything to the domain-data file
        the_subdir_dict['backend_category'] = mybackend
        the_subdir_dict['backend_path'] = mybackendpath
        the_subdir_dict['backend_version'] = mybackendversion
        the_subdir_dict['apptemplate_code'] = myapptemplate

        # Lets deal with settings that are mutually exclusive
        if 'redis' in myapptemplate:
            the_subdir_dict['pagespeed'] = 'disabled'
            the_subdir_dict['mod_security'] = 'disabled'
            terminal_call(
                '',
                'Note: Turned off pagespeed and mod_security options as they are incompatible with Full Page cache. The cache will not work if you turn on these options!'
            )
        if 'noextra' in myapptemplate:
            the_subdir_dict['set_expire_static'] = 'disabled'
            the_subdir_dict['gzip'] = 'disabled'
            the_subdir_dict['brotli'] = 'disabled'
            terminal_call(
                '',
                'Note: Turned off gzip, brotli and set_expire_static options as they are incompatible with the template generated nginx.conf. The config will not work if you turn on these options!'
            )

        subdir_apps_dict[thesubdir] = the_subdir_dict
        with open(profileyaml, 'w') as yaml_file:
            yaml.dump(yaml_parsed_profileyaml,
                      yaml_file,
                      default_flow_style=False)
Beispiel #6
0
import os
import cgi
import cgitb
from commoninclude import print_simple_header, print_simple_footer, terminal_call


__author__ = "Anoop P Alias"
__copyright__ = "Copyright Anoop P Alias"
__license__ = "GPL"
__email__ = "*****@*****.**"


installation_path = "/opt/nDeploy"  # Absolute Installation Path
app_template_file = installation_path+"/conf/apptemplates.yaml"
backend_config_file = installation_path+"/conf/backends.yaml"


cgitb.enable()

cpaneluser = os.environ["USER"]
commoninclude.close_cpanel_liveapisock()
form = cgi.FieldStorage()


print_simple_header()


switch_cmd = '/opt/nDeploy/scripts/auto_config.py '+cpaneluser+' setconfig'
terminal_call(switch_cmd)
print_simple_footer()