mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-10 07:16:15 +01:00
docker sites model
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
from django.db import models
|
||||
from loginSystem.models import Administrator
|
||||
from websiteFunctions.website import Websites
|
||||
|
||||
# Create your models here.
|
||||
class Containers(models.Model):
|
||||
@@ -16,3 +17,30 @@ class Containers(models.Model):
|
||||
volumes = models.TextField(default="{}")
|
||||
env = models.TextField(default="{}")
|
||||
startOnReboot = models.IntegerField(default=0)
|
||||
|
||||
# Takes
|
||||
# ComposePath, MySQLPath, MySQLRootPass, MySQLDBName, MySQLDBNUser, MySQLPassword, CPUsMySQL, MemoryMySQL,
|
||||
# port, SitePath, CPUsSite, MemorySite, SiteName
|
||||
# finalURL, blogTitle, adminUser, adminPassword, adminEmail
|
||||
|
||||
### Site Type 0=wp, further tbd later
|
||||
|
||||
class DockerSites(models.Model):
|
||||
admin = models.ForeignKey(Websites, on_delete=models.CASCADE)
|
||||
ComposePath = models.TextField()
|
||||
SitePath = models.TextField()
|
||||
MySQLPath = models.TextField()
|
||||
state = models.IntegerField(default=1)
|
||||
SiteType = models.IntegerField(default=0) ## WP, Joomla etc
|
||||
MySQLDBName = models.CharField(max_length=100)
|
||||
MySQLDBNUser = models.CharField(max_length=100)
|
||||
CPUsMySQL = models.CharField(max_length=100)
|
||||
MemoryMySQL = models.CharField(max_length=100)
|
||||
port = models.CharField(max_length=100)
|
||||
CPUsSite = models.CharField(max_length=100)
|
||||
MemorySite = models.CharField(max_length=100)
|
||||
SiteName = models.TextField()
|
||||
finalURL = models.TextField()
|
||||
blogTitle = models.TextField()
|
||||
adminUser = models.CharField(max_length=100)
|
||||
adminEmail = models.CharField(max_length=100)
|
||||
@@ -1,3 +1,7 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import sys
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
import django
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
|
||||
@@ -30,8 +34,9 @@ class DockerSites:
|
||||
|
||||
|
||||
command = 'docker --help'
|
||||
ReturnCode = ProcessUtilities.executioner(command)
|
||||
if ReturnCode == 0:
|
||||
result = ProcessUtilities.outputExecutioner(command)
|
||||
print(f'return code of docker install {result}')
|
||||
if result.find("not found") > -1:
|
||||
status, message = self.InstallDocker()
|
||||
if status == 0:
|
||||
logging.statusWriter(self.JobID, 'Failed to installed docker. [404]')
|
||||
@@ -124,9 +129,9 @@ def Main():
|
||||
# port, SitePath, CPUsSite, MemorySite, SiteName
|
||||
# finalURL, blogTitle, adminUser, adminPassword, adminEmail
|
||||
data = {
|
||||
"JobID": 1122344566667778888,
|
||||
"ComposePath": "/home/dockercloudpagescloud/docker-compose.yml",
|
||||
"MySQLPath": '/home/dockercloudpagescloud/public_html/sqldocker',
|
||||
"JobID": '/home/cyberpanel/error-logs.txt',
|
||||
"ComposePath": "/home/cyberpanel.net/docker-compose.yml",
|
||||
"MySQLPath": '/home/cyberpanel.net/public_html/sqldocker',
|
||||
"MySQLRootPass": 'testdbwp12345',
|
||||
"MySQLDBName": 'testdbwp',
|
||||
"MySQLDBNUser": 'testdbwp',
|
||||
@@ -134,7 +139,7 @@ def Main():
|
||||
"CPUsMySQL": '2',
|
||||
"MemoryMySQL": '512',
|
||||
"port": '8000',
|
||||
"SitePath": '/home/dockercloudpagescloud/public_html/wpdocker',
|
||||
"SitePath": '/home/cyberpanel.net/public_html/wpdocker',
|
||||
"CPUsSite": '2',
|
||||
"MemorySite": '512',
|
||||
"SiteName": 'wp docker test',
|
||||
|
||||
Reference in New Issue
Block a user