mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-03-28 03:29:25 +01:00
fix(admin): disk info mount and stability
This commit is contained in:
parent
752b023798
commit
6a9ede1776
|
|
@ -129,18 +129,25 @@ export class SystemService {
|
|||
si.time(),
|
||||
])
|
||||
|
||||
let diskInfo: NomadDiskInfoRaw | undefined
|
||||
let disk: NomadDiskInfo[] = []
|
||||
|
||||
try {
|
||||
const diskInfoRawString = await getFile(
|
||||
path.join(process.cwd(), SystemService.diskInfoFile),
|
||||
'string'
|
||||
)
|
||||
|
||||
const diskInfo = (
|
||||
diskInfo = (
|
||||
diskInfoRawString
|
||||
? JSON.parse(diskInfoRawString.toString())
|
||||
: { diskLayout: { blockdevices: [] }, fsSize: [] }
|
||||
) as NomadDiskInfoRaw
|
||||
|
||||
const disk = this.calculateDiskUsage(diskInfo)
|
||||
disk = this.calculateDiskUsage(diskInfo)
|
||||
} catch (error) {
|
||||
logger.error('Error reading disk info file:', error)
|
||||
}
|
||||
|
||||
return {
|
||||
cpu,
|
||||
|
|
@ -164,7 +171,7 @@ export class SystemService {
|
|||
*/
|
||||
private async _syncContainersWithDatabase() {
|
||||
try {
|
||||
const allServices = await Service.all();
|
||||
const allServices = await Service.all()
|
||||
const serviceStatusList = await this.dockerService.getServicesStatus()
|
||||
|
||||
for (const service of allServices) {
|
||||
|
|
@ -189,7 +196,6 @@ export class SystemService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
logger.error('Error syncing containers with database:', error)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,6 +237,12 @@ create_nomad_directory(){
|
|||
sudo touch "${NOMAD_DIR}/storage/logs/admin.log"
|
||||
}
|
||||
|
||||
create_disk_info_file() {
|
||||
# Disk info file MUST be created before the admin container starts.
|
||||
# Otherwise, Docker will assume we meant to mount a directory and will create an empty directory at the mount point
|
||||
echo '{}' > /tmp/nomad-disk-info.json
|
||||
}
|
||||
|
||||
download_management_compose_file() {
|
||||
local compose_file_path="${NOMAD_DIR}/compose.yml"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user