Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review from TerminatedProcess #2

Open
Surgeapp35 opened this issue Jan 25, 2023 · 1 comment
Open

Review from TerminatedProcess #2

Surgeapp35 opened this issue Jan 25, 2023 · 1 comment

Comments

@Surgeapp35
Copy link

Surgeapp35 commented Jan 25, 2023

https://www.reddit.com/r/wsl2/comments/10irl6a/comment/j5r934i/?utm_source=share&utm_medium=web2x&context=3
<< cool project and I look forward to future updates!>>

I gave it a shot.. The first time it didn't appear to backup anything. I manually pasted the backup folder into the settings. But maybe there was a / or something. So I used the built-in directory selector to select the backup folder and the 2nd time it worked.

Some ideas for your app. I'm just throwing these out there in case it helps. I get this is new and you guys have probably already thought of these. But just in case :)

Do a periodic refresh. Either have something checking frequently in the background, or have a settings so you can set a refresh interval. This is not a priority thing though. Just a nice to have.

When backing up, have a way to specify if you should create a .vhdx or a .tar. The default should be based on whether you are in windows 10 or 11, but maybe a checkbox in the filename dialog to select the alternative would be a good idea? Additionally, maybe a settings for opening the backup directory in explorer on completion (success, fail) so that the user can verify that the backup worked. Not everyone would want that, but I've lost work because I didn't pay attention and replaced my ubuntu with another backup, meaning to come back to the latest.

If the export process fails, there's no notification. The status should say failed and there should be an icon to view the reason why?

How are you handling Docker for Windows? I think you are attempting to shut it down first. But there's no notification you are doing so. What happens if I have running containers is that docker-desktop-data is shutdown, but docker-desktop is not. The export file is not generated. If I click on export again, it then generates the vdhx file. So there's some issues with busy resources there. I'm sure there are other scenarios such as vscode being left open or notepad++ etc.. You can't handle them all but you can inform the user it failed.

With Docker for Desktop running, I tried to backup in step 4 above and it gave me a file. When I tried to restore that file, it just sits with status STOPPED. It doesn't do any further notifications. Eventually I tried running the distro and it started up, however, it had corrupted files in it. These files all started with WSL$ and a bunch of symbols.

Just in case it helps.. this is my script for shutting down Docker for Windows. I use it every day (with a hotkey) prior to backing up my wsl Ubuntu. I got most of it off a stackoverflow and made further modifications. I don't know the original author so kudos to him! This script stops and restarts Docker for Windows. I have one that also just stops it, but that's the same as half of this one.

Write-Output "$((Get-Date).ToString("HH:mm:ss")) - Restarting docker"

foreach($svc in (Get-Service | Where-Object {$_.name -ilike "*docker*" -and $_.Status -ieq "Running"}))
{
    $svc | Stop-Service -ErrorAction Continue -Confirm:$false -Force
    $svc.WaitForStatus('Stopped','00:00:20')
}

Get-Process | Where-Object {$_.Name -ilike "*docker*"} | Stop-Process -ErrorAction Continue -Confirm:$false -Force

foreach($svc in (Get-Service | Where-Object {$_.name -ilike "*docker*" -and $_.Status -ieq "Stopped"} ))
{
    $svc | Start-Service 
    $svc.WaitForStatus('Running','00:00:20')
}

Write-Output "$((Get-Date).ToString("HH:mm:ss")) - Starting Docker Desktop"
& "C:\Program Files\Docker\Docker\Docker Desktop.exe"
$startTimeout = [DateTime]::Now.AddSeconds(90)
$timeoutHit = $true
while ((Get-Date) -le $startTimeout)
{

    Start-Sleep -Seconds 10
    $ErrorActionPreference = 'Continue'
    try
    {
        $info = (docker info)
        Write-Verbose "$((Get-Date).ToString("HH:mm:ss")) - `tDocker info executed. Is Error?: $($info -ilike "*error*"). Result was: $info"

        if ($info -ilike "*error*")
        {
            Write-Verbose "$((Get-Date).ToString("HH:mm:ss")) - `tDocker info had an error. throwing..."
            throw "Error running info command $info"
        }
        $timeoutHit = $false
        break
    }
    catch 
    {

        if (($_ -ilike "*error during connect*") -or ($_ -ilike "*errors pretty printing info*")  -or ($_ -ilike "*Error running info command*"))
        {
            Write-Output "$((Get-Date).ToString("HH:mm:ss")) -`t Docker Desktop startup not yet completed, waiting and checking again"
        }
        else
        {
            Write-Output "Unexpected Error: `n $_"
            return
        }
    }
    $ErrorActionPreference = 'Stop'
}
if ($timeoutHit -eq $true)
{
    throw "Timeout hit waiting for docker to startup"
}

Write-Output "$((Get-Date).ToString("HH:mm:ss")) - Docker restarted"
@marvint24
Copy link
Owner

I will split your points into different issues to better keep track of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants