BaGet icon indicating copy to clipboard operation
BaGet copied to clipboard

How do do an upgrade from previous version?

Open jcoburn opened this issue 4 years ago • 3 comments

Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is. Example. I'm am trying to do [...] but [...]

Describe the solution you'd like

A clear and concise description of what you want to happen.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

jcoburn avatar Jul 23 '20 19:07 jcoburn

I'm also unclear on this. I have an "on your computer" installation (namely, on a Windows Server 2019 with IIS).

I tried simply replacing everything except for packages with the newest binary; however, BaGet would no longer find anything. Presumably, I need to run a re-index somehow?

I then replaced the baget.db with my backup, but that file was outdated by several months, which didn't seem right. Packages did show up, but I'm not sure if all. And, after a reboot, BaGet failed to launch, with:

Unhandled exception. Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 8: 'attempt to write a readonly database'.

So I'm probably not supposed to manually replace that database.

(I've downgraded again, for now.)

What's the recommended procedure?

chucker avatar Mar 04 '22 15:03 chucker

You should be able to update by replacing BaGet's code while keeping your storage and database:

  • The packages folder, if any
  • The symbols folder, if any
  • The baget.db file, plus any baget.db.* files SQLite may have generated

BaGet has not had any intentional breaking changes for quite some time now. However, it's possible the update logic has bugs as it isn't all that well tested. In case the update breaks, here's a PowerShell script to re-import packages to a new BaGet installation:

$source = "C:\path\to\previous\baget\packages"
$destination = "http://localhost:5000/v3/index.json"

# Uncomment this if your new BaGet instance requires an API key.
# & nuget.exe setapikey "MY-API-KEY" -Source $destination

$packages = Get-ChildItem -Path $source -Filter *.nupkg -Recurse -File

$packages | % {
  Write-Host "nuget.exe push -Source $destination ""$($_.FullName)"""
  # & nuget.exe push -Source $destination $_.FullName
}

Let me know if you run into any problems!

loic-sharma avatar Mar 05 '22 19:03 loic-sharma

For future reference: I thought the error pointed to a locking problem, but it was simply a matter of file system permissions — baget.db* weren't writable by the IIS application pool.

chucker avatar Mar 09 '22 11:03 chucker