Skip to content
Permalink
Browse files
add redis deamon oneclick install/remove
  • Loading branch information
usmannasir committed Aug 22, 2020
1 parent ebce934 commit 2f6a923e79de64f282584bcec8cb95517221650f
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 7 deletions.
@@ -241,16 +241,61 @@ def RemoveElasticSearch():
ServerStatusUtil.executioner(command, statusFile)


jvmOptions = '/etc/elasticsearch/jvm.options'


command = 'rm -f /home/cyberpanel/elasticsearch'
ServerStatusUtil.executioner(command, statusFile)

logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
"ElasticSearch successfully removed.[200]\n", 1)
return 0

@staticmethod
def InstallRedis():

statusFile = open(ServerStatusUtil.lswsInstallStatusPath, 'w')

if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
command = 'yum install redis -y'
ServerStatusUtil.executioner(command, statusFile)
else:

command = 'apt-get install redis-server -y'
ServerStatusUtil.executioner(command, statusFile)


command = 'systemctl enable redis'
ServerStatusUtil.executioner(command, statusFile)

command = 'systemctl start redis'
ServerStatusUtil.executioner(command, statusFile)

command = 'touch /home/cyberpanel/redis'
ServerStatusUtil.executioner(command, statusFile)

logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
"Redis successfully installed.[200]\n", 1)
return 0

@staticmethod
def RemoveRedis():

statusFile = open(ServerStatusUtil.lswsInstallStatusPath, 'w')

if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
command = 'yum erase redis -y'
ServerStatusUtil.executioner(command, statusFile)
else:

command = 'apt-get remove redis-server -y'
ServerStatusUtil.executioner(command, statusFile)


command = 'rm -f /home/cyberpanel/redis'
ServerStatusUtil.executioner(command, statusFile)

logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
"Redis successfully removed.[200]\n", 1)
return 0

def main():

parser = argparse.ArgumentParser(description='CyberPanel Application Manager')
@@ -263,6 +308,10 @@ def main():
ServiceManager.InstallElasticSearch()
elif args["function"] == "RemoveElasticSearch":
ServiceManager.RemoveElasticSearch()
elif args["function"] == "InstallRedis":
ServiceManager.InstallRedis()
elif args["function"] == "RemoveRedis":
ServiceManager.RemoveRedis()



Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -497,9 +497,7 @@ app.controller('manageApplications', function ($scope, $http, $timeout, $window)


function ListInitialDatas(response) {

if (response.data.abort === 0) {
$scope.cyberpanelLoading = true;
$scope.requestData = response.data.requestStatus;
$timeout(getRequestStatus, 1000);
} else {
@@ -315,14 +315,23 @@ def manageApplications(request):
## ElasticSearch

esPath = '/home/cyberpanel/elasticsearch'
rPath = '/home/cyberpanel/redis'

if os.path.exists(esPath):
installed = 'Installed'
else:
installed = 'Not-Installed'

if os.path.exists(rPath):
rInstalled = 'Installed'
else:
rInstalled = 'Not-Installed'

elasticSearch = {'image': '/static/manageServices/images/elastic-search.png', 'name': 'Elastic Search', 'installed': installed}
redis = {'image': '/static/manageServices/images/redis.png', 'name': 'Redis',
'installed': rInstalled}
services.append(elasticSearch)
services.append(redis)

try:
return render(request, 'manageServices/applications.html', {'services': services})
@@ -353,6 +362,11 @@ def removeInstall(request):
command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/manageServices/serviceManager.py --function InstallElasticSearch'
else:
command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/manageServices/serviceManager.py --function RemoveElasticSearch'
elif appName == 'Redis':
if status == 'Installing':
command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/manageServices/serviceManager.py --function InstallRedis'
else:
command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/manageServices/serviceManager.py --function RemoveRedis'

ProcessUtilities.popenExecutioner(command)
data_ret = {'status': 1}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -497,9 +497,7 @@ app.controller('manageApplications', function ($scope, $http, $timeout, $window)


function ListInitialDatas(response) {

if (response.data.abort === 0) {
$scope.cyberpanelLoading = true;
$scope.requestData = response.data.requestStatus;
$timeout(getRequestStatus, 1000);
} else {

0 comments on commit 2f6a923

Please sign in to comment.