def install(self): try: self.queue.put(('Preparing for installation', 'ONPROGRESS')) helm = Gluu() if gluu_settings.db.get("INSTALL_REDIS") == "Y" or \ gluu_settings.db.get("INSTALL_GLUU_GATEWAY") == "Y" or \ gluu_settings.db.get("JACKRABBIT_CLUSTER") == "Y": from pygluu.kubernetes.kubedb import Kubedb kubedb = Kubedb() kubedb.uninstall_kubedb() kubedb.install_kubedb() if gluu_settings.db.get("JACKRABBIT_CLUSTER") == "Y": from pygluu.kubernetes.postgres import Postgres postgres = Postgres() postgres.install_postgres() if gluu_settings.db.get("INSTALL_REDIS") == "Y": from pygluu.kubernetes.redis import Redis redis = Redis() redis.uninstall_redis() redis.install_redis() self.queue.put(('Installation in progress', 'ONPROGRESS')) helm.install_gluu() self.queue.put(('Installation is complete', 'COMPLETED')) except SystemExit: if self.queue: self.queue.put(("Oops! Something went wrong", "ERROR")) else: logger.error("***** Error caught in main loop *****") logger.error(traceback.format_exc())
def install(self): try: self.queue.put(('Preparing for installation', 'ONPROGRESS')) helm = Gluu() if gluu_settings.db.get("installer-settings.redis.install") or \ gluu_settings.db.get("installer-settings.gluuGateway.install") or \ gluu_settings.db.get("installer-settings.jackrabbit.clusterMode"): from pygluu.kubernetes.kubedb import Kubedb kubedb = Kubedb() kubedb.uninstall_kubedb() kubedb.install_kubedb() if gluu_settings.db.get( "installer-settings.jackrabbit.clusterMode"): from pygluu.kubernetes.postgres import Postgres postgres = Postgres() postgres.install_postgres() if gluu_settings.db.get("installer-settings.redis.install"): from pygluu.kubernetes.redis import Redis redis = Redis() redis.uninstall_redis() redis.install_redis() self.queue.put(('Installation in progress', 'ONPROGRESS')) helm.install_gluu() self.queue.put(('Installation is complete', 'COMPLETED')) except SystemExit: if self.queue: self.queue.put(("Oops! Something went wrong", "ERROR")) else: logger.error("***** Error caught in main loop *****") logger.error(traceback.format_exc())
def install_ldap_backup(self): try: self.queue.put(('Installation in progress', 'ONPROGRESS')) gluu = Gluu() gluu.install_ldap_backup() self.queue.put(('Installation is complete', 'COMPLETED')) except SystemExit: if self.queue: self.queue.put(("Oops! Something went wrong", "ERROR")) else: logger.error("***** Error caught in main loop *****") logger.error(traceback.format_exc())
def uninstall_gluu(self): try: self.queue.put(('Uninstalling...', 'ONPROGRESS')) helm = Gluu() helm.uninstall_gluu() self.queue.put(('Uninstall is complete', 'COMPLETED')) except SystemExit: if self.queue: self.queue.put(("Oops! Something went wrong", "ERROR")) else: logger.error("***** Error caught in main loop *****") logger.error(traceback.format_exc())
def upgrade_values_yaml(self): try: # New feature in 4.2 compared to 4.1 and hence if enabled should make # sure kubedb is installed. helm = Gluu() if gluu_settings.db.get("JACKRABBIT_CLUSTER") == "Y": from pygluu.kubernetes.kubedb import Kubedb kubedb = Kubedb() kubedb.uninstall_kubedb() kubedb.install_kubedb() helm = Gluu() logger.info("Patching values.yaml for helm upgrade...") self.queue.put(('Upgrading...', 'ONPROGRESS')) helm.analyze_global_values() logger.info( "Please find your patched values.yaml at the location ./helm/gluu/values.yaml." "Continue with the steps found at https://gluu.org/docs/gluu-server/4.2/upgrade/#helm" ) self.queue.put(('Upgrade is complete', 'COMPLETED')) except SystemExit: if self.queue: self.queue.put(("Oops! Something went wrong", "ERROR")) else: logger.error("***** Error caught in main loop *****") logger.error(traceback.format_exc())
def helm_install_gluu(self): try: helm = Gluu() self.queue.put(('Preparing for installation', 'ONPROGRESS')) helm.uninstall_gluu() self.queue.put(('Installation in progress', 'ONPROGRESS')) helm.install_gluu(install_ingress=False) self.queue.put(('Installation is complete', 'COMPLETED')) except SystemExit: if self.queue: self.queue.put(("Oops! Something went wrong", "ERROR")) else: logger.error("***** Error caught in main loop *****") logger.error(traceback.format_exc())
def uninstall(self): try: from pygluu.kubernetes.gluugateway import GluuGateway from pygluu.kubernetes.kubedb import Kubedb gluugateway = GluuGateway() helm = Gluu() self.queue.put(('Uninstalling', 'ONPROGRESS')) helm.uninstall_gluu() helm.uninstall_nginx_ingress() gluugateway.uninstall_gluu_gateway_dbmode() gluugateway.uninstall_gluu_gateway_ui() logger.info("Please wait...") time.sleep(30) kubedb = Kubedb() kubedb.uninstall_kubedb() self.queue.put(('Uninstall is complete', 'COMPLETED')) except SystemExit: if self.queue: self.queue.put(("Oops! Something went wrong", "ERROR")) else: logger.error("***** Error caught in main loop *****") logger.error(traceback.format_exc())
def main(): parser = create_parser() args = parser.parse_args(sys.argv[1:]) if not args.subparser_name: parser.print_help() return copy_templates() settings = SettingsHandler() settings.validate() if not settings.validate(): for error in settings.errors: logger.error(error) sys.exit() prompts = Prompt() prompts.prompt() settings = SettingsHandler() try: if args.subparser_name == "install-ldap-backup": gluu = Gluu() gluu.install_ldap_backup() elif args.subparser_name == "uninstall-gluu": from pygluu.kubernetes.terminal.helm import PromptHelm prompt_helm = PromptHelm(settings) prompt_helm.prompt_helm() gluu = Gluu() gluu.uninstall_gluu() if settings.get("INSTALL_REDIS") == "Y" or settings.get("INSTALL_GLUU_GATEWAY") == "Y": from pygluu.kubernetes.kubedb import Kubedb kubedb = Kubedb() kubedb.uninstall_kubedb() elif args.subparser_name == "upgrade-values-yaml": from pygluu.kubernetes.terminal.upgrade import PromptUpgrade # New feature in 4.2 compared to 4.1 and hence if enabled should make sure kubedb is installed. gluu = Gluu() if settings.get("JACKRABBIT_CLUSTER") == "Y": from pygluu.kubernetes.kubedb import Kubedb kubedb = Kubedb() kubedb.uninstall_kubedb() kubedb.install_kubedb() prompt_upgrade = PromptUpgrade(settings) prompt_upgrade.prompt_upgrade() gluu = Gluu() logger.info("Patching values.yaml for helm upgrade...") gluu.analyze_global_values() logger.info("Please find your patched values.yaml at the location ./helm/gluu/values.yaml." "Continue with the steps found at https://gluu.org/docs/gluu-server/latest/upgrade/#helm") elif args.subparser_name == "install-couchbase": from pygluu.kubernetes.terminal.couchbase import PromptCouchbase prompt_couchbase = PromptCouchbase(settings) prompt_couchbase.prompt_couchbase() couchbase = Couchbase() couchbase.install() elif args.subparser_name == "install-couchbase-backup": from pygluu.kubernetes.terminal.couchbase import PromptCouchbase prompt_couchbase = PromptCouchbase(settings) prompt_couchbase.prompt_couchbase() couchbase = Couchbase() couchbase.setup_backup_couchbase() elif args.subparser_name == "uninstall-couchbase": from pygluu.kubernetes.terminal.couchbase import PromptCouchbase prompt_couchbase = PromptCouchbase(settings) prompt_couchbase.prompt_couchbase() couchbase = Couchbase() couchbase.uninstall() elif args.subparser_name == "install-kubedb": from pygluu.kubernetes.kubedb import Kubedb kubedb = Kubedb() kubedb.install_kubedb() elif args.subparser_name == "generate-settings": logger.info("settings.json has been generated") elif args.subparser_name == "install": from pygluu.kubernetes.terminal.helm import PromptHelm prompt_helm = PromptHelm(settings) prompt_helm.prompt_helm() gluu = Gluu() if settings.get("INSTALL_REDIS") == "Y" or \ settings.get("INSTALL_GLUU_GATEWAY") == "Y" or \ settings.get("JACKRABBIT_CLUSTER") == "Y": from pygluu.kubernetes.kubedb import Kubedb kubedb = Kubedb() kubedb.uninstall_kubedb() kubedb.install_kubedb() if settings.get("JACKRABBIT_CLUSTER") == "Y": from pygluu.kubernetes.postgres import Postgres postgres = Postgres() postgres.install_postgres() if settings.get("INSTALL_REDIS") == "Y": from pygluu.kubernetes.redis import Redis redis = Redis() redis.uninstall_redis() redis.install_redis() gluu.install_gluu() elif args.subparser_name == "uninstall": from pygluu.kubernetes.terminal.helm import PromptHelm from pygluu.kubernetes.kubedb import Kubedb from pygluu.kubernetes.gluugateway import GluuGateway prompt_helm = PromptHelm(settings) prompt_helm.prompt_helm() gluu = Gluu() gluugateway = GluuGateway() gluu.uninstall_gluu() gluu.uninstall_nginx_ingress() gluugateway.uninstall_gluu_gateway_dbmode() gluugateway.uninstall_gluu_gateway_ui() logger.info("Please wait...") time.sleep(30) kubedb = Kubedb() kubedb.uninstall_kubedb() elif args.subparser_name == "install-gluu": from pygluu.kubernetes.terminal.helm import PromptHelm prompt_helm = PromptHelm(settings) prompt_helm.prompt_helm() gluu = Gluu() gluu.uninstall_gluu() gluu.install_gluu(install_ingress=False) elif args.subparser_name == "install-gg-dbmode": from pygluu.kubernetes.terminal.helm import PromptHelm from pygluu.kubernetes.postgres import Postgres from pygluu.kubernetes.gluugateway import GluuGateway prompt_helm = PromptHelm(settings) prompt_helm.prompt_helm() postgres = Postgres() postgres.patch_or_install_postgres() gluugateway = GluuGateway() gluugateway.install_gluu_gateway_dbmode() gluugateway.install_gluu_gateway_ui() elif args.subparser_name == "uninstall-gg-dbmode": from pygluu.kubernetes.terminal.helm import PromptHelm from pygluu.kubernetes.postgres import Postgres from pygluu.kubernetes.gluugateway import GluuGateway prompt_helm = PromptHelm(settings) prompt_helm.prompt_helm() postgres = Postgres() postgres.uninstall_postgres() gluugateway = GluuGateway() gluugateway.uninstall_gluu_gateway_dbmode() gluugateway.uninstall_gluu_gateway_ui() except KeyboardInterrupt: print("\n[I] Canceled by user; exiting ...")
def main(): parser = create_parser() args = parser.parse_args(sys.argv[1:]) if not args.subparser_name: parser.print_help() return if args.subparser_name == "version": from pygluu.kubernetes import __version__ logger.info(f"pygluu installer version is : {__version__}") return copy_templates() # Prepare override-values.yaml for parsing shutil.copy(Path("./helm/gluu/values.yaml"), Path("./helm/gluu/override-values.yaml")) settings = ValuesHandler() settings.load() prompts = Prompt() prompts.prompt() settings = ValuesHandler() try: if args.subparser_name == "uninstall-gluu": gluu = Gluu() gluu.uninstall_gluu() if settings.get("installer-settings.redis.install"): # TODO: Make sure remove redis or postgres if installled by Gluu logger.info("remove me after implementing TODO") elif args.subparser_name == "upgrade-values-yaml": from pygluu.kubernetes.terminal.upgrade import PromptUpgrade # New feature in 4.2 compared to 4.1 and hence if enabled should make sure postgres is installed. gluu = Gluu() if settings.get("installer-settings.jackrabbit.clusterMode") and \ settings.get("installer-settings.postgres.install"): # TODO: Make sure postgres is installed logger.info("remove me after implementing TODO") prompt_upgrade = PromptUpgrade(settings) prompt_upgrade.prompt_upgrade() logger.info("Patching values.yaml for helm upgrade...") logger.info("Please find your patched values.yaml at the location ./helm/gluu/values.yaml." "Continue with the steps found at https://gluu.org/docs/gluu-server/latest/upgrade/#helm") elif args.subparser_name == "install-couchbase": from pygluu.kubernetes.terminal.couchbase import PromptCouchbase prompt_couchbase = PromptCouchbase(settings) prompt_couchbase.prompt_couchbase() couchbase = Couchbase() couchbase.install() elif args.subparser_name == "install-couchbase-backup": from pygluu.kubernetes.terminal.couchbase import PromptCouchbase prompt_couchbase = PromptCouchbase(settings) prompt_couchbase.prompt_couchbase() couchbase = Couchbase() couchbase.setup_backup_couchbase() elif args.subparser_name == "uninstall-couchbase": from pygluu.kubernetes.terminal.couchbase import PromptCouchbase prompt_couchbase = PromptCouchbase(settings) prompt_couchbase.prompt_couchbase() couchbase = Couchbase() couchbase.uninstall() elif args.subparser_name == "generate-settings": logger.info("settings.json has been generated") elif args.subparser_name == "install": gluu = Gluu() if settings.get("installer-settings.postgres.install"): from pygluu.kubernetes.postgres import Postgres postgres = Postgres() postgres.install_postgres() if settings.get("installer-settings.redis.install"): from pygluu.kubernetes.redis import Redis redis = Redis() redis.uninstall_redis() redis.install_redis() if settings.get("installer-settings.sql.install") and \ settings.get("config.configmap.cnSqlDbDialect") == "mysql": from pygluu.kubernetes.mysql import MySQL sql = MySQL() sql.install_mysql() gluu.install_gluu() elif args.subparser_name == "uninstall": gluu = Gluu() gluu.uninstall_gluu() gluu.uninstall_nginx_ingress() logger.info("Please wait...") elif args.subparser_name == "install-gluu": gluu = Gluu() gluu.uninstall_gluu() gluu.install_gluu(install_ingress=False) except KeyboardInterrupt: print("\n[I] Canceled by user; exiting ...")