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:
pwsh/tutorial/examples/BikeRentalShop/Synchronized/Service.psd1pwsh/tutorial/examples/BikeRentalShop/Concurrent/Service.psd1pwsh/tutorial/examples/BikeRentalShop/Web/Service.psd1
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
- Package creation: Use
New-KrServicePackagedirectly against one of the real BikeRentalShop service folders. - Service naming: Read the service name from each folder’s checked-in
Service.psd1soservice update --name ...targets the installed service correctly. - Install command: Use
dotnet kestrun service install --package ...for the first deployment of that.krpack. - Update command: Use
dotnet kestrun service update --name ... --package ...when you roll a new package revision forward. - Tool surface: Use
dotnet kestrun service helpto inspect the supported install, update, runtime, and deployment options. - Data retention: Because the BikeRentalShop descriptors declare
ApplicationDataFolders = 'data/', 'logs/', those folders stay designated for preservation during package-based updates. - Runtime choice: You can add runtime options from the tooling guides when you need offline installation, a private feed, or a specific deployment root.
- 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
- Build the
.krpackfor the backend or web target you want to deploy. - Run
service install --packagefor the first deployment of that service. - Keep the generated service name and package path for later upgrades.
- When you have a new package, run
service update --name <service-name> --package <new-package>. - Preserve each service’s
data/andlogs/folders so rentals, certificates, and logs survive package replacement.
Adapting the commands
- Add
--runtime-package,--runtime-source, or--runtime-versionwhen you need an explicit runtime acquisition strategy. - Add
--deployment-rootwhen 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