Upgrading from 1.6.x to 2.0
This page is for an installation that runs 1.6.x today. It lists what 2.0 changes for you, the order to upgrade the parts in, and how to go back if something goes wrong. Read the sections on workflows and identity before you start: a few behaviours change in ways that a passing test would not show.
Before You Start
- Back up the database. The API migrates it when it starts, and there is no automatic way back (see Rolling Back). A
pg_dumpof the application database is enough; Redis and the message broker hold nothing that has to survive. - Check your workflow conditions and data mappings. 2.0 rewrites them as expressions. Several cases that passed silently in 1.6 now fail the step: see Workflows.
- Let running work finish. Runs and occurrences started before the upgrade continue afterwards, but an upgrade during a quiet period is easier to check.
- Read the license change below if you sell Milvaion, offer it as a service, or ship the SDKs inside a product.
License: FSL-1.1-ALv2
2.0 and every later release, including the worker SDKs in every language and the Milvasoft.Templates.Milvaion project templates, is licensed under the Functional Source License 1.1 with the Apache 2.0 future license (FSL-1.1-ALv2).
- Anyone may install and use Milvaion, for any purpose of their own, and change it. Every feature is free.
- You may not sell Milvaion or offer it to others as a hosted or managed service that competes with it.
- Each release becomes Apache-2.0 two years after it is published.
- Versions published before 2.0 keep the license they were published under: the repository was Apache-2.0 and the NuGet packages declared MIT.
- Code generated from the project templates is yours. The READMEs inside generated projects are unchanged.
The full text is in LICENSE.
Upgrade Order
Upgrade in this order. Each step works with the parts not yet upgraded, so you can stop between steps.
| Step | Part | Notes |
|---|---|---|
| 1 | API (with the dashboard) | Migrates the database on startup. Run one instance while it does, see below. |
| 2 | Built-in workers | HTTP, SQL, Email, Command, Maintenance, Reporter and AI workers. 1.6 workers keep running against a 2.0 API, but miss the 2.0 behaviours listed below. |
| 3 | Your own .NET workers | Update the Milvasoft.Milvaion.Sdk.Worker packages (and the Hangfire or Quartz package if you use one) to the 2.0 release, rebuild, redeploy. |
| 4 | Workers in other languages | Update the Node.js, Go, Python, Java, PHP, Rust or Ruby SDK. On RabbitMQ and Kafka nothing in your code has to change. |
| 5 | CLI and Terraform provider | Use the releases that come with 2.0. Workflows in milvaion apply and milvaion_workflow use the 2.0 definition and need a 2.0 API. |
Workers go after the API because a 2.0 worker sends fields a 1.6 API does not read, while a 1.6 worker is understood by a 2.0 API: the messages between them only gained optional fields. A 1.6 worker under a 2.0 API:
- retries a workflow step itself even when the step has its own retry policy, so a step can run more often than the policy says;
- does not mark permanent failures with
[PERMANENT FAILURE], so the workflow engine retries them; - cannot run connector jobs (the HTTP worker needs 2.0) and cannot use the HTTP transport.
API
The API applies its database migrations when it starts, before it accepts traffic. It also rewrites stored workflow definitions and versions to definition version 2 on that first start (it logs Upgraded N workflows to definition version 2).
Run one API instance during the upgrade, so a 1.6 instance does not keep working on a database the 2.0 instance has just changed. Scale down to one, upgrade, wait for /api/v1/healthcheck/ready to answer 200, then scale out again. From 2.0 on, every API instance runs the workflow engine; the engine lock is gone and runs are claimed in the database.
Docker Compose: set the image tags of the API and the workers to the 2.0 release (the repository's docker-compose.yml builds the API from source instead: check out the 2.0 tag), then start the API on its own first:
docker compose pull
docker compose up -d milvaion-api # your API service; one instance
docker compose logs -f milvaion-api # wait for "Database initialization result"
docker compose up -d # then the workers
Two new compose files come with 2.0: deploy/compose/all-in-one.yml (API, every built-in worker, PostgreSQL, Redis and RabbitMQ, with a setup wizard) and deploy/compose/standalone.yml (API and PostgreSQL only). They are for new installations. To move an existing one to them, point them at your existing database volume or connection string; do not start them next to your current stack on the same database.
Helm: the API image defaults to the chart's appVersion, and each built-in worker has its own workers.<name>.image.tag. Upgrade to the chart release that ships 2.0, or set the tags yourself:
helm upgrade milvaion oci://ghcr.io/milvasoft/charts/milvaion -n milvaion --reuse-values \
--set api.replicaCount=1 --set api.autoscaling.enabled=false
# when the API is ready, restore your replica count or autoscaling
The chart's new values (transport: postgres, coordination, workerGateway.*) default to the 1.6 behaviour, so --reuse-values keeps your setup as it is. The chart's license annotation is now FSL-1.1-ALv2. See Kubernetes (Helm).
SDKs
- .NET: update every
Milvasoft.Milvaion.Sdk*package to the 2.0 release together.Worker:Transport:TypegainsHttp(see Worker Gateway);RabbitMQstays the default. - Other languages: the 2.0 releases change the license. The HTTP transport arrives in the .NET SDK first.
- Custom code built against the API's assemblies (not the SDK):
Milvaion.Application.Interfaces.Redisis nowMilvaion.Application.Interfaces.Coordination, andIRedisLockService,IRedisSchedulerService,IRedisStatsService,IRedisWorkerServiceandIRedisCancellationServicebecameILockService,ISchedulerStore,IStatsStore,IWorkerStoreandICancellationBus. AnILdapAuthenticatorimplementation receives the LDAP options as its first argument.
Configuration
No 1.6 key was renamed or removed. Every new key has a default that keeps 1.6 behaviour, so an existing appsettings.json or set of environment variables works unchanged.
New keys you may want:
| Key | Default | What it does |
|---|---|---|
MilvaionConfig:Coordination:Type | Redis | Postgres keeps locks, the schedule and counters in PostgreSQL instead of Redis. |
MilvaionConfig:Transport:Type | RabbitMQ | Gains Postgres: the queue is a table of the application database. |
MilvaionConfig:PostgresTransport:* | Lease, polling and dead-letter settings of the Postgres transport. | |
MilvaionConfig:WorkflowEngine:SweepIntervalSeconds | 30 | How often an engine instance looks for runs nobody has picked up and takes over expired claims. |
MilvaionConfig:WorkflowEngine:ClaimSeconds | 60 | How long an instance holds a run it is working on. |
MilvaionConfig:WorkflowEngine:BatchSize | 100 | Runs an instance takes per pass. |
MilvaionConfig:Alerting:AllowPrivateAddressesForProjectChannels | false | Lets notification channels of a project send to private addresses. |
MilvaionConfig:Ai:*, MilvaionConfig:Assistant:*, MilvaionConfig:Agents:* | Limits for AI connections, the assistant and Agent steps. Nothing calls an AI provider until you add a connection. | |
Worker:Transport:Type = Http, Worker:Http:* | A worker that connects to the API over HTTP with an API key that has WorkerGateway.Connect. |
MilvaionConfig:Projects:Enabled is now optional. When you set it (many 1.6 installations set it to true), it still decides and wins over the new switch in Settings → Projects; leave it as it is and nothing changes. When it is not set, projects are off until a super admin turns them on there. See Projects.
Changed meaning:
MilvaionConfig:Alerting:Channels:InternalNotification:EnabledandSendOnlyInProductionno longer switch off the dashboard's notifications. Every enabled alert is shown in the panel; the settings still apply to the other channels.MILVAION_ROOT_PASSWORDmatters only for a new, empty database. An existing database keeps its root user. On a new database without it (an empty value counts as unset), the API no longer makes up a random password: it prints a setup token, and the dashboard asks for it once.- If
MilvaionConfig:Redis:Databaseis not0and the emergency stop is on during the upgrade, switch it on again afterwards: it moved to the database the connection string selects.
What Runs on First Start
On the first start of 2.0 the API:
- applies the EF Core migrations from 1.6 to 2.0. They add tables and columns only: identity providers, notification channels, workflow step runs, triggers, approvals, events, payloads and drafts, AI connections, usage and evaluations, connectors, the worker gateway, and the PostgreSQL coordination and transport tables (created even when you keep Redis and RabbitMQ). Nothing is dropped;
- rewrites every workflow definition and stored version to definition version 2 (see below);
- adds the new permissions (
ConnectorManagement.*,NotificationChannelManagement.*,IdentityProviderManagement.List,WorkerGateway.Connect,ProjectManagement.*,ProjectMemberManagement.*and the AI permissions). Existing roles do not get them: grant them in Roles to the roles that should use the new features; - creates the project roles Project Owner, Project Editor and Project Viewer, unless roles of those names exist.
Workflow runs that were running carry on: each gets its step runs on its first pass through the new engine.
Workflows
Most of the 2.0 work is here; the Workflows page describes the new model. What changes for workflows you already have:
Definitions. Steps get key, config and input. nodeConfigJson, dataMappings and jobDataOverride are gone from the API and the MCP tools. A client that updates a workflow must send the existing steps with their keys; an update without them is rejected, so an old client cannot erase configuration it does not know about.
Conditions become expressions. Check them before upgrading:
- An empty condition or one that cannot be read fails the step. It took the
truebranch in 1.6. - An ordering comparison (
>,<, ...) with text that is not a number fails the step; with a missing value it is false. Both were true in 1.6. - A result that is not JSON fails a field check; it was ignored.
- Numbers are read in the invariant culture.
- The outcome of a Condition, Switch, Merge or Delay node is recorded and not evaluated again, so a condition with
now()keeps its first answer.
Data mappings and job data overrides are shown as input but keep their 1.6 rules until the step's input is edited, with these exceptions: a mapping whose value cannot be found fails the step (it was skipped); a mapping without a step id reads from the parent steps only (it read from any completed step); * passes the whole result (it passed nothing); a mapping or override that cannot be read fails the step (it was dropped). A value with a secret reference ({{secret:name}}) in a mapping fails the step. Once you edit the input, a missing value is null.
Run-time data. stepJobData that is not a JSON object is rejected by the trigger call, and it is applied after the step's input.
Continue on failure. Steps that depend on a failed step, directly or through others, are skipped; they ran in 1.6. MaxStepRetries now applies with this strategy too.
Branches. A branch that is not taken is skipped to its end; in 1.6 a step after a skipped step still ran. An edge from a port its source does not have is rejected on save.
Retries. A permanent job error is not retried by the engine.
Versions. Steps and edges can be edited while runs are active; the runs keep their version. Changing the name, cron, time zone, overlap policy, concurrency limit, deadline or schedule input no longer creates a version.
Scheduling. A workflow's cron follows the same daylight saving rules as a job's. This matters only outside UTC.
New node types. nodeType gains WaitForEvent (5), Approval (6), ForEach (7), SubWorkflow (8) and Agent (9). A client that switches over node types must handle them. Waiting nodes stay Running without an occurrence while they wait.
Child runs. SubWorkflow, ForEach and Agent steps start runs of other workflows. These are ordinary runs of their workflow (with parentRunId): they appear in its run list, count against its overlap policy and concurrency limit, and raise its alerts. They are cancelled with the run that started them. Runs nest at most 5 deep.
Failed nodes. A node whose failure ends the run is recorded as Failed with port error, its error and its times; it was recorded as Skipped. A failure handled by an error edge does not fail the run.
Large payloads. Step run inputs and outputs over 256 KB are kept in the WorkflowPayloads table, and the step run holds payloadRef or inputRef. The API, the run page and expressions show them in full; a report that reads WorkflowStepRuns directly has to follow the reference.
Direct database changes. The engine locks runs and step runs with FOR NO KEY UPDATE, several rows in id order. A script that changes many of them while the API runs should do the same, or it can deadlock with the engine.
Agents. A new agent service runs Agent nodes; it follows MilvaionConfig:WorkflowEngine:Enabled. Jobs an agent starts are occurrences like a manual trigger, with the model's arguments merged into the job's data, and are not steps of the run. Workflows have exposeAsTool (default false): whether AI clients may start them as a tool.
Run detail. stepRuns also lists nodes without a job (Condition, Switch, Merge, Delay), with port and without occurrenceId. steps and edges of a run are those of the run's version.
Projects
1.6 had projects in its data model, with the Default project holding everything. 2.0 adds the management: creating projects, members with project roles, archiving, deleting and moving jobs and workflows between projects, in Settings → Projects. See Projects. Data stays in the Default project and every user keeps what they could do there.
- The switch.
MilvaionConfig:Projects:Enabledwins when it is set. Without it, the switch in Settings decides, off by default. - Roles have a scope. Every existing role is an instance role and works as before. Project roles hold project permissions only and are given to the members of a project; they cannot be given to users directly.
- Rows of other projects stay hidden while projects are off. Once other projects exist, turning projects off shows the Default project only.
- Archived projects pause their schedules. Jobs and cron workflows of an archived project do not start until it is restored.
- SSO role mappings can grant project memberships. A group mapped only to projects is not mirrored as a role. A mapping to local roles grants instance roles only.
- MCP gains
list_projectsandget_current_project.
Identity and Notifications
- Roles of external users follow the provider. The stored roles of LDAP and OIDC users are replaced when they sign in (for OIDC, when their claims are resolved, at most every five minutes). They were set once, when the user was created. Approvals check stored roles.
- Sessions and live connections end with the provider. When an LDAP directory or OIDC provider is disabled or removed, its users cannot renew their session, and their dashboard connections are closed.
- External users can be locked.
lockoutinPUT /users/userwas ignored for them and now keeps them out.GET /users/usergainsisLocked. - OIDC tokens without a subject are rejected with 401. API key and user id claims in an OIDC token are removed. The request's user name is the account's, not the token's name claim.
- Roles mirrored from a provider belong to that provider. Roles mirrored before 2.0 belong to the provider named
OidcorLdap. - OIDC providers added in the panel need an audience, and their valid issuers must be web addresses. Providers in the configuration files are not affected.
GET /settings/publicgainsoidcProvidersandldap.name;oidcstays and holds the first enabled provider.- The Slack, Teams, Google Chat, Crewhall and Notifike channels no longer follow redirects and time out after 15 seconds. No channel contacts link-local addresses.
- Alerts carry their project, and
ZombieOccurrenceDetectedis sent once per project. - Approval links need a sign-in by a user with an approver role, unless the Approval step allows decisions by the holder of the link.
- Choosing or removing the secret of a workflow trigger needs
SecretManagement.Updatebesides the workflow permissions.
API and Tools
- Job search.
searchTermofPATCH /jobsand of the MCP toollist_jobsis split into words, and every word must match the name, description, tags, job type or external id. It was one phrase matched against the name, tags or job type. The limit is 200 characters. - System configuration.
GET /admin/configurationgainscoordination.redisis null when coordination isPostgres, andrabbitMQis null on every transport other than RabbitMQ.versionis now the API's version; it showed an internal assembly version before. - Workers report the version of their
VERSIONfile (1.1.3) instead of a four-part assembly version (1.0.0.0).
Rolling Back
The migrations only add, but a 1.6 API cannot read the version 2 workflow definitions that 2.0 writes on its first start, and it does not know the new permissions or tables. Rolling back therefore means restoring the database:
- Stop every API instance and every worker.
- Restore the database from the backup taken before the upgrade. Everything recorded after the upgrade (runs, occurrences, logs, changes made in the dashboard) is lost.
- Deploy the 1.6 images, or
helm rollbackto the previous revision. - If the emergency stop was on, switch it on again.
- Start the 1.6 workers.
Without a backup, do not start a 1.6 API on the upgraded database: fix forward on 2.0 and open an issue.