mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-10 23:36:11 +01:00
merge docker volume code changes
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
*.pyc
|
||||
containerization
|
||||
|
||||
@@ -65,7 +65,8 @@ INSTALLED_APPS = [
|
||||
'cloudAPI',
|
||||
'highAvailability',
|
||||
's3Backups',
|
||||
'dockerManager'
|
||||
'dockerManager',
|
||||
'containerization'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
||||
@@ -41,4 +41,5 @@ urlpatterns = [
|
||||
url(r'^emailMarketing/', include('emailMarketing.urls')),
|
||||
url(r'^cloudAPI/', include('cloudAPI.urls')),
|
||||
url(r'^docker/', include('dockerManager.urls')),
|
||||
url(r'^container/', include('containerization.urls')),
|
||||
]
|
||||
|
||||
@@ -570,7 +570,7 @@ def changeAdminPassword(request):
|
||||
firstName="Cyber", lastName="Panel", acl=acl, token=token)
|
||||
admin.save()
|
||||
|
||||
vers = version(currentVersion="1.7", build=7)
|
||||
vers = version(currentVersion="1.8", build=0)
|
||||
vers.save()
|
||||
|
||||
package = Package(admin=admin, packageName="Default", diskSpace=1000,
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'baseTemplate/custom-js/pnotify.custom.min.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'websiteFunctions/websiteFunctions.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="https://www.jsdelivr.com/package/npm/fontawesome">
|
||||
<!-- Components theme, component below was above three CSS files. -->
|
||||
|
||||
|
||||
@@ -115,6 +116,8 @@
|
||||
}, 300);
|
||||
});
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/flot-charts@0.8.3/jquery.flot.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery.flot@0.8.3/jquery.flot.time.js"></script>
|
||||
|
||||
<!-- JS Ends -->
|
||||
|
||||
@@ -608,6 +611,24 @@
|
||||
|
||||
<li class="header serverACL"><span>{% trans "Server" %}</span></li>
|
||||
|
||||
|
||||
<li class="serverACL">
|
||||
<a href="#" title="{% trans 'Containerization' %}">
|
||||
<i class="glyph-icon icon-linecons-fire"></i>
|
||||
<span>{% trans "Containerization" %}</span>
|
||||
<span class="bs-label badge-yellow">{% trans "NEW" %}</span>
|
||||
</a>
|
||||
<div class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
<li><a href="{% url 'cHome' %}"
|
||||
title="{% trans 'Create Website Limits' %}"><span>{% trans "Create Limits" %}</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
<li class="serverACL">
|
||||
<a href="#" title="{% trans 'Docker' %}">
|
||||
<i class="glyph-icon icon-linecons-fire"></i>
|
||||
@@ -886,6 +907,7 @@
|
||||
<script src="{% static 'manageSSL/manageSSL.js' %}"></script>
|
||||
<script src="{% static 'manageServices/manageServices.js' %}"></script>
|
||||
<script src="{% static 'dockerManager/dockerManager.js' %}"></script>
|
||||
<script src="{% static 'containerization/containerization.js' %}"></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -11,7 +11,6 @@ urlpatterns = [
|
||||
#url(r'^upgrade',views.upgrade, name='upgrade'),
|
||||
|
||||
url(r'^UpgradeStatus',views.upgradeStatus, name='UpgradeStatus'),
|
||||
|
||||
url(r'^upgradeVersion',views.upgradeVersion, name='upgradeVersion'),
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
|
||||
from cloudManager import CloudManager
|
||||
import json
|
||||
from loginSystem.models import Administrator
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
|
||||
def router(request):
|
||||
try:
|
||||
@@ -13,6 +14,7 @@ def router(request):
|
||||
serverUserName = data['serverUserName']
|
||||
admin = Administrator.objects.get(userName=serverUserName)
|
||||
|
||||
|
||||
cm = CloudManager(data, admin)
|
||||
|
||||
if controller == 'statusFunc':
|
||||
|
||||
1120
dockerManager/container.py
Normal file
1120
dockerManager/container.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@ import docker
|
||||
import json
|
||||
from django.http import HttpResponse
|
||||
from loginSystem.views import loadLoginPage
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
|
||||
def preDockerRun(function):
|
||||
def wrap(request, *args, **kwargs):
|
||||
@@ -36,7 +37,8 @@ def preDockerRun(function):
|
||||
try:
|
||||
client = docker.from_env()
|
||||
client.ping()
|
||||
except:
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg))
|
||||
if isPost:
|
||||
data_ret = {'status': 0, 'error_message': 'Docker daemon not running or not responsive'}
|
||||
json_data = json.dumps(data_ret)
|
||||
@@ -45,4 +47,5 @@ def preDockerRun(function):
|
||||
return render(request, 'dockerManager/install.html', {'status':admin.type, 'conErr':1})
|
||||
|
||||
return function(request, *args, **kwargs)
|
||||
|
||||
return wrap
|
||||
@@ -13,5 +13,6 @@ class Containers(models.Model):
|
||||
tag = models.CharField(max_length=50, default='unknown')
|
||||
memory = models.IntegerField(default=0)
|
||||
ports = models.TextField(default="{}")
|
||||
volumes = models.TextField(default="{}")
|
||||
env = models.TextField(default="{}")
|
||||
startOnReboot = models.IntegerField(default=0)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
app.controller('installDocker', function ($scope, $http, $timeout, $window) {
|
||||
$scope.installDockerStatus = true;
|
||||
$scope.installBoxGen = true;
|
||||
@@ -120,18 +118,27 @@ app.controller('runContainer', function ($scope, $http) {
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.goBackDisable = true;
|
||||
|
||||
$scope.volList = {};
|
||||
$scope.volListNumber = 0;
|
||||
$scope.addVolField = function () {
|
||||
$scope.volList[$scope.volListNumber] = {'dest': '', 'src': ''};
|
||||
$scope.volListNumber = $scope.volListNumber + 1;
|
||||
console.log($scope.volList)
|
||||
};
|
||||
$scope.removeVolField = function () {
|
||||
delete $scope.volList[$scope.volListNumber - 1];
|
||||
$scope.volListNumber = $scope.volListNumber - 1;
|
||||
};
|
||||
|
||||
$scope.addEnvField = function () {
|
||||
var countEnv = Object.keys($scope.envList).length;
|
||||
$scope.envList[countEnv + 1] = {'name': '', 'value': ''};
|
||||
}
|
||||
};
|
||||
|
||||
var statusFile;
|
||||
|
||||
$scope.createContainer = function () {
|
||||
|
||||
console.log($scope.iport);
|
||||
console.log($scope.portType);
|
||||
|
||||
$scope.containerCreationLoading = true;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
@@ -157,7 +164,8 @@ app.controller('runContainer', function ($scope, $http) {
|
||||
memory: memory,
|
||||
dockerOwner: dockerOwner,
|
||||
image: image,
|
||||
envList: $scope.envList
|
||||
envList: $scope.envList,
|
||||
volList: $scope.volList
|
||||
|
||||
};
|
||||
|
||||
@@ -165,8 +173,6 @@ app.controller('runContainer', function ($scope, $http) {
|
||||
data[port + "/" + protocol] = $scope.eport[port];
|
||||
});
|
||||
|
||||
console.log(data)
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
@@ -314,7 +320,7 @@ app.controller('listContainers', function ($scope, $http) {
|
||||
if (response.data.delContainerStatus === 1) {
|
||||
location.reload();
|
||||
}
|
||||
else if (response.data.delContainerStatus == 2) {
|
||||
else if (response.data.delContainerStatus === 2) {
|
||||
(new PNotify({
|
||||
title: response.data.error_message,
|
||||
text: 'Delete anyway?',
|
||||
@@ -382,7 +388,6 @@ app.controller('listContainers', function ($scope, $http) {
|
||||
else {
|
||||
name = $scope.activeLog;
|
||||
}
|
||||
console.log(name)
|
||||
$scope.logs = "Loading...";
|
||||
|
||||
url = "/docker/getContainerLogs";
|
||||
@@ -420,7 +425,7 @@ app.controller('listContainers', function ($scope, $http) {
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
url = "/docker/getContainerList";
|
||||
|
||||
@@ -697,7 +702,16 @@ app.controller('viewContainer', function ($scope, $http) {
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
$scope.addVolField = function () {
|
||||
$scope.volList[$scope.volListNumber] = {'dest': '', 'src': ''};
|
||||
$scope.volListNumber = $scope.volListNumber + 1;
|
||||
};
|
||||
$scope.removeVolField = function () {
|
||||
delete $scope.volList[$scope.volListNumber - 1];
|
||||
$scope.volListNumber = $scope.volListNumber - 1;
|
||||
};
|
||||
|
||||
$scope.saveSettings = function () {
|
||||
$('#containerSettingLoading').show();
|
||||
@@ -709,10 +723,11 @@ app.controller('viewContainer', function ($scope, $http) {
|
||||
memory: $scope.memory,
|
||||
startOnReboot: $scope.startOnReboot,
|
||||
envConfirmation: $scope.envConfirmation,
|
||||
envList: $scope.envList
|
||||
envList: $scope.envList,
|
||||
volList: $scope.volList
|
||||
};
|
||||
|
||||
console.log(data)
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
|
||||
@@ -107,11 +107,38 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="col-md-offset-3">
|
||||
<button type="button" class="btn btn-info" ng-click="addEnvField()">Add more</button>
|
||||
</div><br>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group text-center">
|
||||
<label class="control-label">
|
||||
{% trans "Map Volumes" %}
|
||||
</label>
|
||||
</div>
|
||||
<div ng-repeat="volume in volList track by $index">
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-2">
|
||||
<input type="text" class="form-control" ng-model="volList[$index].dest" placeholder="Destination" required>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" ng-model="volList[$index].src" placeholder="Source" required>
|
||||
</div>
|
||||
<div ng-show="$last">
|
||||
<div class="col-sm-1">
|
||||
<button class="btn btn-primary" type="button" ng-click="removeVolField()"><i class="fa fa-times"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="text-center">
|
||||
<button type="button" class="btn btn-info" ng-click="addVolField()">{% trans "Add field" %}</button>
|
||||
</div><br>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
|
||||
@@ -210,12 +210,12 @@
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="envConfirmation" type="checkbox">
|
||||
Editing ENV will recreate container <i class="fa fa-warning" title="If you tick this checkbox, your container will be recreated with saved information. Data saved inside container will be deleted (Not avaialble for container created outside of cyberpanel)"></i>
|
||||
Editing ENV or Volume will recreate container <i class="fa fa-warning" title="If you tick this checkbox, your container will be recreated with saved information. Data saved inside container will be deleted (Not avaialble for container created outside of cyberpanel)"></i>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<span ng-init="envList = {}"></span>
|
||||
{% for env, value in envList.items %}
|
||||
|
||||
@@ -245,6 +245,43 @@
|
||||
<button type="button" class="btn btn-info" ng-click="addEnvField()">Add more</button>
|
||||
</div><br>
|
||||
|
||||
<span ng-init="volList = {}"></span>
|
||||
{% for key, value in volList.items %}
|
||||
|
||||
<span ng-init="volList[{{ forloop.counter0 }}] = {'dest':'{{value.bind}}' , 'src':'{{key}}'}"></span>
|
||||
<span ng-init="volListNumber={{ forloop.counter0 }} + 1"></span>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
<hr>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group text-center">
|
||||
<label class="control-label">
|
||||
{% trans "Map Volumes" %}
|
||||
</label>
|
||||
</div>
|
||||
<div ng-repeat="volume in volList track by $index">
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-2">
|
||||
<input type="text" class="form-control" ng-model="volList[$index].dest" placeholder="Destination" required>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" ng-model="volList[$index].src" placeholder="Source" required>
|
||||
</div>
|
||||
<div ng-show="$last">
|
||||
<div class="col-sm-1">
|
||||
<button class="btn btn-primary" type="button" ng-click="removeVolField()"><i class="fa fa-times"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="text-center">
|
||||
<button type="button" class="btn btn-info" ng-click="addVolField()">{% trans "Add field" %}</button>
|
||||
</div><br>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@ from __future__ import unicode_literals
|
||||
from django.shortcuts import render, redirect, HttpResponse
|
||||
from loginSystem.models import Administrator
|
||||
from loginSystem.views import loadLoginPage
|
||||
from plogical.container import ContainerManager
|
||||
from .container import ContainerManager
|
||||
from decorators import preDockerRun
|
||||
from plogical.acl import ACLManager
|
||||
import json
|
||||
|
||||
@@ -780,7 +780,7 @@ class preFlightsChecks:
|
||||
|
||||
os.chdir(self.path)
|
||||
|
||||
command = "wget http://cyberpanel.sh/CyberPanel.1.7.7.tar.gz"
|
||||
command = "wget http://cyberpanel.sh/CyberPanel.1.8.0.tar.gz"
|
||||
#command = "wget http://cyberpanel.sh/CyberPanelTemp.tar.gz"
|
||||
preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]',
|
||||
'CyberPanel Download',
|
||||
@@ -789,7 +789,7 @@ class preFlightsChecks:
|
||||
##
|
||||
|
||||
count = 0
|
||||
command = "tar zxf CyberPanel.1.7.7.tar.gz"
|
||||
command = "tar zxf CyberPanel.1.8.0.tar.gz"
|
||||
#command = "tar zxf CyberPanelTemp.tar.gz"
|
||||
preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]',
|
||||
'Extract CyberPanel',1, 1, os.EX_OSERR)
|
||||
|
||||
@@ -1361,4 +1361,3 @@ EOF
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -503,4 +503,3 @@ fi
|
||||
|
||||
finish
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -67,7 +67,7 @@
|
||||
<div class="col-md-8 col-lg-6 clearfix center-margin">
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<h3 class="text-transform-upr font-size-17">CyberPanel <span class="opacity-80">v 1.7</span></h3>
|
||||
<h3 class="text-transform-upr font-size-17">CyberPanel <span class="opacity-80">v 1.8</span></h3>
|
||||
<p class="font-gray">Web Hosting Control Panel</p>
|
||||
<div class="divider"></div>
|
||||
<ul class="reset-ul">
|
||||
|
||||
@@ -156,7 +156,7 @@ def loadLoginPage(request):
|
||||
firstName="Cyber",lastName="Panel", acl=acl, token=token)
|
||||
admin.save()
|
||||
|
||||
vers = version(currentVersion="1.7", build=7)
|
||||
vers = version(currentVersion="1.8", build=0)
|
||||
vers.save()
|
||||
|
||||
package = Package(admin=admin, packageName="Default", diskSpace=1000,
|
||||
|
||||
@@ -14,10 +14,12 @@ class httpProc:
|
||||
return render(self.request, self.templateName)
|
||||
else:
|
||||
return render(self.request, self.templateName, self.data)
|
||||
|
||||
def ajaxPre(self, status, errorMessage, success = None):
|
||||
final_dic = {'status': status, 'error_message': errorMessage, 'success': success}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def ajax(self, status, errorMessage, data = None):
|
||||
if data == None:
|
||||
finalDic = {'status': status, 'error_message': errorMessage}
|
||||
@@ -34,3 +36,9 @@ class httpProc:
|
||||
finalJson = json.dumps(finalDic)
|
||||
return HttpResponse(finalJson)
|
||||
|
||||
@staticmethod
|
||||
def AJAX(status, errorMessage, success = None):
|
||||
final_dic = {'status': status, 'error_message': errorMessage, 'success': success}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
@@ -114,5 +114,17 @@ class ProcessUtilities:
|
||||
else:
|
||||
return ProcessUtilities.centos
|
||||
|
||||
@staticmethod
|
||||
def containerCheck():
|
||||
try:
|
||||
command = 'sudo cat /etc/cgrules.conf'
|
||||
result = subprocess.call(shlex.split(command))
|
||||
if result == 1:
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
except BaseException:
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -410,6 +410,77 @@ WantedBy=multi-user.target"""
|
||||
CONSTRAINT `s3Backups_backuplogs_owner_id_c7cb5872_fk_s3Backups` FOREIGN KEY (`owner_id`) REFERENCES `s3Backups_backupplando` (`id`)
|
||||
)"""
|
||||
|
||||
try:
|
||||
cursor.execute(query)
|
||||
except:
|
||||
pass
|
||||
|
||||
##
|
||||
|
||||
query = """CREATE TABLE `s3Backups_minionodes` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`endPointURL` varchar(200) NOT NULL,
|
||||
`accessKey` varchar(200) NOT NULL,
|
||||
`secretKey` varchar(200) NOT NULL,
|
||||
`owner_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `endPointURL` (`endPointURL`),
|
||||
UNIQUE KEY `accessKey` (`accessKey`),
|
||||
KEY `s3Backups_minionodes_owner_id_e50993d9_fk_loginSyst` (`owner_id`),
|
||||
CONSTRAINT `s3Backups_minionodes_owner_id_e50993d9_fk_loginSyst` FOREIGN KEY (`owner_id`) REFERENCES `loginSystem_administrator` (`id`)
|
||||
)"""
|
||||
|
||||
try:
|
||||
cursor.execute(query)
|
||||
except:
|
||||
pass
|
||||
|
||||
query = """CREATE TABLE `s3Backups_backupplanminio` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(50) NOT NULL,
|
||||
`freq` varchar(50) NOT NULL,
|
||||
`retention` int(11) NOT NULL,
|
||||
`lastRun` varchar(50) NOT NULL,
|
||||
`minioNode_id` int(11) NOT NULL,
|
||||
`owner_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`name`),
|
||||
KEY `s3Backups_backupplan_minioNode_id_a4eaf917_fk_s3Backups` (`minioNode_id`),
|
||||
KEY `s3Backups_backupplan_owner_id_d6830e67_fk_loginSyst` (`owner_id`),
|
||||
CONSTRAINT `s3Backups_backupplan_minioNode_id_a4eaf917_fk_s3Backups` FOREIGN KEY (`minioNode_id`) REFERENCES `s3Backups_minionodes` (`id`),
|
||||
CONSTRAINT `s3Backups_backupplan_owner_id_d6830e67_fk_loginSyst` FOREIGN KEY (`owner_id`) REFERENCES `loginSystem_administrator` (`id`)
|
||||
)"""
|
||||
|
||||
try:
|
||||
cursor.execute(query)
|
||||
except:
|
||||
pass
|
||||
|
||||
query = """CREATE TABLE `s3Backups_websitesinplanminio` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`domain` varchar(100) NOT NULL,
|
||||
`owner_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `s3Backups_websitesin_owner_id_224ce049_fk_s3Backups` (`owner_id`),
|
||||
CONSTRAINT `s3Backups_websitesin_owner_id_224ce049_fk_s3Backups` FOREIGN KEY (`owner_id`) REFERENCES `s3Backups_backupplanminio` (`id`)
|
||||
)"""
|
||||
|
||||
try:
|
||||
cursor.execute(query)
|
||||
except:
|
||||
pass
|
||||
|
||||
query = """CREATE TABLE `s3Backups_backuplogsminio` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`timeStamp` varchar(200) NOT NULL,
|
||||
`level` varchar(5) NOT NULL,
|
||||
`msg` varchar(500) NOT NULL,
|
||||
`owner_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `s3Backups_backuplogs_owner_id_f19e1736_fk_s3Backups` (`owner_id`),
|
||||
CONSTRAINT `s3Backups_backuplogs_owner_id_f19e1736_fk_s3Backups` FOREIGN KEY (`owner_id`) REFERENCES `s3Backups_backupplanminio` (`id`)
|
||||
)"""
|
||||
|
||||
try:
|
||||
cursor.execute(query)
|
||||
except:
|
||||
@@ -633,6 +704,37 @@ WantedBy=multi-user.target"""
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def containerMigrations():
|
||||
try:
|
||||
connection, cursor = Upgrade.setupConnection('cyberpanel')
|
||||
|
||||
query = """CREATE TABLE `containerization_containerlimits` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`cpuPers` varchar(10) NOT NULL,
|
||||
`IO` varchar(10) NOT NULL,
|
||||
`IOPS` varchar(10) NOT NULL,
|
||||
`memory` varchar(10) NOT NULL,
|
||||
`networkSpeed` varchar(10) NOT NULL,
|
||||
`networkHexValue` varchar(10) NOT NULL,
|
||||
`enforce` int(11) NOT NULL,
|
||||
`owner_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `containerization_con_owner_id_494eb637_fk_websiteFu` (`owner_id`),
|
||||
CONSTRAINT `containerization_con_owner_id_494eb637_fk_websiteFu` FOREIGN KEY (`owner_id`) REFERENCES `websiteFunctions_websites` (`id`)
|
||||
)"""
|
||||
try:
|
||||
cursor.execute(query)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
connection.close()
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def enableServices():
|
||||
try:
|
||||
@@ -705,6 +807,11 @@ WantedBy=multi-user.target"""
|
||||
if items.find('dockerManager') > -1:
|
||||
dockerManager = 0
|
||||
|
||||
containerization = 1
|
||||
for items in data:
|
||||
if items.find('containerization') > -1:
|
||||
containerization = 0
|
||||
|
||||
|
||||
Upgrade.stdOut('Restoring settings file!')
|
||||
|
||||
@@ -724,6 +831,10 @@ WantedBy=multi-user.target"""
|
||||
writeToFile.writelines(" 's3Backups',\n")
|
||||
if dockerManager == 1:
|
||||
writeToFile.writelines(" 'dockerManager',\n")
|
||||
|
||||
if containerization == 1:
|
||||
writeToFile.writelines(" 'containerization',\n")
|
||||
|
||||
else:
|
||||
writeToFile.writelines(items)
|
||||
|
||||
@@ -906,6 +1017,7 @@ WantedBy=multi-user.target"""
|
||||
|
||||
Upgrade.applyLoginSystemMigrations()
|
||||
Upgrade.s3BackupMigrations()
|
||||
Upgrade.containerMigrations()
|
||||
Upgrade.enableServices()
|
||||
|
||||
Upgrade.installPHP73()
|
||||
|
||||
@@ -9,7 +9,6 @@ try:
|
||||
import threading as multi
|
||||
from plogical.mailUtilities import mailUtilities
|
||||
import boto3
|
||||
from minio.error import ResponseError
|
||||
from boto3.s3.transfer import TransferConfig
|
||||
import json
|
||||
from .models import *
|
||||
@@ -148,6 +147,17 @@ class S3Backups(multi.Thread):
|
||||
proc = httpProc(self.request, None, None)
|
||||
return proc.ajax(0, str(msg))
|
||||
|
||||
def fetchAWSKeys(self):
|
||||
path = '/home/cyberpanel/.aws'
|
||||
credentials = path + '/credentials'
|
||||
|
||||
data = open(credentials, 'r').readlines()
|
||||
|
||||
aws_access_key_id = data[1].split(' ')[2].strip(' ').strip('\n')
|
||||
aws_secret_access_key = data[2].split(' ')[2].strip(' ').strip('\n')
|
||||
|
||||
return aws_access_key_id, aws_secret_access_key
|
||||
|
||||
def fetchBuckets(self):
|
||||
try:
|
||||
|
||||
@@ -159,7 +169,15 @@ class S3Backups(multi.Thread):
|
||||
if currentACL['admin'] == 0:
|
||||
return proc.ajax(0, 'Only administrators can use AWS S3 Backups.')
|
||||
|
||||
s3 = boto3.resource('s3')
|
||||
|
||||
aws_access_key_id, aws_secret_access_key = self.fetchAWSKeys()
|
||||
|
||||
s3 = boto3.resource(
|
||||
's3',
|
||||
aws_access_key_id = aws_access_key_id,
|
||||
aws_secret_access_key = aws_secret_access_key
|
||||
)
|
||||
|
||||
json_data = "["
|
||||
checker = 0
|
||||
|
||||
@@ -404,7 +422,16 @@ class S3Backups(multi.Thread):
|
||||
plan = BackupPlan.objects.get(name=self.data['planName'])
|
||||
bucketName = plan.bucket.strip('\n').strip(' ')
|
||||
runTime = time.strftime("%d:%m:%Y")
|
||||
client = boto3.client('s3')
|
||||
|
||||
aws_access_key_id, aws_secret_access_key = self.fetchAWSKeys()
|
||||
|
||||
client = boto3.client(
|
||||
's3',
|
||||
aws_access_key_id = aws_access_key_id,
|
||||
aws_secret_access_key = aws_secret_access_key
|
||||
)
|
||||
|
||||
|
||||
config = TransferConfig(multipart_threshold=1024 * 25, max_concurrency=10,
|
||||
multipart_chunksize=1024 * 25, use_threads=True)
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ init()
|
||||
PHP_SUEXEC=2
|
||||
|
||||
WS_USER=nobody
|
||||
WS_GROUP=nogroup
|
||||
WS_GROUP=nobody
|
||||
|
||||
DIR_OWN="nobody:nobody"
|
||||
CONF_OWN="nobody:nobody"
|
||||
@@ -1361,4 +1361,3 @@ EOF
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -384,7 +384,7 @@ EOF
|
||||
if [ $SEL -eq "1" ]; then
|
||||
HOST_PANEL="cpanel"
|
||||
WS_USER=nobody
|
||||
WS_GROUP=nogroup
|
||||
WS_GROUP=nobody
|
||||
if [ -e "/etc/cpanel/ea4/is_ea4" ] ; then
|
||||
PANEL_VARY=".ea4"
|
||||
fi
|
||||
@@ -503,4 +503,3 @@ fi
|
||||
|
||||
finish
|
||||
|
||||
|
||||
|
||||
@@ -234,9 +234,9 @@ app.controller('listWebsites', function ($scope, $http) {
|
||||
function ListInitialData(response) {
|
||||
|
||||
if (response.data.listWebSiteStatus === 1) {
|
||||
|
||||
var finalData = JSON.parse(response.data.data);
|
||||
$scope.WebSitesList = finalData;
|
||||
$scope.pagination = response.data.pagination;
|
||||
$("#listFail").hide();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -234,9 +234,9 @@ app.controller('listWebsites', function ($scope, $http) {
|
||||
function ListInitialData(response) {
|
||||
|
||||
if (response.data.listWebSiteStatus === 1) {
|
||||
|
||||
var finalData = JSON.parse(response.data.data);
|
||||
$scope.WebSitesList = finalData;
|
||||
$scope.pagination = response.data.pagination;
|
||||
$("#listFail").hide();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
<form name="websiteCreationForm" action="/" id="createPackages"
|
||||
class="form-horizontal bordered-row">
|
||||
|
||||
@@ -165,7 +163,6 @@
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user