mirror of
https://github.com/unraid/webgui.git
synced 2026-03-12 05:49:01 -05:00
7
plugins/dynamix.docker.manager/default.cfg
Normal file
7
plugins/dynamix.docker.manager/default.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
DOCKER_ENABLED="no"
|
||||
DOCKER_IMAGE_SIZE="20"
|
||||
DOCKER_LOG_ROTATION="yes"
|
||||
DOCKER_LOG_SIZE="50m"
|
||||
DOCKER_LOG_FILES="1"
|
||||
DOCKER_AUTHORING_MODE="no"
|
||||
DOCKER_USER_NETWORKS="remove"
|
||||
@@ -18,6 +18,7 @@ require_once "$docroot/plugins/dynamix.docker.manager/include/Helpers.php";
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
|
||||
$var = parse_ini_file('state/var.ini');
|
||||
$cfg = parse_ini_file('boot/config/docker.cfg');
|
||||
ignore_user_abort(true);
|
||||
|
||||
$DockerClient = new DockerClient();
|
||||
|
||||
@@ -38,7 +38,8 @@ $driver = DockerUtil::driver();
|
||||
|
||||
// Docker configuration file - guaranteed to exist
|
||||
$docker_cfgfile = '/boot/config/docker.cfg';
|
||||
$dockercfg = parse_ini_file($docker_cfgfile);
|
||||
$defaults = @parse_ini_file("$docroot/plugins/dynamix.docker.manager/default.cfg") ?: [];
|
||||
$dockercfg = array_replace_recursive($defaults, parse_ini_file($docker_cfgfile));
|
||||
|
||||
function var_split($item, $i=0) {
|
||||
return explode(' ',$item)[$i];
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2018, Lime Technology
|
||||
* Copyright 2014-2018, Guilherme Jardim, Eric Schultz, Jon Panozzo.
|
||||
* Copyright 2012-2018, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
|
||||
function xml_encode($string) {
|
||||
return htmlspecialchars($string, ENT_XML1, 'UTF-8');
|
||||
}
|
||||
@@ -242,7 +254,7 @@ function xmlSecurity(&$template) {
|
||||
}
|
||||
|
||||
function xmlToCommand($xml, $create_paths=false) {
|
||||
global $docroot, $var, $driver;
|
||||
global $docroot, $var, $cfg, $driver;
|
||||
$xml = xmlToVar($xml);
|
||||
$cmdName = strlen($xml['Name']) ? '--name='.escapeshellarg($xml['Name']) : '';
|
||||
$cmdPrivileged = strtolower($xml['Privileged'])=='true' ? '--privileged=true' : '';
|
||||
@@ -294,10 +306,16 @@ function xmlToCommand($xml, $create_paths=false) {
|
||||
$Devices[] = escapeshellarg($hostConfig);
|
||||
}
|
||||
}
|
||||
|
||||
$cmd = sprintf($docroot.'/plugins/dynamix.docker.manager/scripts/docker create %s %s %s %s %s %s %s %s %s %s %s %s %s',
|
||||
$cmdName, $cmdNetwork, $cmdMyIP, $cmdCPUset, $cmdPrivileged, implode(' -e ', $Variables), implode(' -l ', $Labels), implode(' -p ', $Ports), implode(' -v ', $Volumes), implode(' --device=', $Devices), $xml['ExtraParams'], escapeshellarg($xml['Repository']), $xml['PostArgs']);
|
||||
return [preg_replace('/\s+/', ' ', $cmd), $xml['Name'], $xml['Repository']];
|
||||
$logSize = $logFile = '';
|
||||
if ($cfg['DOCKER_LOG_ROTATION']=='yes') {
|
||||
$logSize = $cfg['DOCKER_LOG_SIZE'] ?? '10m';
|
||||
$logSize = "--log-opt max-size='$logSize'";
|
||||
$logFile = $cfg['DOCKER_LOG_FILES'] ?? '1';
|
||||
$logFile = "--log-opt max-file='$logFile'";
|
||||
}
|
||||
$cmd = sprintf($docroot.'/plugins/dynamix.docker.manager/scripts/docker create %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s',
|
||||
$cmdName, $cmdNetwork, $cmdMyIP, $cmdCPUset, $logSize, $logFile, $cmdPrivileged, implode(' -e ', $Variables), implode(' -l ', $Labels), implode(' -p ', $Ports), implode(' -v ', $Volumes), implode(' --device=', $Devices), $xml['ExtraParams'], escapeshellarg($xml['Repository']), $xml['PostArgs']);
|
||||
return [preg_replace('/\s\s+/', ' ', $cmd), $xml['Name'], $xml['Repository']];
|
||||
}
|
||||
function stopContainer($name, $t=10, $echo=true) {
|
||||
global $DockerClient;
|
||||
|
||||
@@ -162,22 +162,22 @@ function eventControl(params, spin) {
|
||||
}
|
||||
function startAll() {
|
||||
$('input[type=button]').prop('disabled',true);
|
||||
for (var i=0,ct; ct=docker[i]; i++) if (ct.state==0) $('#'+ct.id).find('i').removeClass('fa-square').addClass('fa-refresh fa-spin');
|
||||
for (var i=0,ct; ct=docker[i]; i++) if (ct.state==0) $('#'+ct.id).parent().find('i').removeClass('fa-square').addClass('fa-refresh fa-spin');
|
||||
$.post('/plugins/dynamix.docker.manager/include/ContainerManager.php',{action:'start'},function(){loadlist();});
|
||||
}
|
||||
function stopAll() {
|
||||
$('input[type=button]').prop('disabled',true);
|
||||
for (var i=0,ct; ct=docker[i]; i++) if (ct.state==1) $('#'+ct.id).find('i').removeClass('fa-play fa-pause').addClass('fa-refresh fa-spin');
|
||||
for (var i=0,ct; ct=docker[i]; i++) if (ct.state==1) $('#'+ct.id).parent().find('i').removeClass('fa-play fa-pause').addClass('fa-refresh fa-spin');
|
||||
$.post('/plugins/dynamix.docker.manager/include/ContainerManager.php',{action:'stop'},function(){loadlist();});
|
||||
}
|
||||
function pauseAll() {
|
||||
$('input[type=button]').prop('disabled',true);
|
||||
for (var i=0,ct; ct=docker[i]; i++) if (ct.state==1 && ct.pause==0) $('#'+ct.id).find('i').removeClass('fa-play').addClass('fa-refresh fa-spin');
|
||||
for (var i=0,ct; ct=docker[i]; i++) if (ct.state==1 && ct.pause==0) $('#'+ct.id).parent().find('i').removeClass('fa-play').addClass('fa-refresh fa-spin');
|
||||
$.post('/plugins/dynamix.docker.manager/include/ContainerManager.php',{action:'pause'},function(){loadlist();});
|
||||
}
|
||||
function resumeAll() {
|
||||
$('input[type=button]').prop('disabled',true);
|
||||
for (var i=0,ct; ct=docker[i]; i++) if (ct.state==1 && ct.pause==1) $('#'+ct.id).find('i').removeClass('fa-pause').addClass('fa-refresh fa-spin');
|
||||
for (var i=0,ct; ct=docker[i]; i++) if (ct.state==1 && ct.pause==1) $('#'+ct.id).parent().find('i').removeClass('fa-pause').addClass('fa-refresh fa-spin');
|
||||
$.post('/plugins/dynamix.docker.manager/include/ContainerManager.php',{action:'unpause'},function(){loadlist();});
|
||||
}
|
||||
function checkAll() {
|
||||
|
||||
@@ -108,12 +108,12 @@ function addVMContext(name, uuid, template, state, vncurl, log){
|
||||
}
|
||||
function startAll() {
|
||||
$('input[type=button]').prop('disabled',true);
|
||||
for (var i=0,vm; vm=kvm[i]; i++) if (vm.state!='running') $('#vm-'+vm.id).find('i').removeClass('fa-square').addClass('fa-refresh fa-spin');
|
||||
for (var i=0,vm; vm=kvm[i]; i++) if (vm.state!='running') $('#vm-'+vm.id).parent().find('i').removeClass('fa-square').addClass('fa-refresh fa-spin');
|
||||
$.post('/plugins/dynamix.vm.manager/include/VMManager.php',{action:'start'}, function(){loadlist();});
|
||||
}
|
||||
function stopAll() {
|
||||
$('input[type=button]').prop('disabled',true);
|
||||
for (var i=0,vm; vm=kvm[i]; i++) if (vm.state=='running') $('#vm-'+vm.id).find('i').removeClass('fa-play').addClass('fa-refresh fa-spin');
|
||||
for (var i=0,vm; vm=kvm[i]; i++) if (vm.state=='running') $('#vm-'+vm.id).parent().find('i').removeClass('fa-play').addClass('fa-refresh fa-spin');
|
||||
$.post('/plugins/dynamix.vm.manager/include/VMManager.php',{action:'stop'}, function(){loadlist();});
|
||||
}
|
||||
function vncOpen() {
|
||||
|
||||
@@ -33,9 +33,10 @@ $casemodel = $exist ? file_get_contents("$boot/$file") : '';
|
||||
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/default-popup.css")?>">
|
||||
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/default-cases.css")?>">
|
||||
<style>
|
||||
div.case-list{float:left;padding:10px;margin-right:10px;margin-bottom:30px;height:88px;width:88px;text-align:center}
|
||||
div.case-list i{width:auto;max-width:88px;height:88px;font-size:88px;}
|
||||
div.case-list:hover{color:#f0000c}
|
||||
div.case-list{float:left;padding:10px;margin-right:10px;margin-bottom:44px;height:72px;width:72px;text-align:center}
|
||||
div.case-list i{width:auto;max-width:72px;height:72px;font-size:72px;}
|
||||
div.case-list:hover{color:#f0000c;transform:scale(1.4,1.4);-webkit-transform:scale(1.4,1.4)}
|
||||
div.case-list:hover .case-name{margin-top:-5px;font-size:1rem}
|
||||
div.case-name{margin-top:8px;font-family:clear-sans}
|
||||
</style>
|
||||
<script src="<?autov('/webGui/javascript/dynamix.js')?>"></script>
|
||||
|
||||
@@ -84,11 +84,11 @@ echo $cpumodel.(strpos($cpumodel,'@')!==false ? "" : " @ {$cpu['Current Speed']}
|
||||
</div>
|
||||
<div><span class="key">HVM:</span>
|
||||
<?
|
||||
// Check for Intel VT-x (vmx) or AMD-V (svm) cpu virtualzation support
|
||||
// If either kvm_intel or kvm_amd are loaded then Intel VT-x (vmx) or AMD-V (svm) cpu virtualzation support was found
|
||||
// Check for Intel VT-x (vmx) or AMD-V (svm) cpu virtualization support
|
||||
// If either kvm_intel or kvm_amd are loaded then Intel VT-x (vmx) or AMD-V (svm) cpu virtualization support was found
|
||||
$strLoadedModules = shell_exec("/etc/rc.d/rc.libvirt test");
|
||||
|
||||
// Check for Intel VT-x (vmx) or AMD-V (svm) cpu virtualzation support
|
||||
// Check for Intel VT-x (vmx) or AMD-V (svm) cpu virtualization support
|
||||
$strCPUInfo = file_get_contents('/proc/cpuinfo');
|
||||
|
||||
if (!empty($strLoadedModules)) {
|
||||
@@ -97,10 +97,10 @@ if (!empty($strLoadedModules)) {
|
||||
} else {
|
||||
echo '<a href="http://lime-technology.com/wiki/index.php/UnRAID_Manual_6#Determining_HVM.2FIOMMU_Hardware_Support" target="_blank">';
|
||||
if (strpos($strCPUInfo,'vmx')===false && strpos($strCPUInfo, 'svm')===false) {
|
||||
// CPU doesn't support virtualzation
|
||||
// CPU doesn't support virtualization
|
||||
echo "Not Available";
|
||||
} else {
|
||||
// Motherboard either doesn't support virtualzation or BIOS has it disabled
|
||||
// Motherboard either doesn't support virtualization or BIOS has it disabled
|
||||
echo "Disabled";
|
||||
}
|
||||
echo '</a>';
|
||||
@@ -118,7 +118,7 @@ if (!empty($iommu_groups)) {
|
||||
} else {
|
||||
echo '<a href="http://lime-technology.com/wiki/index.php/UnRAID_Manual_6#Determining_HVM.2FIOMMU_Hardware_Support" target="_blank">';
|
||||
if (strpos($strCPUInfo,'vmx')===false && strpos($strCPUInfo, 'svm')===false) {
|
||||
// CPU doesn't support virtualzation so iommu would be impossible
|
||||
// CPU doesn't support virtualization so iommu would be impossible
|
||||
echo "Not Available";
|
||||
} else {
|
||||
// Motherboard either doesn't support iommu or BIOS has it disabled
|
||||
|
||||
@@ -22,9 +22,8 @@ function check {
|
||||
total=$(($total + $size))
|
||||
fi
|
||||
}
|
||||
shares=$(ls -vd /mnt/user/*)
|
||||
for share in $shares; do
|
||||
while IFS=$'\n' read -r share; do
|
||||
[[ -d $share ]] && check "$(basename "$share")" "$disk"
|
||||
done
|
||||
done <<< $(ls -vd /mnt/user/*)
|
||||
echo "share.total=$total" >>"$output"
|
||||
echo "total disk usage: $total"
|
||||
|
||||
@@ -23,9 +23,8 @@ function check {
|
||||
}
|
||||
|
||||
check "/mnt/cache" "$share"
|
||||
disks=$(ls -vd /mnt/disk*)
|
||||
for disk in $disks ; do
|
||||
while IFS=$'\n' read -r disk; do
|
||||
check "$disk" "$share"
|
||||
done
|
||||
done <<< $(ls -vd /mnt/disk[0-9]*)
|
||||
echo "disk.total=$total" >>"$output"
|
||||
echo "total disk usage: $total"
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
@font-face{font-family:cases;font-weight:normal;font-style:normal;
|
||||
src:url('font-cases.eot?20190111');src:url('font-cases.eot?20190111#iefix') format('embedded-opentype'),url('font-cases.ttf?20190111') format('truetype'),url('font-cases.woff?20190111') format('woff'),url('font-cases.svg?20190111#cases') format('svg')}
|
||||
src:url('font-cases.eot?20190115');src:url('font-cases.eot?20190115#iefix') format('embedded-opentype'),url('font-cases.ttf?20190115') format('truetype'),url('font-cases.woff?20190115') format('woff'),url('font-cases.svg?20190115#cases') format('svg')}
|
||||
[class^='case-'],[class*=' case-']{font-family:cases!important;speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none}
|
||||
.case-3u-md1510:before{content:'\e91a'}
|
||||
.case-4u-storinator:before{content:'\e91b'}
|
||||
.case-storinator-ws:before{content:'\e91c'}
|
||||
.case-full-tower:before{content:'\e914'}
|
||||
.case-htpc:before{content:'\e915'}
|
||||
.case-mid-tower:before{content:'\e916'}
|
||||
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 54 KiB |
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user