diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index cd0c9c6b..6466ac12 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -107,59 +107,127 @@ class EESiteCreateController(CementBaseController): # TODO Default action for ee site command # data = dict(foo='EESiteCreateController.default().') # self.app.render((data), 'default.mustache') - if self.app.pargs.html: + if (self.app.pargs.html and not (self.app.pargs.php or + self.app.pargs.mysql or self.app.pargs.wp or self.app.pargs.w3tc + or self.app.pargs.wpfc or self.app.pargs.wpsc or + self.app.pargs.wsubdir or self.app.pargs.wsubdomain)): data = dict(site_name=self.app.pargs.site_name, static=True, basic=False, wp=False, w3tc=False, wpfc=False, wpsc=False, multisite=False, wpsubdir=False) - if self.app.pargs.php: + if (self.app.pargs.php and not (self.app.pargs.html or + self.app.pargs.mysql or self.app.pargs.wp or self.app.pargs.w3tc + or self.app.pargs.wpfc or self.app.pargs.wpsc or + self.app.pargs.wsubdir or self.app.pargs.wsubdomain)): data = dict(site_name=self.app.pargs.site_name, static=False, basic=True, wp=False, w3tc=False, wpfc=False, wpsc=False, multisite=False, wpsubdir=False) - if self.app.pargs.mysql: + if (self.app.pargs.mysql and not (self.app.pargs.html or + self.app.pargs.php or self.app.pargs.wp or self.app.pargs.w3tc + or self.app.pargs.wpfc or self.app.pargs.wpsc or + self.app.pargs.wsubdir or self.app.pargs.wsubdomain)): data = dict(site_name=self.app.pargs.site_name, static=False, basic=True, wp=False, w3tc=False, wpfc=False, wpsc=False, multisite=False, wpsubdir=False) - if (self.app.pargs.wp or self.app.pargs.w3tc or self.app.pargs.wpfc - or self.app.pargs.wpsc): - if self.app.pargs.wp: + if ((self.app.pargs.wp or self.app.pargs.w3tc or self.app.pargs.wpfc or + self.app.pargs.wpsc) and not (self.app.pargs.html or + self.app.pargs.php or self.app.pargs.mysql or + self.app.pargs.wpsubdir or self.app.pargs.wpsubdomain)): + if (self.app.pargs.wp and not (self.app.pargs.w3tc + or self.app.pargs.wpfc or self.app.pargs.wpsc)): data = dict(site_name=self.app.pargs.site_name, static=False, basic=True, wp=True, w3tc=False, wpfc=False, wpsc=False, multisite=False, wpsubdir=False) - if self.app.pargs.w3tc: + if (self.app.pargs.w3tc and not + (self.app.pargs.wpfc or self.app.pargs.wpsc)): data = dict(site_name=self.app.pargs.site_name, static=False, basic=False, wp=True, w3tc=True, wpfc=False, wpsc=False, multisite=False, wpsubdir=False) - if self.app.pargs.wpfc: + if (self.app.pargs.wpfc and not + (self.app.pargs.wpsc or self.app.pargs.w3tc)): data = dict(site_name=self.app.pargs.site_name, static=False, basic=False, wp=True, w3tc=False, wpfc=True, wpsc=False, multisite=False, wpsubdir=False) - if self.app.pargs.wpsc: + if (self.app.pargs.wpsc and not + (self.app.pargs.w3tc or self.app.pargs.wpfc)): data = dict(site_name=self.app.pargs.site_name, static=False, basic=False, wp=True, w3tc=False, wpfc=False, wpsc=True, multisite=False, wpsubdir=False) - if self.app.pargs.wpsubdir: - data = dict(site_name=self.app.pargs.site_name, - static=False, basic=True, wp=True, w3tc=False, - wpfc=False, wpsc=False, multisite=True, - wpsubdir=True) + if (self.app.pargs.wpsubdir and not (self.app.pargs.html or + self.app.pargs.php or self.app.pargs.mysql or + self.app.pargs.wpsubdomain or self.app.pargs.wp)): + if (self.app.pargs.wpsubdir and not (self.app.pargs.w3tc + or self.app.pargs.wpfc or self.app.pargs.wpsc)): + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=True, wp=True, w3tc=False, + wpfc=False, wpsc=False, multisite=True, + wpsubdir=True) + if (self.app.pargs.w3tc and not + (self.app.pargs.wpfc or self.app.pargs.wpsc)): + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=False, wp=True, w3tc=True, + wpfc=False, wpsc=False, multisite=True, + wpsubdir=True) + if (self.app.pargs.wpfc and not + (self.app.pargs.wpsc or self.app.pargs.w3tc)): + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=False, wp=True, w3tc=False, + wpfc=True, wpsc=False, multisite=True, + wpsubdir=True) + if (self.app.pargs.wpsc and not + (self.app.pargs.w3tc or self.app.pargs.wpfc)): + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=False, wp=True, w3tc=False, + wpfc=False, wpsc=True, multisite=True, + wpsubdir=True) - if self.app.pargs.wpsubdomain: - data = dict(site_name=self.app.pargs.site_name, - static=False, basic=True, wp=True, w3tc=False, - wpfc=False, wpsc=False, multisite=True, - wpsubdir=False) - self.app.render((data), 'virtualconf.mustache') + if (self.app.pargs.wpsubdomain and not (self.app.pargs.html or + self.app.pargs.php or self.app.pargs.mysql or + self.app.pargs.wpsubdir or self.app.pargs.wp)): + if (self.app.pargs.wpsubdomain and not (self.app.pargs.w3tc + or self.app.pargs.wpfc or self.app.pargs.wpsc)): + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=True, wp=True, w3tc=False, + wpfc=False, wpsc=False, multisite=True, + wpsubdir=False) + if (self.app.pargs.w3tc and not + (self.app.pargs.wpfc or self.app.pargs.wpsc)): + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=False, wp=True, w3tc=True, + wpfc=False, wpsc=False, multisite=True, + wpsubdir=False) + if (self.app.pargs.wpfc and not + (self.app.pargs.wpsc or self.app.pargs.w3tc)): + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=False, wp=True, w3tc=False, + wpfc=True, wpsc=False, multisite=True, + wpsubdir=False) + if (self.app.pargs.wpsc and not + (self.app.pargs.w3tc or self.app.pargs.wpfc)): + data = dict(site_name=self.app.pargs.site_name, + static=False, basic=False, wp=True, w3tc=False, + wpfc=False, wpsc=True, multisite=True, + wpsubdir=False) + + try: + ee_site_nginx_conf = open('/etc/nginx/sites-available/{0}.conf' + .format(self.app.pargs.site_name), 'w') + + self.app.render((data), 'virtualconf.mustache', + out=ee_site_nginx_conf) + ee_site_nginx_conf.close() + except Exception as e: + print("Select proper options for creating site") class EESiteUpdateController(CementBaseController): diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index f04d89b4..0f19eae6 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -73,11 +73,12 @@ class EEStackController(CementBaseController): EEShellExec.cmd_exec("echo \"postfix postfix/mailname string " "$(hostname -f)\" | debconf-set-selections") if set(EEVariables.ee_mysql).issubset(set(apt_packages)): - print("Adding repository for mysql ... ") + print("Adding repository for MySQL ... ") EERepo.add(repo_url=EEVariables.ee_mysql_repo) + self.app.log.debug('Adding key of MySQL.') EERepo.add_key('1C4CBDCDCD2EFD2A') chars = ''.join(random.sample(string.ascii_letters, 8)) - print("Pre-seeding mysql variables ... ") + print("Pre-seeding MySQL variables ... ") EEShellExec.cmd_exec("echo \"percona-server-server-5.6 " "percona-server-server/root_password " "password {chars}\" | " @@ -93,29 +94,35 @@ class EEStackController(CementBaseController): """.format(chars=chars) config = configparser.ConfigParser() config.read_string(mysql_config) + self.app.log.debug('writting configartion into MySQL file.') with open(os.path.expanduser("~")+'/.my.cnf', 'w') as configfile: config.write(configfile) if set(EEVariables.ee_nginx).issubset(set(apt_packages)): - print("Adding repository for nginx ... ") + print("Adding repository for Nginx ... ") if EEVariables.ee_platform_distro == 'Debian': + self.app.log.debug('Adding Dotdeb/nginx GPG key') EERepo.add(repo_url=EEVariables.ee_nginx_repo) else: + self.app.log.debug('Adding ppa of Nginx') EERepo.add(ppa=EEVariables.ee_nginx_repo) if set(EEVariables.ee_php).issubset(set(apt_packages)): - print("Adding repository for php ... ") + print("Adding repository for PHP ... ") if EEVariables.ee_platform_distro == 'Debian': + self.app.log.debug('Adding repo_url of php for Debian') EERepo.add(repo_url=EEVariables.ee_php_repo) + self.app.log.debug('Adding Dotdeb/php GPG key') EERepo.add_key('89DF5277') else: + self.app.log.debug('Adding ppa for PHP') EERepo.add(ppa=EEVariables.ee_php_repo) if set(EEVariables.ee_mail).issubset(set(apt_packages)): if EEVariables.ee_platform_codename == 'squeeze': print("Adding repository for dovecot ... ") EERepo.add(repo_url=EEVariables.ee_dovecot_repo) - + self.app.log.debug('Executing the command debconf-set-selections.') EEShellExec.cmd_exec("echo \"dovecot-core dovecot-core/" "create-ssl-cert boolean yes\" " "| debconf-set-selections") @@ -132,6 +139,7 @@ class EEStackController(CementBaseController): # Nginx core configuration change using configparser nc = NginxConfig() print('in nginx') + self.app.log.debug('Loading file /etc/nginx/nginx.conf ') nc.loadf('/etc/nginx/nginx.conf') nc.set('worker_processes', 'auto') nc.append(('worker_rlimit_nofile', '100000'), position=2) @@ -140,10 +148,14 @@ class EEStackController(CementBaseController): [('worker_connections', '4096'), ('multi_accept', 'on')]}, position=4) nc.set([('http',), 'keepalive_timeout'], '30') + self.app.log.debug("Writting nginx configration to " + "file /etc/nginx/nginx.conf ") nc.savef('/etc/nginx/nginx.conf') # Custom Nginx configuration by EasyEngine data = dict(version='EasyEngine 3.0.1') + self.app.log.debug('writting the nginx configration to file' + '/etc/nginx/conf.d/ee-nginx.conf ') ee_nginx = open('/etc/nginx/conf.d/ee-nginx.conf', 'w') self.app.render((data), 'nginx-core.mustache', out=ee_nginx) ee_nginx.close() @@ -151,6 +163,7 @@ class EEStackController(CementBaseController): if set(EEVariables.ee_php).issubset(set(apt_packages)): # Parse etc/php5/fpm/php.ini config = configparser.ConfigParser() + self.app.log.debug("configring php file /etc/php5/fpm/php.ini") config.read('/etc/php5/fpm/php.ini') config['PHP']['expose_php'] = 'Off' config['PHP']['post_max_size'] = '100M' @@ -158,6 +171,8 @@ class EEStackController(CementBaseController): config['PHP']['max_execution_time'] = '300' config['PHP']['date.timezone'] = time.tzname[time.daylight] with open('/etc/php5/fpm/php.ini', 'w') as configfile: + self.app.log.debug("writting configration of php in to" + "file /etc/php5/fpm/php.ini") config.write(configfile) # Prase /etc/php5/fpm/php-fpm.conf @@ -165,6 +180,8 @@ class EEStackController(CementBaseController): config.read('/etc/php5/fpm/php-fpm.conf') config['global']['error_log'] = '/var/log/php5/fpm.log' with open('/etc/php5/fpm/php-fpm.conf', 'w') as configfile: + self.app.log.debug("writting php5 configartion into " + " /etc/php5/fpm/php-fpm.conf") config.write(configfile) # Parse /etc/php5/fpm/pool.d/www.conf @@ -181,6 +198,8 @@ class EEStackController(CementBaseController): config['www']['pm'] = 'ondemand' config['www']['listen'] = '127.0.0.1:9000' with open('/etc/php5/fpm/pool.d/www.conf', 'w') as configfile: + self.app.log.debug("writting PHP5 configartion into " + " /etc/php5/fpm/pool.d/www.conf") config.write(configfile) if set(EEVariables.ee_mysql).issubset(set(apt_packages)): @@ -193,6 +212,7 @@ class EEStackController(CementBaseController): config.write(configfile) if set(EEVariables.ee_mail).issubset(set(apt_packages)): + self.app.log.debug("Executing mail commands") EEShellExec.cmd_exec("adduser --uid 5000 --home /var/vmail" "--disabled-password --gecos '' vmail") EEShellExec.cmd_exec("openssl req -new -x509 -days 3650 -nodes" @@ -201,10 +221,14 @@ class EEStackController(CementBaseController): "pem -keyout /etc/ssl/private/dovecot.pem" .format(HOSTNAME=EEVariables.ee_fqdn, EMAIL=EEVariables.ee_email)) + self.app.log.debug("Adding Privillages to file " + "/etc/ssl/private/dovecot.pem ") EEShellExec.cmd_exec("chmod 0600 /etc/ssl/private/dovecot.pem") # Custom Dovecot configuration by EasyEngine data = dict() + self.app.log.debug("Writting configration into file" + "/etc/dovecot/conf.d/99-ee.conf ") ee_dovecot = open('/etc/dovecot/conf.d/99-ee.conf', 'w') self.app.render((data), 'dovecot.mustache', out=ee_dovecot) ee_dovecot.close() @@ -266,16 +290,21 @@ class EEStackController(CementBaseController): # Sieve configuration if not os.path.exists('/var/lib/dovecot/sieve/'): + self.app.log.debug('Creating directory' + '/var/lib/dovecot/sieve/ ') os.makedirs('/var/lib/dovecot/sieve/') # Custom sieve configuration by EasyEngine data = dict() + self.app.log.debug("Writting configaration of EasyEngine into" + "file /var/lib/dovecot/sieve/default.sieve") ee_sieve = open('/var/lib/dovecot/sieve/default.sieve', 'w') self.app.render((data), 'default-sieve.mustache', out=ee_sieve) ee_sieve.close() # Compile sieve rules + self.app.log.debug("Privillages to dovecot ") EEShellExec.cmd_exec("chown -R vmail:vmail /var/lib/dovecot") EEShellExec.cmd_exec("sievec /var/lib/dovecot/sieve/" "default.sieve") @@ -283,6 +312,8 @@ class EEStackController(CementBaseController): if set(EEVariables.ee_mailscanner).issubset(set(apt_packages)): # Set up Custom amavis configuration data = dict() + self.app.log.debug("Configuring file /etc/amavis/conf.d" + "/15-content_filter_mode") ee_amavis = open('/etc/amavis/conf.d/15-content_filter_mode', 'w') self.app.render((data), '15-content_filter_mode.mustache', @@ -298,48 +329,72 @@ class EEStackController(CementBaseController): "_checks/\" /etc/postfix/master.cf") # Amavis ClamAV configuration + self.app.log.debug("Adding new user clamav amavis") EEShellExec.cmd_exec("adduser clamav amavis") + self.app.log.debug("Adding new user amavis clamav") EEShellExec.cmd_exec("adduser amavis clamav") + self.app.log.debug("Privillages to file /var/lib/amavis/tmp ") EEShellExec.cmd_exec("chmod -R 775 /var/lib/amavis/tmp") # Update ClamAV database + self.app.log.debug("Updating database") EEShellExec.cmd_exec("freshclam") + self.app.log.debug("Restarting service clamav-daemon") EEShellExec.cmd_exec("service clamav-daemon restart") if len(packages): if any('/usr/bin/wp' == x[1] for x in packages): - + self.app.log.debug("Privillages to /usr/bin/wp ") EEShellExec.cmd_exec("chmod +x /usr/bin/wp") if any('/tmp/pma.tar.gz' == x[1] for x in packages): EEExtract.extract('/tmp/pma.tar.gz', '/tmp/') + self.app.log.debug('Extracting file /tmp/pma.tar.gz to ' + 'loaction /tmp/') if not os.path.exists('/var/www/22222/htdocs/db'): + self.app.log.debug("Creating new directory " + "/var/www/22222/htdocs/db") os.makedirs('/var/www/22222/htdocs/db') shutil.move('/tmp/phpmyadmin-STABLE/', '/var/www/22222/htdocs/db/pma/') + self.app.log.debug('Privillages to www-data:www-data ' + '/var/www/22222/htdocs/db/pma ') EEShellExec.cmd_exec('chown -R www-data:www-data ' '/var/www/22222/htdocs/db/pma') if any('/tmp/memcache.tar.gz' == x[1] for x in packages): + self.app.log.debug("Extracting memcache.tar.gz to location" + " /var/www/22222/htdocs/cache/memcache ") EEExtract.extract('/tmp/memcache.tar.gz', '/var/www/22222/htdocs/cache/memcache') + self.app.log.debug("Privillages to" + " /var/www/22222/htdocs/cache/memcache") EEShellExec.cmd_exec('chown -R www-data:www-data ' '/var/www/22222/htdocs/cache/memcache') if any('/tmp/webgrind.tar.gz' == x[1] for x in packages): + self.app.log.debug("Extracting file webgrind.tar.gz to " + "location /tmp/ ") EEExtract.extract('/tmp/webgrind.tar.gz', '/tmp/') if not os.path.exists('/var/www/22222/htdocs/php'): + self.app.log.debug("Creating directroy " + "/var/www/22222/htdocs/php") os.makedirs('/var/www/22222/htdocs/php') shutil.move('/tmp/webgrind-master/', '/var/www/22222/htdocs/php/webgrind') + self.app.log.debug("Privillages www-data:www-data " + "/var/www/22222/htdocs/php/webgrind/ ") EEShellExec.cmd_exec('chown -R www-data:www-data ' '/var/www/22222/htdocs/php/webgrind/') if any('/tmp/anemometer.tar.gz' == x[1] for x in packages): + self.app.log.debug("Extracting file anemometer.tar.gz to " + "location /tmp/ ") EEExtract.extract('/tmp/anemometer.tar.gz', '/tmp/') if not os.path.exists('/var/www/22222/htdocs/db/'): + self.app.log.debug("Creating directory") os.makedirs('/var/www/22222/htdocs/db/') shutil.move('/tmp/Anemometer-master', '/var/www/22222/htdocs/db/anemometer') @@ -353,6 +408,7 @@ class EEStackController(CementBaseController): ' BY \''+chars+'\'') # Custom Anemometer configuration + self.app.log.debug("configration Anemometer") data = dict(host='localhost', port='3306', user='anemometer', password=chars) ee_anemometer = open('/var/www/22222/htdocs/db/anemometer' @@ -367,16 +423,23 @@ class EEStackController(CementBaseController): if any('/tmp/vimbadmin.tar.gz' == x[1] for x in packages): # Extract ViMbAdmin + self.app.log.debug("Extracting ViMbAdmin.tar.gz to " + "location /tmp/") EEExtract.extract('/tmp/vimbadmin.tar.gz', '/tmp/') if not os.path.exists('/var/www/22222/htdocs/'): + self.app.log.debug("Creating directory " + " /var/www/22222/htdocs/") os.makedirs('/var/www/22222/htdocs/') shutil.move('/tmp/ViMbAdmin-3.0.10/', '/var/www/22222/htdocs/vimbadmin/') # Donwload composer and install ViMbAdmin + self.app.log.debug("Downloading composer " + "https://getcomposer.org/installer | php ") EEShellExec.cmd_exec("cd /var/www/22222/htdocs/vimbadmin; curl" " -sS https://getcomposer.org/installer |" " php") + self.app.log.debug("installation of composer") EEShellExec.cmd_exec("cd /var/www/22222/htdocs/vimbadmin && " "php composer.phar install --prefer-dist" " --no-dev && rm -f /var/www/22222/htdocs" @@ -384,14 +447,16 @@ class EEStackController(CementBaseController): # Configure vimbadmin database vm_passwd = ''.join(random.sample(string.ascii_letters, 8)) - + self.app.log.debug("Creating vimbadmin database if not exist") EEMysql.execute("create database if not exists vimbadmin") + self.app.log.debug("Granting all privileges on vimbadmin ") EEMysql.execute("grant all privileges on vimbadmin.* to" " vimbadmin@localhost IDENTIFIED BY" " '{password}'".format(password=vm_passwd)) # Configure ViMbAdmin settings config = configparser.ConfigParser(strict=False) + self.app.log.debug("configuring ViMbAdmin ") config.read('/var/www/22222/htdocs/vimbadmin/application/' 'configs/application.ini.dist') config['user']['defaults.mailbox.uid'] = '5000' @@ -422,6 +487,9 @@ class EEStackController(CementBaseController): (string.ascii_letters + string.ascii_letters, 64))) + self.app.log.debug("Writting configration to file " + "/var/www/22222/htdocs/vimbadmin" + "/application/configs/application.ini ") with open('/var/www/22222/htdocs/vimbadmin/application' '/configs/application.ini', 'w') as configfile: config.write(configfile) @@ -430,13 +498,20 @@ class EEStackController(CementBaseController): ".htaccess.dist", "/var/www/22222/htdocs/vimbadmin/public/" ".htaccess") + self.app.log.debug("Executing command " + "/var/www/22222/htdocs/vimbadmin/bin" + "/doctrine2-cli.php orm:schema-tool:" + "create" ") EEShellExec.cmd_exec("/var/www/22222/htdocs/vimbadmin/bin" "/doctrine2-cli.php orm:schema-tool:" "create") # Copy Dovecot and Postfix templates which are depednet on # Vimbadmin + if not os.path.exists('/etc/postfix/mysql/'): + self.app.log.debug("Creating directory " + "/etc/postfix/mysql/") os.makedirs('/etc/postfix/mysql/') data = dict(password=vm_passwd) vm_config = open('/etc/postfix/mysql/virtual_alias_maps.cf', @@ -445,18 +520,25 @@ class EEStackController(CementBaseController): out=vm_config) vm_config.close() + self.app.log.debug("Configration of file " + "/etc/postfix/mysql" + "/virtual_domains_maps.cf") vm_config = open('/etc/postfix/mysql/virtual_domains_maps.cf', 'w') self.app.render((data), 'virtual_domains_maps.mustache', out=vm_config) vm_config.close() + self.app.log.debug("Configation of file " + "/etc/postfix/mysql" + "/virtual_mailbox_maps.cf ") vm_config = open('/etc/postfix/mysql/virtual_mailbox_maps.cf', 'w') self.app.render((data), 'virtual_mailbox_maps.mustache', out=vm_config) vm_config.close() + self.app.log.debug("Configration of file ") vm_config = open('/etc/dovecot/dovecot-sql.conf.ext', 'w') self.app.render((data), 'dovecot-sql-conf.mustache', @@ -474,15 +556,21 @@ class EEStackController(CementBaseController): if any('/tmp/roundcube.tar.gz' == x[1] for x in packages): # Extract RoundCubemail + self.app.log.debug("Extracting file /tmp/roundcube.tar.gz " + "to location /tmp/ ") EEExtract.extract('/tmp/roundcube.tar.gz', '/tmp/') if not os.path.exists('/var/www/roundcubemail'): + self.app.log.debug("Creating new directory " + " /var/www/roundcubemail/") os.makedirs('/var/www/roundcubemail/') shutil.move('/tmp/roundcubemail-1.0.4/', '/var/www/roundcubemail/htdocs') # Configure roundcube database rc_passwd = ''.join(random.sample(string.ascii_letters, 8)) + self.app.log.debug("Creating Database roundcubemail") EEMysql.execute("create database if not exists roundcubemail") + self.app.log.debug("Grant all privileges on roundcubemail") EEMysql.execute("grant all privileges on roundcubemail.* to " " roundcube@localhost IDENTIFIED BY " "'{password}'".format(password=rc_passwd)) @@ -517,6 +605,8 @@ class EEStackController(CementBaseController): packages = [] if self.app.pargs.web: + self.app.log.debug("Setting apt_packages variable for Nginx ,PHP" + " ,MySQL ") apt_packages = (apt_packages + EEVariables.ee_nginx + EEVariables.ee_php + EEVariables.ee_mysql) @@ -525,6 +615,7 @@ class EEStackController(CementBaseController): # apt_packages = apt_packages + EEVariables.ee_nginx if self.app.pargs.mail: apt_packages = apt_packages + EEVariables.ee_mail + self.app.log.debug("Setting apt_packages variable for mail") packages = packages + [["https://github.com/opensolutions/ViMbAdmi" "n/archive/3.0.10.tar.gz", "/tmp/vimbadmin" ".tar.gz"], @@ -537,28 +628,36 @@ class EEStackController(CementBaseController): apt_packages = apt_packages + EEVariables.ee_mailscanner if self.app.pargs.nginx: + self.app.log.debug("Setting apt_packages variable for Nginx") apt_packages = apt_packages + EEVariables.ee_nginx if self.app.pargs.php: + self.app.log.debug("Setting apt_packages variable for PHP") apt_packages = apt_packages + EEVariables.ee_php if self.app.pargs.mysql: + self.app.log.debug("Setting apt_packages variable for MySQL") apt_packages = apt_packages + EEVariables.ee_mysql if self.app.pargs.postfix: + self.app.log.debug("Setting apt_packages variable for PostFix") apt_packages = apt_packages + EEVariables.ee_postfix if self.app.pargs.wpcli: + self.app.log.debug("Setting packages variable for WPCLI") packages = packages + [["https://github.com/wp-cli/wp-cli/releases" "/download/v0.17.1/wp-cli.phar", "/usr/bin/wp"]] if self.app.pargs.phpmyadmin: + self.app.log.debug("Setting packages varible for phpMyAdmin ") packages = packages + [["https://github.com/phpmyadmin/phpmyadmin" "/archive/STABLE.tar.gz", "/tmp/pma.tar.gz"]] if self.app.pargs.adminer: + self.app.log.debug("Setting packages variable for Adminer ") packages = packages + [["http://downloads.sourceforge.net/adminer" "/adminer-4.1.0.php", "/var/www/22222/" "htdocs/db/adminer/index.php"]] if self.app.pargs.utils: + self.app.log.debug("Setting packages variable for utils") packages = packages + [["http://phpmemcacheadmin.googlecode.com/" "files/phpMemcachedAdmin-1.2.2" "-r262.tar.gz", '/tmp/memcache.tar.gz'], @@ -591,12 +690,15 @@ class EEStackController(CementBaseController): "/master.tar.gz", '/tmp/anemometer.tar.gz'] ] - + self.app.log.debug("Calling pre_pref ") self.pre_pref(apt_packages) if len(apt_packages): + self.app.log.debug("Installing all apt_packages") pkg.install(apt_packages) if len(packages): + self.app.log.debug("Downloading all packages") EEDownload.download(packages) + self.app.log.debug("Calling post_pref") self.post_pref(apt_packages, packages) @expose() @@ -606,6 +708,8 @@ class EEStackController(CementBaseController): packages = [] if self.app.pargs.web: + self.app.log.debug("Removing apt_packages variable of Nginx " + ",PHP,MySQL") apt_packages = (apt_packages + EEVariables.ee_nginx + EEVariables.ee_php + EEVariables.ee_mysql) if self.app.pargs.admin: @@ -615,20 +719,28 @@ class EEStackController(CementBaseController): pass # apt_packages = apt_packages + EEVariables.ee_nginx if self.app.pargs.nginx: + self.app.log.debug("Removing apt_packages variable of Nginx") apt_packages = apt_packages + EEVariables.ee_nginx if self.app.pargs.php: + self.app.log.debug("Removing apt_packages variable of PHP") apt_packages = apt_packages + EEVariables.ee_php if self.app.pargs.mysql: + self.app.log.debug("Removing apt_packages variable of MySQL") apt_packages = apt_packages + EEVariables.ee_mysql if self.app.pargs.postfix: + self.app.log.debug("Removing apt_packages variable of Postfix") apt_packages = apt_packages + EEVariables.ee_postfix if self.app.pargs.wpcli: + self.app.log.debug("Removing package variable of WPCLI ") packages = packages + ['/usr/bin/wp'] if self.app.pargs.phpmyadmin: + self.app.log.debug("Removing package variable of phpMyAdmin ") packages = packages + ['/var/www/22222/htdocs/db/pma'] if self.app.pargs.adminer: + self.app.log.debug("Removing package variable of Adminer ") packages = packages + ['/var/www/22222/htdocs/db/adminer'] if self.app.pargs.utils: + self.app.log.debug("Removing package variable of utils ") packages = packages + ['/var/www/22222/htdocs/php/webgrind/', '/var/www/22222/htdocs/cache/opcache', '/var/www/22222/htdocs/cache/nginx/' @@ -638,6 +750,7 @@ class EEStackController(CementBaseController): '/var/www/22222/htdocs/db/anemometer'] if len(apt_packages): + self.app.log.debug("Removing apt_packages") pkg.remove(apt_packages) if len(packages): EEFileUtils.remove(packages) @@ -649,6 +762,7 @@ class EEStackController(CementBaseController): packages = [] if self.app.pargs.web: + self.app.log.debug("Purge Nginx,PHP,MySQL") apt_packages = (apt_packages + EEVariables.ee_nginx + EEVariables.ee_php + EEVariables.ee_mysql) if self.app.pargs.admin: @@ -658,20 +772,28 @@ class EEStackController(CementBaseController): pass # apt_packages = apt_packages + EEVariables.ee_nginx if self.app.pargs.nginx: + self.app.log.debug("Purge apt_packages variable of Nginx") apt_packages = apt_packages + EEVariables.ee_nginx if self.app.pargs.php: + self.app.log.debug("Purge apt_packages variable PHP") apt_packages = apt_packages + EEVariables.ee_php if self.app.pargs.mysql: + self.app.log.debug("Purge apt_packages variable MySQL") apt_packages = apt_packages + EEVariables.ee_mysql if self.app.pargs.postfix: + self.app.log.debug("Purge apt_packages variable PostFix") apt_packages = apt_packages + EEVariables.ee_postfix if self.app.pargs.wpcli: + self.app.log.debug("Purge package variable WPCLI") packages = packages + ['/usr/bin/wp'] if self.app.pargs.phpmyadmin: packages = packages + ['/var/www/22222/htdocs/db/pma'] + self.app.log.debug("Purge package variable phpMyAdmin") if self.app.pargs.adminer: + self.app.log.debug("Purge package variable Adminer") packages = packages + ['/var/www/22222/htdocs/db/adminer'] if self.app.pargs.utils: + self.app.log.debug("Purge package variable utils") packages = packages + ['/var/www/22222/htdocs/php/webgrind/', '/var/www/22222/htdocs/cache/opcache', '/var/www/22222/htdocs/cache/nginx/'