mirror of
https://github.com/caprover/caprover
synced 2026-09-23 07:05:35 +00:00
Starting to save settings
This commit is contained in:
@@ -249,7 +249,10 @@ class DataStore {
|
||||
const goAccessInfo = (self.data.get(GOACCESS_INFO) ||
|
||||
{}) as GoAccessInfo
|
||||
goAccessInfo.isEnabled = goAccessInfo.isEnabled || false
|
||||
goAccessInfo.data = goAccessInfo.data || {}
|
||||
goAccessInfo.data.rotationFrequencyCron =
|
||||
goAccessInfo.data.rotationFrequencyCron ?? '0 0 1 * *' // monthly
|
||||
goAccessInfo.data.catchupFrequencyCron =
|
||||
goAccessInfo.data.catchupFrequencyCron ?? '*/10 * * * *' // every 10 minutes
|
||||
return goAccessInfo
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
export class GoAccessInfo {
|
||||
public isEnabled: boolean
|
||||
public data: {
|
||||
temp: boolean
|
||||
rotationFrequencyCron: string
|
||||
catchupFrequencyCron: string
|
||||
logRetentionDays?: number
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,8 +681,16 @@ class CaptainManager {
|
||||
.then(function () {
|
||||
return self.dataStore.setGoAccessInfo(goAccessInfo)
|
||||
})
|
||||
.then(function () {
|
||||
return dockerApi.ensureContainerStoppedAndRemoved(
|
||||
CaptainConstants.goAccessContainerName,
|
||||
CaptainConstants.captainNetworkName
|
||||
)
|
||||
})
|
||||
.then(function () {
|
||||
if (enabled) {
|
||||
// const crontab = self.generateGoAccessCrontab(goAccessInfo);
|
||||
|
||||
return dockerApi.createStickyContainer(
|
||||
CaptainConstants.goAccessContainerName,
|
||||
CaptainConstants.configs.goAccessImageName,
|
||||
@@ -702,11 +710,6 @@ class CaptainManager {
|
||||
['apparmor:unconfined'],
|
||||
undefined
|
||||
)
|
||||
} else {
|
||||
return dockerApi.ensureContainerStoppedAndRemoved(
|
||||
CaptainConstants.goAccessContainerName,
|
||||
CaptainConstants.captainNetworkName
|
||||
)
|
||||
}
|
||||
})
|
||||
.then(function () {
|
||||
@@ -717,6 +720,13 @@ class CaptainManager {
|
||||
})
|
||||
}
|
||||
|
||||
generateGoAccessCrontab(goAccessInfo: GoAccessInfo): string {
|
||||
return [
|
||||
'* * * * * /realtimeLog.sh',
|
||||
'*/5 * * * * /processLogs.sh',
|
||||
].join('\n')
|
||||
}
|
||||
|
||||
getNodesInfo() {
|
||||
const dockerApi = this.dockerApi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user