diff --git a/client/src/pages/home/index.jsx b/client/src/pages/home/index.jsx index 5905e7f6..d6e06b25 100644 --- a/client/src/pages/home/index.jsx +++ b/client/src/pages/home/index.jsx @@ -233,6 +233,12 @@ const HomePage = () => { )} + {isAdmin && coStatus && (coStatus.backup_status != "") && ( + + {coStatus.backup_status} + + )} + {isAdmin && coStatus && coStatus.LetsEncryptErrors && coStatus.LetsEncryptErrors.length > 0 && ( There are errors with your Let's Encrypt configuration or one of your routes, please fix them as soon as possible: diff --git a/package.json b/package.json index 7f957bb5..24cbb21b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cosmos-server", - "version": "0.11.1", + "version": "0.11.2", "description": "", "main": "test-server.js", "bugs": { diff --git a/src/docker/export.go b/src/docker/export.go index 37eb6622..8c171a2e 100644 --- a/src/docker/export.go +++ b/src/docker/export.go @@ -15,9 +15,12 @@ import ( ) +var ExportError = "" + func ExportDocker() { errD := Connect() if errD != nil { + ExportError = "Export Docker - cannot connect - " + errD.Error() utils.Error("ExportDocker - connect - ", errD) return } @@ -28,6 +31,7 @@ func ExportDocker() { containers, err := DockerClient.ContainerList(DockerContext, types.ContainerListOptions{}) if err != nil { utils.Error("ExportDocker - Cannot list containers", err) + ExportError = "Export Docker - Cannot list containers - " + err.Error() return } @@ -38,7 +42,8 @@ func ExportDocker() { // Fetch detailed info of each container detailedInfo, err := DockerClient.ContainerInspect(DockerContext, container.ID) if err != nil { - utils.Error("Cannot inspect container", err) + utils.Error("Export Docker - Cannot inspect container" + container.Names[0], err) + ExportError = "Export Docker - Cannot inspect container" + container.Names[0] + " - " + err.Error() return } @@ -168,7 +173,8 @@ func ExportDocker() { // List networks networks, err := DockerClient.NetworkList(DockerContext, types.NetworkListOptions{}) if err != nil { - utils.Error("Cannot list networks", err) + utils.Error("Export Docker - Cannot list networks", err) + ExportError = "Export Docker - Cannot list networks - " + err.Error() return } @@ -183,7 +189,8 @@ func ExportDocker() { // Fetch detailed info of each network detailedInfo, err := DockerClient.NetworkInspect(DockerContext, network.ID, types.NetworkInspectOptions{}) if err != nil { - utils.Error("Cannot inspect network", err) + utils.Error("Export Docker - Cannot inspect network", err) + ExportError = "Export Docker - Cannot inspect network - " + err.Error() return } @@ -225,7 +232,8 @@ func ExportDocker() { // Use the encoder to write the structured data to the buffer err = encoder.Encode(finalBackup) if err != nil { - utils.Error("Cannot marshal docker backup", err) + utils.Error("Export Docker - Cannot marshal docker backup", err) + ExportError = "Export Docker - Cannot marshal docker backup - " + err.Error() } // The JSON data is now in buf.Bytes() @@ -234,6 +242,7 @@ func ExportDocker() { // Write the JSON data to a file err = ioutil.WriteFile(utils.CONFIGFOLDER + "backup.cosmos-compose.json", jsonData, 0644) if err != nil { - utils.Error("Cannot save docker backup", err) + utils.Error("Export Docker - Cannot save docker backup", err) + ExportError = "Export Docker - Cannot save docker backup - " + err.Error() } } \ No newline at end of file diff --git a/src/status.go b/src/status.go index f819b0ec..ca7a3ec1 100644 --- a/src/status.go +++ b/src/status.go @@ -53,6 +53,7 @@ func StatusRoute(w http.ResponseWriter, req *http.Request) { }, "database": databaseStatus, "docker": docker.DockerIsConnected, + "backup_status": docker.ExportError, "letsencrypt": utils.GetMainConfig().HTTPConfig.HTTPSCertificateMode == "LETSENCRYPT" && utils.GetMainConfig().HTTPConfig.SSLEmail == "", "domain": utils.GetMainConfig().HTTPConfig.Hostname == "localhost" || utils.GetMainConfig().HTTPConfig.Hostname == "0.0.0.0", "HTTPSCertificateMode": utils.GetMainConfig().HTTPConfig.HTTPSCertificateMode,