def add(self): """Swap addition with EasyEngine""" if EEVariables.ee_ram < 512: if EEVariables.ee_swap < 1000: Log.info(self, "Adding SWAP") # Install dphys-swapfile EEAptGet.update(self) EEAptGet.install(self, ["dphys-swapfile"]) # Stop service EEShellExec.cmd_exec(self, "service dphys-swapfile stop") # Remove Default swap created EEShellExec.cmd_exec(self, "/sbin/dphys-swapfile uninstall") # Modify Swap configuration if os.path.isfile("/etc/dphys-swapfile"): EEFileUtils.searchreplace(self, "/etc/dphys-swapfile", "#CONF_SWAPFILE=/var/swap", "CONF_SWAPFILE=/ee-swapfile") EEFileUtils.searchreplace(self, "/etc/dphys-swapfile", "#CONF_MAXSWAP=2048", "CONF_MAXSWAP=1024") EEFileUtils.searchreplace(self, "/etc/dphys-swapfile", "#CONF_SWAPSIZE=", "CONF_SWAPSIZE=1024") else: with open("/etc/dphys-swapfile", 'w') as conffile: conffile.write("CONF_SWAPFILE=/ee-swapfile\n" "CONF_SWAPSIZE=1024\n" "CONF_MAXSWAP=1024\n") # Create swap file EEShellExec.cmd_exec(self, "service dphys-swapfile start")
def add(self): """Swap addition with EasyEngine""" if EEVariables.ee_ram < 512: if EEVariables.ee_swap < 1000: Log.info(self, "Adding SWAP file, please wait...") # Install dphys-swapfile EEAptGet.update(self) EEAptGet.install(self, ["dphys-swapfile"]) # Stop service EEShellExec.cmd_exec(self, "service dphys-swapfile stop") # Remove Default swap created EEShellExec.cmd_exec(self, "/sbin/dphys-swapfile uninstall") # Modify Swap configuration if os.path.isfile("/etc/dphys-swapfile"): EEFileUtils.searchreplace(self, "/etc/dphys-swapfile", "#CONF_SWAPFILE=/var/swap", "CONF_SWAPFILE=/ee-swapfile") EEFileUtils.searchreplace(self, "/etc/dphys-swapfile", "#CONF_MAXSWAP=2048", "CONF_MAXSWAP=1024") EEFileUtils.searchreplace(self, "/etc/dphys-swapfile", "#CONF_SWAPSIZE=", "CONF_SWAPSIZE=1024") else: with open("/etc/dphys-swapfile", 'w') as conffile: conffile.write("CONF_SWAPFILE=/ee-swapfile\n" "CONF_SWAPSIZE=1024\n" "CONF_MAXSWAP=1024\n") # Create swap file EEShellExec.cmd_exec(self, "service dphys-swapfile start")
def migrate_mariadb(self): # Backup all database EEMysql.backupAll(self) # Add MariaDB repo Log.info(self, "Adding repository for MariaDB, please wait ...") mysql_pref = ("Package: *\nPin: origin mirror.aarnet.edu.au" "\nPin-Priority: 1000\n") with open('/etc/apt/preferences.d/' 'MariaDB.pref', 'w') as mysql_pref_file: mysql_pref_file.write(mysql_pref) EERepo.add(self, repo_url=EEVariables.ee_mysql_repo) Log.debug(self, 'Adding key for {0}' .format(EEVariables.ee_mysql_repo)) EERepo.add_key(self, '0xcbcb082a1bb943db', keyserver="keyserver.ubuntu.com") config = configparser.ConfigParser() config.read(os.path.expanduser("~")+'/.my.cnf') try: chars = config['client']['password'] except Exception as e: Log.error(self, "Error: process exited with error %s" % e) Log.debug(self, "Pre-seeding MariaDB") Log.debug(self, "echo \"mariadb-server-10.0 " "mysql-server/root_password " "password \" | " "debconf-set-selections") EEShellExec.cmd_exec(self, "echo \"mariadb-server-10.0 " "mysql-server/root_password " "password {chars}\" | " "debconf-set-selections" .format(chars=chars), log=False) Log.debug(self, "echo \"mariadb-server-10.0 " "mysql-server/root_password_again " "password \" | " "debconf-set-selections") EEShellExec.cmd_exec(self, "echo \"mariadb-server-10.0 " "mysql-server/root_password_again " "password {chars}\" | " "debconf-set-selections" .format(chars=chars), log=False) # Install MariaDB apt_packages = EEVariables.ee_mysql + ["php5-mysql"] Log.info(self, "Updating apt-cache, please wait ...") EEAptGet.update(self) Log.info(self, "Installing MariaDB, please wait ...") EEAptGet.remove(self, ["mysql-common", "libmysqlclient18"]) EEAptGet.auto_remove(self) EEAptGet.install(self, apt_packages)
def upgrade_php56(self): if EEVariables.ee_platform_distro == "ubuntu": if os.path.isfile("/etc/apt/sources.list.d/ondrej-php5-5_6-{0}." "list".format(EEVariables.ee_platform_codename)): Log.error(self, "Unable to find PHP 5.5") else: if not (os.path.isfile(EEVariables.ee_repo_file_path) and EEFileUtils.grep(self, EEVariables.ee_repo_file_path, "php55")): Log.error(self, "Unable to find PHP 5.5") Log.info( self, "During PHP update process non nginx-cached" " parts of your site may remain down.") # Check prompt if (not self.app.pargs.no_prompt): start_upgrade = input("Do you want to continue:[y/N]") if start_upgrade != "Y" and start_upgrade != "y": Log.error(self, "Not starting PHP package update") if EEVariables.ee_platform_distro == "ubuntu": EERepo.remove(self, ppa="ppa:ondrej/php5") EERepo.add(self, ppa=EEVariables.ee_php_repo) else: EEAptGet.remove(self, ["php5-xdebug"]) EEFileUtils.searchreplace(self, EEVariables.ee_repo_file_path, "php55", "php56") Log.info(self, "Updating apt-cache, please wait...") EEAptGet.update(self) Log.info(self, "Installing packages, please wait ...") if (EEVariables.ee_platform_codename == 'trusty' or EEVariables.ee_platform_codename == 'xenial' or EEVariables.ee_platform_codename == 'bionic'): EEAptGet.install(self, EEVariables.ee_php5_6 + EEVariables.ee_php_extra) else: EEAptGet.install(self, EEVariables.ee_php) if EEVariables.ee_platform_distro == "debian": EEShellExec.cmd_exec(self, "pecl install xdebug") with open("/etc/php5/mods-available/xdebug.ini", encoding='utf-8', mode='a') as myfile: myfile.write(";zend_extension=/usr/lib/php5/20131226/" "xdebug.so\n") EEFileUtils.create_symlink(self, [ "/etc/php5/mods-available/" "xdebug.ini", "/etc/php5/fpm/conf.d" "/20-xedbug.ini" ]) Log.info(self, "Successfully upgraded from PHP 5.5 to PHP 5.6")
def upgrade_php56(self): if EEVariables.ee_platform_distro == "ubuntu": if os.path.isfile("/etc/apt/sources.list.d/ondrej-php5-5_6-{0}." "list".format(EEVariables.ee_platform_codename)): Log.error(self, "Unable to find PHP 5.5") else: if not(os.path.isfile(EEVariables.ee_repo_file_path) and EEFileUtils.grep(self, EEVariables.ee_repo_file_path, "php55")): Log.error(self, "Unable to find PHP 5.5") Log.info(self, "During PHP update process non nginx-cached" " parts of your site may remain down.") # Check prompt if (not self.app.pargs.no_prompt): start_upgrade = input("Do you want to continue:[y/N]") if start_upgrade != "Y" and start_upgrade != "y": Log.error(self, "Not starting PHP package update") if EEVariables.ee_platform_distro == "ubuntu": EERepo.remove(self, ppa="ppa:ondrej/php5") EERepo.add(self, ppa=EEVariables.ee_php_repo) else: EEAptGet.remove(self, ["php5-xdebug"]) EEFileUtils.searchreplace(self, EEVariables.ee_repo_file_path, "php55", "php56") Log.info(self, "Updating apt-cache, please wait...") EEAptGet.update(self) Log.info(self, "Installing packages, please wait ...") if (EEVariables.ee_platform_codename == 'trusty' or EEVariables.ee_platform_codename == 'xenial'): EEAptGet.install(self, EEVariables.ee_php5_6 + EEVariables.ee_php_extra) else: EEAptGet.install(self, EEVariables.ee_php) if EEVariables.ee_platform_distro == "debian": EEShellExec.cmd_exec(self, "pecl install xdebug") with open("/etc/php5/mods-available/xdebug.ini", encoding='utf-8', mode='a') as myfile: myfile.write(";zend_extension=/usr/lib/php5/20131226/" "xdebug.so\n") EEFileUtils.create_symlink(self, ["/etc/php5/mods-available/" "xdebug.ini", "/etc/php5/fpm/conf.d" "/20-xedbug.ini"]) Log.info(self, "Successfully upgraded from PHP 5.5 to PHP 5.6")
def migrate_mariadb(self): # Backup all database EEMysql.backupAll(self) # Add MariaDB repo Log.info(self, "Adding repository for MariaDB, please wait...") mysql_pref = ("Package: *\nPin: origin sfo1.mirrors.digitalocean.com" "\nPin-Priority: 1000\n") with open('/etc/apt/preferences.d/' 'MariaDB.pref', 'w') as mysql_pref_file: mysql_pref_file.write(mysql_pref) EERepo.add(self, repo_url=EEVariables.ee_mysql_repo) Log.debug(self, 'Adding key for {0}' .format(EEVariables.ee_mysql_repo)) EERepo.add_key(self, '0xcbcb082a1bb943db', keyserver="keyserver.ubuntu.com") config = configparser.ConfigParser() if os.path.exists('/etc/mysql/conf.d/my.cnf'): config.read('/etc/mysql/conf.d/my.cnf') else: config.read(os.path.expanduser("~")+'/.my.cnf') try: chars = config['client']['password'] except Exception as e: Log.error(self, "Error: process exited with error %s" % e) Log.debug(self, "Pre-seeding MariaDB") Log.debug(self, "echo \"mariadb-server-10.0 " "mysql-server/root_password " "password \" | " "debconf-set-selections") EEShellExec.cmd_exec(self, "echo \"mariadb-server-10.0 " "mysql-server/root_password " "password {chars}\" | " "debconf-set-selections" .format(chars=chars), log=False) Log.debug(self, "echo \"mariadb-server-10.0 " "mysql-server/root_password_again " "password \" | " "debconf-set-selections") EEShellExec.cmd_exec(self, "echo \"mariadb-server-10.0 " "mysql-server/root_password_again " "password {chars}\" | " "debconf-set-selections" .format(chars=chars), log=False) # Install MariaDB apt_packages = EEVariables.ee_mysql # If PHP is installed then install php5-mysql if EEAptGet.is_installed(self, "php5-fpm"): apt_packages = apt_packages + ["php5-mysql"] # If mail server is installed then install dovecot-sql and postfix-sql if EEAptGet.is_installed(self, "dovecot-core"): apt_packages = apt_packages + ["dovecot-mysql", "postfix-mysql", "libclass-dbi-mysql-perl"] Log.info(self, "Updating apt-cache, please wait...") EEAptGet.update(self) Log.info(self, "Installing MariaDB, please wait...") EEAptGet.remove(self, ["mysql-common", "libmysqlclient18"]) EEAptGet.auto_remove(self) EEAptGet.install(self, apt_packages) # Restart dovecot and postfix if installed if EEAptGet.is_installed(self, "dovecot-core"): EEService.restart_service(self, 'dovecot') EEService.restart_service(self, 'postfix')
def migrate_mariadb(self): # Backup all database EEMysql.backupAll(self) # Add MariaDB repo Log.info(self, "Adding repository for MariaDB, please wait...") mysql_pref = ("Package: *\nPin: origin sfo1.mirrors.digitalocean.com" "\nPin-Priority: 1000\n") with open('/etc/apt/preferences.d/' 'MariaDB.pref', 'w') as mysql_pref_file: mysql_pref_file.write(mysql_pref) EERepo.add(self, repo_url=EEVariables.ee_mysql_repo) Log.debug(self, 'Adding key for {0}'.format(EEVariables.ee_mysql_repo)) EERepo.add_key(self, '0xF1656F24C74CD1D8', keyserver="keyserver.ubuntu.com") config = configparser.ConfigParser() if os.path.exists('/etc/mysql/conf.d/my.cnf'): config.read('/etc/mysql/conf.d/my.cnf') else: config.read(os.path.expanduser("~") + '/.my.cnf') try: chars = config['client']['password'] except Exception as e: Log.error(self, "Error: process exited with error %s" % e) Log.debug(self, "Pre-seeding MariaDB") Log.debug( self, "echo \"mariadb-server-10.0 " "mysql-server/root_password " "password \" | " "debconf-set-selections") EEShellExec.cmd_exec(self, "echo \"mariadb-server-10.0 " "mysql-server/root_password " "password {chars}\" | " "debconf-set-selections".format(chars=chars), log=False) Log.debug( self, "echo \"mariadb-server-10.0 " "mysql-server/root_password_again " "password \" | " "debconf-set-selections") EEShellExec.cmd_exec(self, "echo \"mariadb-server-10.0 " "mysql-server/root_password_again " "password {chars}\" | " "debconf-set-selections".format(chars=chars), log=False) # Install MariaDB apt_packages = EEVariables.ee_mysql # If PHP is installed then install php5-mysql if EEAptGet.is_installed(self, "php5-fpm"): apt_packages = apt_packages + ["php5-mysql"] # If mail server is installed then install dovecot-sql and postfix-sql if EEAptGet.is_installed(self, "dovecot-core"): apt_packages = apt_packages + [ "dovecot-mysql", "postfix-mysql", "libclass-dbi-mysql-perl" ] Log.info(self, "Updating apt-cache, please wait...") EEAptGet.update(self) Log.info(self, "Installing MariaDB, please wait...") EEAptGet.remove(self, ["mysql-common", "libmysqlclient18"]) EEAptGet.auto_remove(self) EEAptGet.install(self, apt_packages) # Restart dovecot and postfix if installed if EEAptGet.is_installed(self, "dovecot-core"): EEService.restart_service(self, 'dovecot') EEService.restart_service(self, 'postfix')
def default(self): # All package update if ((not self.app.pargs.php56)): apt_packages = [] Log.info(self, "During package update process non nginx-cached" " parts of your site may remain down") # Check prompt if (not self.app.pargs.no_prompt): start_upgrade = input("Do you want to continue:[y/N]") if start_upgrade != "Y" and start_upgrade != "y": Log.error(self, "Not starting package update") if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.mysql) and (not self.app.pargs.postfix) and (not self.app.pargs.hhvm) and (not self.app.pargs.mailscanner) and (not self.app.pargs.all)): self.app.pargs.web = True if self.app.pargs.all: self.app.pargs.web = True self.app.pargs.mail = True if self.app.pargs.web: self.app.pargs.nginx = True self.app.pargs.php = True self.app.pargs.mysql = True self.app.pargs.postfix = True self.app.pargs.hhvm = True if self.app.pargs.mail: self.app.pargs.nginx = True self.app.pargs.php = True self.app.pargs.mysql = True self.app.pargs.postfix = True if EEAptGet.is_installed(self, 'dovecot-core'): apt_packages = apt_packages + EEVariables.ee_mail self.app.pargs.mailscanner = True else: Log.info(self, "Mail server is not installed") if self.app.pargs.nginx: if EEAptGet.is_installed(self, 'nginx-custom'): apt_packages = apt_packages + EEVariables.ee_nginx else: Log.info(self, "Nginx is not already installed") if self.app.pargs.php: if EEAptGet.is_installed(self, 'php5-fpm'): apt_packages = apt_packages + EEVariables.ee_php else: Log.info(self, "PHP is not installed") if self.app.pargs.hhvm: if EEAptGet.is_installed(self, 'hhvm'): apt_packages = apt_packages + EEVariables.ee_hhvm else: Log.info(self, "HHVM is not installed") if self.app.pargs.mysql: if EEAptGet.is_installed(self, 'mariadb-server'): apt_packages = apt_packages + EEVariables.ee_mysql else: Log.info(self, "MariaDB is not installed") if self.app.pargs.postfix: if EEAptGet.is_installed(self, 'postfix'): apt_packages = apt_packages + EEVariables.ee_postfix else: Log.info(self, "Postfix is not installed") if self.app.pargs.mailscanner: if EEAptGet.is_installed(self, 'amavisd-new'): apt_packages = (apt_packages + EEVariables.ee_mailscanner) else: Log.info(self, "MailScanner is not installed") if len(apt_packages): # apt-get update EEAptGet.update(self) # Update packages Log.info(self, "Updating packages, please wait...") EEAptGet.install(self, apt_packages) Log.info(self, "Successfully updated packages") # Post Actions after package updates if set(EEVariables.ee_nginx).issubset(set(apt_packages)): EEService.restart_service(self, 'nginx') if set(EEVariables.ee_php).issubset(set(apt_packages)): EEService.restart_service(self, 'php5-fpm') if set(EEVariables.ee_hhvm).issubset(set(apt_packages)): EEService.restart_service(self, 'hhvm') if set(EEVariables.ee_postfix).issubset(set(apt_packages)): EEService.restart_service(self, 'postfix') if set(EEVariables.ee_mysql).issubset(set(apt_packages)): EEService.restart_service(self, 'hhvm') if set(EEVariables.ee_mail).issubset(set(apt_packages)): EEService.restart_service(self, 'dovecot') # PHP 5.6 to 5.6 elif (self.app.pargs.php56): self.upgrade_php56() else: self.app.args.print_help()
def default(self): # All package update if ((not self.app.pargs.php56)): apt_packages = [] packages = [] if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.mysql) and (not self.app.pargs.postfix) and (not self.app.pargs.hhvm) and (not self.app.pargs.mailscanner) and (not self.app.pargs.all) and (not self.app.pargs.wpcli) and (not self.app.pargs.redis) and (not self.app.pargs.nginxmainline)): self.app.pargs.web = True if self.app.pargs.all: self.app.pargs.web = True self.app.pargs.mail = True if self.app.pargs.web: if EEAptGet.is_installed(self, 'nginx-custom'): self.app.pargs.nginx = True elif EEAptGet.is_installed(self, 'nginx-mainline'): self.app.pargs.nginxmainline = True else: Log.info(self, "Nginx is not already installed") self.app.pargs.php = True self.app.pargs.mysql = True self.app.pargs.postfix = True self.app.pargs.wpcli = True if self.app.pargs.mail: self.app.pargs.nginx = True self.app.pargs.php = True self.app.pargs.mysql = True self.app.pargs.wpcli = True self.app.pargs.postfix = True if EEAptGet.is_installed(self, 'dovecot-core'): apt_packages = apt_packages + EEVariables.ee_mail self.app.pargs.mailscanner = True else: Log.info(self, "Mail server is not installed") if self.app.pargs.nginx: if EEAptGet.is_installed(self, 'nginx-custom'): apt_packages = apt_packages + EEVariables.ee_nginx else: Log.info(self, "Nginx Stable is not already installed") if self.app.pargs.nginxmainline: if EEAptGet.is_installed(self, 'nginx-mainline'): apt_packages = apt_packages + EEVariables.ee_nginx_dev else: Log.info(self, "Nginx Mainline is not already installed") if self.app.pargs.php: if EEVariables.ee_platform_codename != 'trusty': if EEAptGet.is_installed(self, 'php5-fpm'): apt_packages = apt_packages + EEVariables.ee_php else: Log.info(self, "PHP is not installed") else: if EEAptGet.is_installed(self, 'php5.6-fpm'): apt_packages = apt_packages + EEVariables.ee_php5_6 + EEVariables.ee_php_extra else: Log.info(self, "PHP 5.6 is not installed") if EEAptGet.is_installed(self, 'php7.0-fpm'): apt_packages = apt_packages + EEVariables.ee_php7_0 + EEVariables.ee_php_extra else: Log.info(self, "PHP 7.0 is not installed") if self.app.pargs.hhvm: if EEAptGet.is_installed(self, 'hhvm'): apt_packages = apt_packages + EEVariables.ee_hhvm else: Log.info(self, "HHVM is not installed") if self.app.pargs.mysql: if EEAptGet.is_installed(self, 'mariadb-server'): apt_packages = apt_packages + EEVariables.ee_mysql else: Log.info(self, "MariaDB is not installed") if self.app.pargs.postfix: if EEAptGet.is_installed(self, 'postfix'): apt_packages = apt_packages + EEVariables.ee_postfix else: Log.info(self, "Postfix is not installed") if self.app.pargs.redis: if EEAptGet.is_installed(self, 'redis-server'): apt_packages = apt_packages + EEVariables.ee_redis else: Log.info(self, "Redis is not installed") if self.app.pargs.wpcli: if os.path.isfile('/usr/bin/wp'): packages = packages + [[ "https://github.com/wp-cli/wp-cli/" "releases/download/v{0}/" "wp-cli-{0}.phar" "".format(EEVariables.ee_wp_cli), "/usr/bin/wp", "WP-CLI" ]] else: Log.info(self, "WPCLI is not installed with EasyEngine") if self.app.pargs.mailscanner: if EEAptGet.is_installed(self, 'amavisd-new'): apt_packages = (apt_packages + EEVariables.ee_mailscanner) else: Log.info(self, "MailScanner is not installed") if len(packages) or len(apt_packages): Log.info( self, "During package update process non nginx-cached" " parts of your site may remain down") # Check prompt if (not self.app.pargs.no_prompt): start_upgrade = input("Do you want to continue:[y/N]") if start_upgrade != "Y" and start_upgrade != "y": Log.error(self, "Not starting package update") Log.info(self, "Updating packages, please wait...") if len(apt_packages): # apt-get update EEAptGet.update(self) # Update packages EEAptGet.install(self, apt_packages) # Post Actions after package updates if (set(EEVariables.ee_nginx).issubset(set(apt_packages)) or set(EEVariables.ee_nginx_dev).issubset( set(apt_packages))): EEService.restart_service(self, 'nginx') if EEVariables.ee_platform_codename != 'trusty': if set(EEVariables.ee_php).issubset(set(apt_packages)): EEService.restart_service(self, 'php5-fpm') else: if set(EEVariables.ee_php5_6).issubset( set(apt_packages)): EEService.restart_service(self, 'php5.6-fpm') if set(EEVariables.ee_php7_0).issubset( set(apt_packages)): EEService.restart_service(self, 'php7.0-fpm') if set(EEVariables.ee_hhvm).issubset(set(apt_packages)): EEService.restart_service(self, 'hhvm') if set(EEVariables.ee_postfix).issubset(set(apt_packages)): EEService.restart_service(self, 'postfix') if set(EEVariables.ee_mysql).issubset(set(apt_packages)): EEService.restart_service(self, 'mysql') if set(EEVariables.ee_mail).issubset(set(apt_packages)): EEService.restart_service(self, 'dovecot') if set(EEVariables.ee_redis).issubset(set(apt_packages)): EEService.restart_service(self, 'redis-server') if len(packages): if self.app.pargs.wpcli: EEFileUtils.remove(self, ['/usr/bin/wp']) Log.debug(self, "Downloading following: {0}".format(packages)) EEDownload.download(self, packages) if self.app.pargs.wpcli: EEFileUtils.chmod(self, "/usr/bin/wp", 0o775) Log.info(self, "Successfully updated packages") # PHP 5.6 to 5.6 elif (self.app.pargs.php56): self.upgrade_php56() else: self.app.args.print_help()
def default(self): # All package update if ((not self.app.pargs.php56)): apt_packages = [] packages = [] if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.mysql) and (not self.app.pargs.postfix) and (not self.app.pargs.hhvm) and (not self.app.pargs.mailscanner) and (not self.app.pargs.all) and (not self.app.pargs.wpcli) and (not self.app.pargs.redis) and (not self.app.pargs.nginxmainline)): self.app.pargs.web = True if self.app.pargs.all: self.app.pargs.web = True self.app.pargs.mail = True if self.app.pargs.web: if EEAptGet.is_installed(self, 'nginx-custom'): self.app.pargs.nginx = True # elif EEAptGet.is_installed(self, 'nginx-mainline'): # self.app.pargs.nginxmainline = True else: Log.info(self, "Nginx is not already installed") self.app.pargs.php = True self.app.pargs.mysql = True self.app.pargs.postfix = True self.app.pargs.wpcli = True if self.app.pargs.mail: self.app.pargs.nginx = True self.app.pargs.php = True self.app.pargs.mysql = True self.app.pargs.wpcli = True self.app.pargs.postfix = True if EEAptGet.is_installed(self, 'dovecot-core'): apt_packages = apt_packages + EEVariables.ee_mail self.app.pargs.mailscanner = True else: Log.info(self, "Mail server is not installed") if self.app.pargs.nginx : if EEAptGet.is_installed(self, 'nginx-custom'): apt_packages = apt_packages + EEVariables.ee_nginx else: Log.info(self, "Nginx Stable is not already installed") # if self.app.pargs.nginxmainline: # if EEAptGet.is_installed(self, 'nginx-mainline'): # apt_packages = apt_packages + EEVariables.ee_nginx_dev # else: # Log.info(self, "Nginx Mainline is not already installed") if self.app.pargs.php: if (EEVariables.ee_platform_distro == 'debian' or EEVariables.ee_platform_codename == 'precise'): if EEAptGet.is_installed(self, 'php5-fpm'): apt_packages = apt_packages + EEVariables.ee_php else: Log.info(self, "PHP is not installed") else: if EEAptGet.is_installed(self, 'php5.6-fpm'): apt_packages = apt_packages + EEVariables.ee_php5_6 + EEVariables.ee_php_extra else: Log.info(self, "PHP 5.6 is not installed") if EEAptGet.is_installed(self, 'php7.0-fpm'): apt_packages = apt_packages + EEVariables.ee_php7_0 + EEVariables.ee_php_extra else: Log.info(self, "PHP 7.0 is not installed") if self.app.pargs.hhvm: if EEAptGet.is_installed(self, 'hhvm'): apt_packages = apt_packages + EEVariables.ee_hhvm else: Log.info(self, "HHVM is not installed") if self.app.pargs.mysql: if EEAptGet.is_installed(self, 'mariadb-server'): apt_packages = apt_packages + EEVariables.ee_mysql else: Log.info(self, "MariaDB is not installed") if self.app.pargs.postfix: if EEAptGet.is_installed(self, 'postfix'): apt_packages = apt_packages + EEVariables.ee_postfix else: Log.info(self, "Postfix is not installed") if self.app.pargs.redis: if EEAptGet.is_installed(self, 'redis-server'): apt_packages = apt_packages + EEVariables.ee_redis else: Log.info(self, "Redis is not installed") if self.app.pargs.wpcli: if os.path.isfile('/usr/bin/wp'): packages = packages + [["https://github.com/wp-cli/wp-cli/" "releases/download/v{0}/" "wp-cli-{0}.phar" "".format(EEVariables.ee_wp_cli), "/usr/bin/wp", "WP-CLI"]] else: Log.info(self, "WPCLI is not installed with EasyEngine") if self.app.pargs.mailscanner: if EEAptGet.is_installed(self, 'amavisd-new'): apt_packages = (apt_packages + EEVariables.ee_mailscanner) else: Log.info(self, "MailScanner is not installed") if len(packages) or len(apt_packages): Log.info(self, "During package update process non nginx-cached" " parts of your site may remain down") # Check prompt if (not self.app.pargs.no_prompt): start_upgrade = input("Do you want to continue:[y/N]") if start_upgrade != "Y" and start_upgrade != "y": Log.error(self, "Not starting package update") Log.info(self, "Updating packages, please wait...") if len(apt_packages): # apt-get update EEAptGet.update(self) # Update packages EEAptGet.install(self, apt_packages) # Post Actions after package updates if (set(EEVariables.ee_nginx).issubset(set(apt_packages))): EEService.restart_service(self, 'nginx') if (EEVariables.ee_platform_distro == 'debian' or EEVariables.ee_platform_codename == 'precise'): if set(EEVariables.ee_php).issubset(set(apt_packages)): EEService.restart_service(self, 'php5-fpm') else: if set(EEVariables.ee_php5_6).issubset(set(apt_packages)): EEService.restart_service(self, 'php5.6-fpm') if set(EEVariables.ee_php7_0).issubset(set(apt_packages)): EEService.restart_service(self, 'php7.0-fpm') if set(EEVariables.ee_hhvm).issubset(set(apt_packages)): EEService.restart_service(self, 'hhvm') if set(EEVariables.ee_postfix).issubset(set(apt_packages)): EEService.restart_service(self, 'postfix') if set(EEVariables.ee_mysql).issubset(set(apt_packages)): EEService.restart_service(self, 'mysql') if set(EEVariables.ee_mail).issubset(set(apt_packages)): EEService.restart_service(self, 'dovecot') if set(EEVariables.ee_redis).issubset(set(apt_packages)): EEService.restart_service(self, 'redis-server') if len(packages): if self.app.pargs.wpcli: EEFileUtils.remove(self,['/usr/bin/wp']) Log.debug(self, "Downloading following: {0}".format(packages)) EEDownload.download(self, packages) if self.app.pargs.wpcli: EEFileUtils.chmod(self, "/usr/bin/wp", 0o775) Log.info(self, "Successfully updated packages") # PHP 5.6 to 5.6 elif (self.app.pargs.php56): self.upgrade_php56() else: self.app.args.print_help()