dotnet /app/Storefront.dll on Microsoft’s ASP.NET Core runtime image, listening on the port that Sevalla sets in the PORT environment variable. With interactive server rendering, each browser tab keeps a SignalR connection over a WebSocket, called a circuit, to the instance that runs its components. This guide deploys the .NET 10 Blazor template with a form, keeps the application’s Data Protection keys in a Sevalla PostgreSQL database so forms and cookies survive deployments, and explains why the web process runs one instance.
At a glance
Environment variables
Before you begin
- A Sevalla company with a payment method, and a GitHub, GitLab or Bitbucket account for the repository. See Git providers.
- The .NET 10 SDK on your computer:
dotnet --versionprints10.0.100or later. .NET 10 is the current long-term support release; see Deploy an ASP.NET Core application for why this guide uses it.
Create the project
Create a Blazor Web App namedStorefront whose interactive components run on the server:
Keep the Data Protection keys in PostgreSQL
ASP.NET Core encrypts antiforgery tokens, authentication cookies and the state of prerendered interactive components with its Data Protection keys. By default, each instance creates its own keys in its home folder, which every deployment and restart discards. A form that a visitor loaded before a deployment then fails after it: the post returns400 with an empty page, because the new instance can’t read the token. At start, the runtime logs warn about it:
Program.cs, add the using lines at the top and the connection, the context and the key storage before AddRazorComponents. The rest is the template’s:
config["DB_HOST"] is the DB_HOST variable. Npgsql takes a connection string of keys and values rather than the postgres:// URL in DB_URL, so the code builds one from the separate variables.
Create the migration that adds the DataProtectionKeys table, then write the lock file of the exact package versions:
No XML encryptor configured when it creates a key: it stores the keys unencrypted, so anyone who can read the database can read them. Keep the database’s credentials as private as the keys themselves.
Prepare the project for Sevalla
The migrations run from a migrations bundle: a single executable thatdotnet ef builds next to the application, which applies the pending migrations and needs neither the SDK nor the source. Ingot’s own build step publishes the application only, so tell it to build the bundle too, in an ingot.json file at the root of the repository:
/app/publish: Ingot copies that folder to /app in the image, so the bundle runs as /app/efbundle. See Configure the build.
ASPNETCORE_HTTP_PORTS at the PORT variable, so Kestrel listens on the web process’s port, 8080 by default, and sets ASPNETCORE_FORWARDEDHEADERS_ENABLED=true, so the application takes the scheme from the X-Forwarded-Proto header of Sevalla’s proxy: requests are HTTPS, and the template’s UseHttpsRedirection and UseHsts work without a redirect loop.
Commit everything and push it to your Git provider:
Deploy to Sevalla
These steps build with Ingot. To build from your own Dockerfile instead, see Deploy with a Dockerfile.Create the database
orders-db as the Display name, choose a Data center and a Size, then click Create database. See Create a database for every field.Create the application
Connect the database
orders-db as the Service, turn on Add environment variables to the application, and click Add internal connection. Sevalla adds DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD and DB_URL to the application. See Connect an application.Create the migration job
Migrate as the Name and /app/efbundle as the Custom start command. Keep the Start policy at Before deployment and the Resource at H1, then click Create process.Deploy
Turn on auto-deploy
Verify the deployment
-
On the Deployments tab, click the deployment. Its Build log shows Ingot’s build plan: .NET 10 from the project’s
TargetFramework, ASP.NET Core and the start command.During the rollout, the build log showsBuild logMigrate has been successful. If the job fails, the deployment fails and the previous version keeps running. -
Wait for the deployment’s status to change to Deployed, then click the domain under the application’s name, for example
storefront-x7k2m.sevalla.app. The template’s home page showsHello, world!. -
Click Counter, then click Click me three times. The page shows
Current count: 3: the clicks reached the server over a WebSocket towss://storefront-x7k2m.sevalla.app/_blazor, which Sevalla’s proxy passes through with no settings. -
Add
/subscribeto the address, enter an email address and click Subscribe. The page showsThanks, ana@example.com is subscribed.Load the form again, deploy, then submit it: it still works, because the new instance reads the keys from the database.


