Bike Rental Shop Install and Update

Turn a packaged BikeRentalShop target into concrete dotnet kestrun service install and service update commands for a deployment workflow.

Full source

Files:

Import-Module .\src\PowerShell\Kestrun\Kestrun.psm1 -Force

New-KrServicePackage -SourceFolder .\docs\_includes\examples\pwsh\BikeRentalShop\Synchronized `
    -OutputPath .\artifacts\tutorial\bike-rental-shop.krpack `
    -Force

dotnet kestrun service help
dotnet kestrun service install --package .\artifacts\tutorial\bike-rental-shop.krpack
dotnet kestrun service update --name bike-rental-shop --package .\artifacts\tutorial\bike-rental-shop-v2.krpack

Step-by-step

  1. Package creation: Use New-KrServicePackage directly against one of the real BikeRentalShop service folders.
  2. Service naming: Read the service name from each folder’s checked-in Service.psd1 so service update --name ... targets the installed service correctly.
  3. Install command: Use dotnet kestrun service install --package ... for the first deployment of that .krpack.
  4. Update command: Use dotnet kestrun service update --name ... --package ... when you roll a new package revision forward.
  5. Tool surface: Use dotnet kestrun service help to inspect the supported install, update, runtime, and deployment options.
  6. Data retention: Because the BikeRentalShop descriptors declare ApplicationDataFolders = 'data/', 'logs/', those folders stay designated for preservation during package-based updates.
  7. Runtime choice: You can add runtime options from the tooling guides when you need offline installation, a private feed, or a specific deployment root.
  8. Deployment split: Backend and web packages are still installed separately, so browser assets and API state keep their own service lifecycle.

Try it

Build the synchronized backend package and inspect the tool surface:

Import-Module .\src\PowerShell\Kestrun\Kestrun.psm1 -Force

New-KrServicePackage -SourceFolder .\docs\_includes\examples\pwsh\BikeRentalShop\Synchronized `
    -OutputPath .\artifacts\tutorial\bike-rental-shop.krpack `
    -Force

dotnet kestrun service help

Install the synchronized backend package:

dotnet kestrun service install --package .\artifacts\tutorial\bike-rental-shop.krpack

Update an installed BikeRentalShop service with a newer package revision:

dotnet kestrun service update --name bike-rental-shop --package .\artifacts\tutorial\bike-rental-shop-v2.krpack

The same pattern applies to the other two example folders:

dotnet kestrun service install --package .\artifacts\tutorial\bike-rental-shop-concurrent.krpack
dotnet kestrun service update --name bike-rental-shop-concurrent --package .\artifacts\tutorial\bike-rental-shop-concurrent-v2.krpack

dotnet kestrun service install --package .\artifacts\tutorial\bike-rental-shop-web.krpack
dotnet kestrun service update --name bike-rental-shop-web --package .\artifacts\tutorial\bike-rental-shop-web-v2.krpack

Install and update flow

  1. Build the .krpack for the backend or web target you want to deploy.
  2. Run service install --package for the first deployment of that service.
  3. Keep the generated service name and package path for later upgrades.
  4. When you have a new package, run service update --name <service-name> --package <new-package>.
  5. Preserve each service’s data/ and logs/ folders so rentals, certificates, and logs survive package replacement.

Adapting the commands

  • Add --runtime-package, --runtime-source, or --runtime-version when you need an explicit runtime acquisition strategy.
  • Add --deployment-root when the default service bundle location is not where you want the service installed.
  • Keep backend and web services on separate names so the update commands stay unambiguous.
  • Use the synchronized or concurrent backend package interchangeably when the caller-facing API contract must stay the same.

Troubleshooting

Symptom Cause Fix
The install or update command uses the wrong service name The package was built from a different example folder than expected Read the Name field from that folder’s Service.psd1 and use it with service update --name ...
The package path is not where you want it New-KrServicePackage was run with a different -OutputPath Build the package again with the exact path you plan to pass to dotnet kestrun
Update replaces the app but not its data folders The deployment flow is not preserving application data between package revisions Keep the installed service’s data/ and logs/ directories in place during updates
Service installation needs more runtime options Your environment cannot resolve the default runtime package path Add runtime arguments from the Tooling or Production Service guides

References


Previous / Next

Previous: Bike Rental Shop Packaging Next: None