mirror of
https://github.com/caprover/caprover
synced 2025-11-02 11:27:04 +00:00
Progress exposing reports
This commit is contained in:
@@ -1,31 +1,28 @@
|
|||||||
currentDateTime=$(date +"%Y-%m-%dT%H:%M")
|
currentDateTime=$(date +"%Y-%m-%dT%H:%M")
|
||||||
|
|
||||||
for folder in /var/www/logs/*; do
|
for logFile in /var/log/nginx-shared/*.log; do
|
||||||
if [ -d "$folder" ]; then
|
|
||||||
logFile="access.log"
|
|
||||||
|
|
||||||
if [ -s "$folder/$logFile" ]; then
|
if [ -s $logFile ]; then
|
||||||
rotatedLog="$folder/$currentDateTime.log"
|
|
||||||
report="$folder/$currentDateTime.html"
|
|
||||||
|
|
||||||
if [ -f "$report" ]; then
|
rotatedLog="$logFile-$currentDateTime.log"
|
||||||
echo "$report already exists, skipping"
|
report="$logFile-$currentDateTime.html"
|
||||||
else
|
|
||||||
echo "Processing $report"
|
|
||||||
|
|
||||||
# Manually rotate the log files
|
|
||||||
cp "$folder/$logFile" $rotatedLog
|
|
||||||
truncate -s 0 "$folder/$logFile"
|
|
||||||
|
|
||||||
goaccess $rotatedLog -a -o "$report" --log-format=COMBINED
|
|
||||||
|
|
||||||
gzip $rotatedLog
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
if [ -f "$report" ]; then
|
||||||
|
echo "$report already exists, skipping"
|
||||||
else
|
else
|
||||||
echo "File $folder/$logFile does not exist or is empty"
|
echo "Processing $report"
|
||||||
|
|
||||||
|
# Manually rotate the log files
|
||||||
|
cp $logFile $rotatedLog
|
||||||
|
truncate -s 0 $logFile
|
||||||
|
|
||||||
|
goaccess $rotatedLog -a -o "$report" --log-format=COMBINED
|
||||||
|
|
||||||
|
gzip $rotatedLog
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "File $logFile does not exist or is empty"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -702,7 +702,8 @@ class CaptainManager {
|
|||||||
hostPath: CaptainConstants.nginxLogsVolumeName,
|
hostPath: CaptainConstants.nginxLogsVolumeName,
|
||||||
volumeName:
|
volumeName:
|
||||||
CaptainConstants.nginxLogsVolumeName,
|
CaptainConstants.nginxLogsVolumeName,
|
||||||
containerPath: '/var/www/logs',
|
containerPath:
|
||||||
|
CaptainConstants.nginxSharedLogsPath,
|
||||||
mode: 'rw',
|
mode: 'rw',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ class LoadBalancerManager {
|
|||||||
|
|
||||||
getLogPath(domainName: string) {
|
getLogPath(domainName: string) {
|
||||||
// The shared volume path plus a filesafe name
|
// The shared volume path plus a filesafe name
|
||||||
return `/var/log/nginx-shared/${domainName}/access.log`
|
return `${CaptainConstants.nginxSharedLogsPath}/${domainName}-access.log`
|
||||||
}
|
}
|
||||||
|
|
||||||
getInfo() {
|
getInfo() {
|
||||||
@@ -452,6 +452,7 @@ class LoadBalancerManager {
|
|||||||
const registryDomain = `${
|
const registryDomain = `${
|
||||||
CaptainConstants.registrySubDomain
|
CaptainConstants.registrySubDomain
|
||||||
}.${dataStore.getRootDomain()}`
|
}.${dataStore.getRootDomain()}`
|
||||||
|
const logAccess = dataStore.getGoAccessInfo().isEnabled
|
||||||
|
|
||||||
let hasRootSsl = false
|
let hasRootSsl = false
|
||||||
|
|
||||||
@@ -503,6 +504,9 @@ class LoadBalancerManager {
|
|||||||
CaptainConstants.nginxStaticRootDir +
|
CaptainConstants.nginxStaticRootDir +
|
||||||
CaptainConstants.nginxDomainSpecificHtmlDir
|
CaptainConstants.nginxDomainSpecificHtmlDir
|
||||||
}/${captainDomain}`,
|
}/${captainDomain}`,
|
||||||
|
logAccessPath: logAccess
|
||||||
|
? CaptainConstants.nginxSharedLogsPath
|
||||||
|
: undefined,
|
||||||
},
|
},
|
||||||
registry: {
|
registry: {
|
||||||
crtPath: self.getSslCertPath(registryDomain),
|
crtPath: self.getSslCertPath(registryDomain),
|
||||||
@@ -811,7 +815,7 @@ class LoadBalancerManager {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
volumeName: CaptainConstants.nginxLogsVolumeName,
|
volumeName: CaptainConstants.nginxLogsVolumeName,
|
||||||
containerPath: '/var/log/nginx-shared',
|
containerPath: CaptainConstants.nginxSharedLogsPath,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[CaptainConstants.captainNetworkName],
|
[CaptainConstants.captainNetworkName],
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ const data = {
|
|||||||
|
|
||||||
nginxDefaultHtmlDir: '/default',
|
nginxDefaultHtmlDir: '/default',
|
||||||
|
|
||||||
|
nginxSharedLogsPath: '/var/log/nginx-shared',
|
||||||
|
|
||||||
letsEncryptEtcPathOnNginx: '/letencrypt/etc',
|
letsEncryptEtcPathOnNginx: '/letencrypt/etc',
|
||||||
|
|
||||||
nginxDomainSpecificHtmlDir: '/domains',
|
nginxDomainSpecificHtmlDir: '/domains',
|
||||||
|
|||||||
@@ -108,6 +108,18 @@
|
|||||||
proxy_read_timeout 120s;
|
proxy_read_timeout 120s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
<%
|
||||||
|
if (captain.logAccessPath) {
|
||||||
|
%>
|
||||||
|
location /goaccess {
|
||||||
|
alias <%-captain.logAccessPath%>;
|
||||||
|
autoindex on;
|
||||||
|
}
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
|
||||||
# Used by Lets Encrypt
|
# Used by Lets Encrypt
|
||||||
location /.well-known/acme-challenge/ {
|
location /.well-known/acme-challenge/ {
|
||||||
root <%-captain.staticWebRoot%>;
|
root <%-captain.staticWebRoot%>;
|
||||||
|
|||||||
Reference in New Issue
Block a user