status with Get deployment (getDeploymentV3) until it’s success, and its build log with Get application deployment logs (getApplicationDeploymentLogsV3), as in Deploy with the API. Then ask for a circuit the way the browser does: the negotiate request lists the transports the server offers, WebSockets first:
getApplicationRuntimeLogsV3) with search finds the migration that the Migrate job applied:
Run one instance
Keep the web process at 1 instance, and give it a larger size when it needs more capacity. A circuit lives in the memory of one instance, and SignalR opens it with two requests: aPOST to /_blazor/negotiate, then the WebSocket. Sevalla’s proxy has no sticky sessions, so with 2 or more instances the two requests can reach different instances. Every page load where they do fails to connect (4 of 8 in a test with 2 instances), and the browser’s console shows:
--interactivity WebAssembly when you create the project): they run in the browser and need no circuit. Azure SignalR Service, Microsoft’s other answer to scaling out Blazor Server, is outside the scope of this guide.
A deployment replaces the instance, so it ends every open circuit. The template’s reconnection dialog tries to rejoin, the new instance rejects the unknown circuit, and the page reloads: the state of interactive components, such as the counter, starts over.
Deploy with a Dockerfile
Ingot needs no Dockerfile. Write one when you want full control of the image: the base image, system packages and every layer. Add aDockerfile and a .dockerignore to the root of the repository:
.dockerignore leaves them out of the image.
Commit and push both files. Ingot doesn’t use the Dockerfile, so you can keep it in a repository that builds with Ingot, but it adds the .dockerignore patterns to its own (its build plan shows Ignored 10 patterns from .dockerignore), and the Ingot build passes with this file. Then switch the application to the Dockerfile build strategy:
Choose the Dockerfile build strategy
Dockerfile and the Docker context ., then click Update build strategy.Deploy
📦 Building and pushing docker image using Dockerfile... instead of Ingot’s build plan, and still shows Migrate has been successful. The Counter and Subscribe pages work as in Verify the deployment, and a form loaded before the deployment still submits. The deployment’s Dockerfile tab shows the file the image was built from. When you push a change to the code only, the build log shows CACHED for the dotnet restore step.
With the API, Update application (updateApplicationV3) switches the build strategy. Then deploy and wait as in Deploy with the API:
sevalla apps update $APP_ID --build-type dockerfile --dockerfile-path Dockerfile. The new deployment’s build log names the Dockerfile build:
Deploy changes
With Auto-deploy on, every push to the branch starts a deployment; otherwise, click Deploy now for each change. Each deployment builds the image, runs theMigrate job, then replaces the web process’s instance, which ends the open circuits. Without a readiness probe, the new instance gets requests as soon as its container starts, a moment before Kestrel listens, and they fail with 503: turn on a readiness probe with the Path /. The probe calls the instance over plain HTTP, so each instance logs Failed to determine the https port for redirect. once; the warning is harmless. To add tables, add a DbSet to a context, run dotnet ef migrations add <Name> locally and commit the new files in Migrations/. When you add or update a package, dotnet add package updates packages.lock.json: commit it too. See Deployments.
Use environment variables
Add variables on the application’s Environment variables tab; they apply at the next deployment. ASP.NET Core reads every environment variable into its configuration: readPAYMENT_API_URL with builder.Configuration["PAYMENT_API_URL"], or inject IConfiguration into a component, and write a nested setting such as ConnectionStrings:Default as ConnectionStrings__Default. See Environment variables.
Add a custom domain
To serve the application from your own domain, such asshop.example.com, add the domain on the application’s Domains tab and create the DNS records that Sevalla shows. The template allows every host and SignalR accepts the connection on any domain the application serves, so the application needs no change. Custom domains need a web process larger than H1, so scale the web process first. See Custom domains.
Troubleshoot
Deploy with the API
These calls make the same deployment as Deploy to Sevalla, in an order that a script or an AI agent runs as it is. Each step names the Sevalla API operation, then the CLI command and the MCP server tool that do the same. You need:- An API key with the Company developer role, or the
APP:CREATE,APP:READ,APP:UPDATE,DATABASE:CREATE,DATABASE:READandDATABASE:UPDATEpermissions, in theSEVALLA_API_KEYenvironment variable. The CLI reads the key fromSEVALLA_API_TOKEN. - The repository on a Git provider that’s connected to your Sevalla account. See Git providers. Creating the application checks it: when Sevalla can’t read the repository, the call returns
400withCannot access repository https://github.com/acme/storefront: Repository not found or you don't have access., followed by where to grant access. curl,jqandopenssl.
Choose the location
listClustersV3) returns the locations your company can use, each with its id, the display_name that the dashboard shows and its region ID in location. Keep the ID of the one you want by its region ID, such as eu-frankfurt-1 for Frankfurt, Germany. Locations lists them all. The database and the application must be in the same location:sevalla resources clusters. MCP: get_platform_options.Find the newest PostgreSQL version
listDatabaseVersionsV3) returns the versions you can create in the location:sevalla resources db-versions --cluster $CLUSTER_ID --type postgresql. MCP: create_database picks the newest version when you leave version out.Find the DB1 size
listDatabaseResourceTypesV3) returns the database sizes by name. DB1, the smallest, is the dashboard’s default:sevalla resources db-types. MCP: get_platform_options.Create the database
createDatabaseV3) needs a password: generate one and keep it, because Get database (getDatabaseV3) doesn’t return it. The call returns at once, with the status creating:sevalla databases create --name orders-db --type postgresql --db-version $PG_VERSION --cluster $CLUSTER_ID --resource-type $DB_SIZE_ID --db-name orders --db-user storefront --db-password $DB_PASSWORD. MCP: create_database, which generates the password and doesn’t return it, so use this call when the application needs the password itself.Wait for the database
getDatabaseV3) returns the status, creating and then ready once the database accepts connections, and the internal hostname and port that the application connects to:sevalla databases get $DB_ID. MCP: get_database.Create the application
createApplicationV3) creates the application with a web process. It builds with Ingot (build_type is ingot) and isn’t deployed yet:sevalla apps create --name storefront --cluster $CLUSTER_ID --source privateGit --git-type github --repository https://github.com/acme/storefront --branch main. MCP: create_application with deploy set to false.Find the domain
listApplicationDomainsV3) returns the domain that Sevalla gives the application. It appears a few seconds after the application is created, so ask until it’s there:sevalla apps domains list --app-id $APP_ID. MCP: get_application.Connect the database
createApplicationInternalConnectionV3) connects the application to the database over the private network and returns the connection’s id. Unlike the dashboard, it doesn’t add environment variables:sevalla apps internal-connections create $APP_ID --target-id $DB_ID --target-type database. MCP: sevalla_api_create with createApplicationInternalConnectionV3.Add the connection variables
createEnvironmentVariableV3) adds the five variables that Program.cs reads, with the names and values that the dashboard’s internal connection adds, available at runtime only. The dashboard also adds DB_URL, which this application doesn’t read:sevalla apps env-vars create $APP_ID --key DB_HOST --value $DB_HOST, once per variable; it always makes a variable available during the build and runtime. MCP: set_environment_variables with buildtime set to false.Find the web process
listProcessesV3) returns the web process that the application was created with:sevalla apps processes list --app-id $APP_ID. MCP: get_application.Find the H1 size
listProcessResourceTypesV3) returns the sizes by name, in lowercase:sevalla resources process-types. MCP: get_platform_options.Create the migration job
createProcessV3) creates the Migrate job. The API needs the size, a scaling_strategy and the job_start_policy, which the dashboard fills in for you:sevalla apps processes create $APP_ID --name Migrate --type job --command /app/efbundle --resource-type $H1_ID --job-start-policy beforeDeployment. MCP: sevalla_api_create with createProcessV3 and the same body.Set the size
updateProcessV3) sets the size:sevalla apps processes update $WEB_ID --app-id $APP_ID --resource-type $H1_ID. MCP: scale_process with size_id.Turn on auto-deploy
updateApplicationV3) turns on automatic deployments for every push to the branch:sevalla apps update $APP_ID --data '{"auto_deploy":true}'. MCP: sevalla_api_update with updateApplicationV3.Deploy
triggerDeploymentV3) deploys the latest commit on the branch:sevalla apps deployments trigger $APP_ID --branch main. MCP: trigger_deployment.Wait for the deployment
getDeploymentV3) returns the deployment’s status: waiting and inProgress while it runs, then success, failed, cancelled or skipped. Poll it until the status is final, for up to 30 minutes:sevalla apps deployments get $DEPLOYMENT_ID --app-id $APP_ID. MCP: get_deployment.Read the build log
getApplicationDeploymentLogsV3) returns the build log, oldest line first: the build plan from Verify the deployment, the build and the rollout. When the status is failed, the last lines say why. With search, it finds the job’s result:sevalla apps deployments logs $DEPLOYMENT_ID --app-id $APP_ID. MCP: get_deployment_logs.Check the application