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(),
|
si.time(),
|
||||||
])
|
])
|
||||||
|
|
||||||
const diskInfoRawString = await getFile(
|
let diskInfo: NomadDiskInfoRaw | undefined
|
||||||
path.join(process.cwd(), SystemService.diskInfoFile),
|
let disk: NomadDiskInfo[] = []
|
||||||
'string'
|
|
||||||
)
|
|
||||||
|
|
||||||
const diskInfo = (
|
try {
|
||||||
diskInfoRawString
|
const diskInfoRawString = await getFile(
|
||||||
? JSON.parse(diskInfoRawString.toString())
|
path.join(process.cwd(), SystemService.diskInfoFile),
|
||||||
: { diskLayout: { blockdevices: [] }, fsSize: [] }
|
'string'
|
||||||
) as NomadDiskInfoRaw
|
)
|
||||||
|
|
||||||
const disk = this.calculateDiskUsage(diskInfo)
|
diskInfo = (
|
||||||
|
diskInfoRawString
|
||||||
|
? JSON.parse(diskInfoRawString.toString())
|
||||||
|
: { diskLayout: { blockdevices: [] }, fsSize: [] }
|
||||||
|
) as NomadDiskInfoRaw
|
||||||
|
|
||||||
|
disk = this.calculateDiskUsage(diskInfo)
|
||||||
|
} catch (error) {
|
||||||
|
logger.error('Error reading disk info file:', error)
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
cpu,
|
cpu,
|
||||||
|
|
@ -164,7 +171,7 @@ export class SystemService {
|
||||||
*/
|
*/
|
||||||
private async _syncContainersWithDatabase() {
|
private async _syncContainersWithDatabase() {
|
||||||
try {
|
try {
|
||||||
const allServices = await Service.all();
|
const allServices = await Service.all()
|
||||||
const serviceStatusList = await this.dockerService.getServicesStatus()
|
const serviceStatusList = await this.dockerService.getServicesStatus()
|
||||||
|
|
||||||
for (const service of allServices) {
|
for (const service of allServices) {
|
||||||
|
|
@ -189,7 +196,6 @@ export class SystemService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('Error syncing containers with database:', error)
|
logger.error('Error syncing containers with database:', error)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,12 @@ create_nomad_directory(){
|
||||||
sudo touch "${NOMAD_DIR}/storage/logs/admin.log"
|
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() {
|
download_management_compose_file() {
|
||||||
local compose_file_path="${NOMAD_DIR}/compose.yml"
|
local compose_file_path="${NOMAD_DIR}/compose.yml"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user