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 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 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 install_kubedb(self): try: self.queue.put(('Installation in progress', 'ONPROGRESS')) from pygluu.kubernetes.kubedb import Kubedb kubedb = Kubedb() kubedb.uninstall_kubedb() kubedb.install_kubedb() 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 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 ...")