diff --git a/app/controllers/super_admin/instance_statuses_controller.rb b/app/controllers/super_admin/instance_statuses_controller.rb new file mode 100644 index 000000000..d0ea97798 --- /dev/null +++ b/app/controllers/super_admin/instance_statuses_controller.rb @@ -0,0 +1,39 @@ +class SuperAdmin::InstanceStatusesController < SuperAdmin::ApplicationController + def show + @instance_version = get_version + @instance_sha = get_sha + @instance_postgres = get_postgres_status + @instance_redis = get_redis_status + end + + def get_version + Chatwoot.config[:version] + end + + def get_sha + sha = `git rev-parse HEAD` + if sha.blank? + return "undefined" + else + return sha + end + end + + def get_postgres_status + if ActiveRecord::Base.connection.active? + return true + else + return false + end + end + + def get_redis_status + r = Redis.new(Redis::Config.app) + if r.ping == "PONG" + return true + else + return false + end + end + +end diff --git a/app/helpers/super_admin/instance_statuses_helper.rb b/app/helpers/super_admin/instance_statuses_helper.rb new file mode 100644 index 000000000..ab00f4dd3 --- /dev/null +++ b/app/helpers/super_admin/instance_statuses_helper.rb @@ -0,0 +1,2 @@ +module SuperAdmin::InstanceStatusesHelper +end diff --git a/app/views/super_admin/application/_navigation.html.erb b/app/views/super_admin/application/_navigation.html.erb index 73e7c29af..c80a1cde0 100644 --- a/app/views/super_admin/application/_navigation.html.erb +++ b/app/views/super_admin/application/_navigation.html.erb @@ -50,6 +50,11 @@ as defined by the routes in the `admin/` namespace <% end %> + +