mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-05-09 19:17:25 +02:00
add redis deamon oneclick install/remove
This commit is contained in:
@@ -241,9 +241,6 @@ type=rpm-md
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
|
||||
|
||||
jvmOptions = '/etc/elasticsearch/jvm.options'
|
||||
|
||||
|
||||
command = 'rm -f /home/cyberpanel/elasticsearch'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
|
||||
@@ -251,6 +248,54 @@ type=rpm-md
|
||||
"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()
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
manageServices/static/manageServices/images/redis.png
Normal file
BIN
manageServices/static/manageServices/images/redis.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
@@ -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}
|
||||
|
||||
BIN
static/manageServices/images/redis.png
Normal file
BIN
static/manageServices/images/redis.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user