Running Mattermost plugins in high availability clusters

Custom Mattermost plugins often assume one server, so they can misbehave once Mattermost runs on redundant application servers. This page covers the design decisions, rollout sequence and effort drivers for making plugins safe on a multi-node Mattermost high availability cluster.

On this page

Why Mattermost plugins need planning for Mattermost plugins high availability

A plugin built for a single Mattermost server can fail quietly once the same code runs on several nodes, so every custom plugin must be checked for shared state, cluster-wide events, run-once background jobs and file store use before it goes live on a cluster. A plugin that caches data in memory, assumes it is the only process reacting to a message, or schedules a job on a timer will behave differently when a request lands on another node. The check should happen before the cluster takes production traffic, not after users report duplicate posts or missing notifications.

High availability is available only on the Enterprise and Enterprise Advanced plans, according to the Mattermost high availability documentation, so a team on a lower plan cannot rely on this path at all. The cluster also needs shared file storage on Amazon S3, an S3-compatible service or NAS mounted on each node, because local file system storage will not work correctly and risks corrupting files. Plugin storage sits on that same shared store, so the plugin's file paths and startup behavior must be confirmed against it. Ask your Mattermost contact and the plugin's developer to confirm the exact plan entitlements for your contract.

Teams usually implement this work in one of two situations: before the first cluster go-live, when the plugin is still in design or test, or later, when an existing single-server plugin is moved onto a cluster that is already serving users. The second case carries more risk because the plugin is already holding data and running jobs in production. In either case, plan a test cluster with at least two application nodes, run the plugin's background jobs and cross-node features there, and record which node performs each action. That record becomes the baseline for the build and verification work described below.

What the Mattermost cluster provides and what the plugin must handle itself

The documented Mattermost high availability cluster covers the server, database and load balancer layers. Plugins run inside each application node, so they inherit none of that protection for their own state, events or scheduled work, and that gap is where most multi-node plugin problems start.

Redundant application servers

A high availability cluster runs several Mattermost application servers behind a load balancer, so the loss of one node does not take chat offline. Each node loads its own copy of every plugin. Your plugin's server component therefore runs once per node, and any assumption that it is the only instance does not hold. Confirm with your Mattermost version how plugin processes start and stop on each node during a rolling restart.

HA cluster docs

Redundant database and load balancers

The cluster also needs redundant database servers and redundant load balancers. Your plugin reaches the database through the server's stores and API, not through a direct connection it manages itself. Plugins that open their own database connections need a plan for failover, connection limits and credentials across nodes. Check whether your design avoids this path entirely.

Read and search replicas

Mattermost can send reads to database read replicas and search replicas while writes go to the primary database. A plugin that reads right after writing may see stale data from a replica. Decide which of your plugin's reads can tolerate replication lag and which must read from the primary. Test this before you rely on it for approvals or counters.

In-memory state is not shared

A plugin's in-memory variables, caches and locks exist only on the node that holds them. A request handled by node A cannot see a cache that node B populated. Store anything that must be consistent across nodes in the shared data layer your plugin is designed to use, and treat in-process caches as disposable. Review every package-level variable in the server component.

Cluster events and scheduled jobs

Cluster events reach every node, so a handler that acts on them runs once per node. Scheduled jobs that must run once, such as digests, expiry sweeps or external syncs, need an election or lock so only one node acts. Confirm the cluster event and job facilities available in your Mattermost version, and test failover while a job is running.

Plugin files on the shared file store

Plugin files written to disk must go to the shared file store, which the cluster requires to be Amazon S3, an S3-compatible service or NAS mounted on every node. Writing to local disk leaves files on one node only and can corrupt data if nodes write the same path. Ask your team to confirm the plugin file store path, permissions and cleanup behavior against your version before the first multi-node test.

How a user request, a cluster event and a scheduled job reach a plugin across nodes

A request enters through the load balancer, which sits outside the trust boundary, and is routed to any application node. Each node runs its own plugin process, so the plugin must keep shared state in PostgreSQL or the shared file store rather than in local memory. Writes go to the primary database and reads can be served by replicas. A scheduled job is guarded so that only one node runs it at a time. Check that every node sees the same stored state and that the job guard holds during a node failure.

Requests, cluster events and scheduled jobs all share state through the database and file store.

Which state, job and storage patterns to choose for a clustered plugin

This table compares the four decisions that determine whether a Mattermost plugin behaves on a multi-node cluster: where state lives, how background jobs run, how files are written and how the plugin reacts to cluster events. Read each row against the plugin's data and failure tolerance, since every option trades consistency against recovery effort.

DecisionOptionsWhen each option fits
Where shared plugin state livesDatabase (plugin KV store or your own PostgreSQL tables): shared by all nodes, survives restarts. Shared file store: suits files and larger blobs, not frequently changing records. In-process memory: fast but per node and lost on restart. External service: such as a cache or queue you operate.Use the database for anything other nodes must read consistently. Use the shared file store for large artifacts. Use memory only for caches that can be rebuilt. Use an external service only when your team already operates and monitors it.
How background jobs run onceEvery node runs the job with a guard: each run takes a lock or checks a stored lease before working. A single designated node runs the job: one node is chosen and the others skip it. An external scheduler triggers the job: cron or a workflow engine calls a plugin endpoint.Use guarded jobs when the work is idempotent and cheap to skip. Use a designated node when the job must never overlap and you can tolerate failover delay. Use an external scheduler when job history and retries must be visible outside Mattermost.
How the plugin writes filesShared file store only: every write goes to the storage that all nodes mount or reach. Temporary local path: used for scratch work and never treated as shared, with the final result moved to shared storage before it is referenced.Write only to the shared file store for anything another node or user may read. Use a local temporary path only for intermediate processing, and confirm that cleanup runs if a node stops mid-job.
How the plugin reacts to cluster eventsReload on event: the plugin refreshes cached configuration when the cluster broadcasts a change. Poll on an interval: the plugin rereads state on a timer. Rely on a restart: the plugin reads state only at startup.Reload on event suits configuration that changes often and must take effect everywhere quickly. Polling suits data where a short delay is acceptable and event delivery is unreliable. Restart reliance suits static settings, but any change then depends on an operator restarting each node.
Consistency and recovery consequencesDatabase state and guarded jobs favor consistency and recover after node loss. Memory state and designated-node jobs are faster or simpler but can lose data or pause work during failover. External services add a dependency that must be monitored and restored.Match the pattern to the data: lost data that can be recomputed tolerates memory, while financial, audit or user-facing records need durable shared storage. Confirm with your plugin owner what happens to each piece of state if one node fails mid-operation.

How the design changes by plugin type

A stateless inbound receiver accepts HTTP requests from an external system and posts messages into Mattermost channels. Because it keeps no local memory of what it has done, any node can handle any request, and the cluster behaves much like a single server. The main risk is duplicate posts: when the sender retries after a timeout, or a load balancer routes the retry to a different node, the same event can appear twice in a channel.

  • Idempotency key: Ask whether the sender provides a stable event ID you can check before posting.
  • Dedup window: Decide how long processed IDs must be remembered and where that record lives, so every node sees it.
  • Retry behavior: Confirm how the sending system retries and what it does after a non-2xx response.
  • Rate and ordering: Decide whether message order matters, since events from different nodes can arrive out of sequence.
  • Secrets: Confirm where inbound tokens are stored and that every node reads the same configuration.

Before building, confirm which ID and retry behavior your sending system actually provides, and test a deliberate retry against a two-node setup.

Implementation sequence for a clustered plugin rollout

This sequence takes a custom Mattermost plugin from an unknown cluster footprint to a tested, documented release that runs correctly across nodes and survives upgrades. Each step produces a artifact the next step depends on, so the team can see what is decided, what is tested and what operators must do.

  1. Inventory plugin state, jobs, files and external calls

    The plugin owner and the platform engineer list everything the plugin does at runtime: where it keeps data in memory, what it writes to the database or plugin storage, which scheduled or background tasks it starts, which files it reads or writes, and which external services it calls. Include the server component and the web app component. The output is a written inventory with one row per item, marked with its owner and whether it runs per request, per node or on a timer. The step is done when the inventory has been reviewed by someone who did not write the plugin and no item is marked unknown.

  2. Confirm target release and support window

    Before any code changes, the team picks the Mattermost server version the plugin will target and checks its support window on the Mattermost server releases page. Confirm whether the target is a monthly release or an Extended Support Release, and record its support end date and the dates of the releases that follow. The output is a short compatibility note naming the target version, the support end date and the date by which the next upgrade must be planned. Ask the vendor or your own environment owner to confirm which release your existing cluster runs before you accept the target.

  3. Decide state, job and storage patterns

    Using the inventory, the team decides how each item behaves in a cluster. Typical decisions cover whether state lives in the database rather than in node memory, which background job runs once for the whole cluster and how that is coordinated, how cluster events are received by every node, and whether plugin files go to the shared file store. Record each decision with the alternative considered and the reason it was rejected. The output is a decision record that reviewers can challenge. The step is done when every inventory item maps to one pattern and the record has an owner for each open question.

  4. Change and test on a single-node non-production server

    The developer implements the decisions on a single-node, non-production Mattermost server that matches the target release. Test install, enable, disable and upgrade of the plugin, along with the behaviors recorded in the decision record, including startup when the plugin file store is available and when it is not. Log any defect that only appears under load or restart. The output is a test result set listing each test case, its expected result, the actual result and the build tested. The step is done when all single-node cases pass and the build is tagged for cluster testing.

  5. Build a test cluster with shared storage and replicas

    The platform team builds a non-production high availability cluster that matches the production design: multiple application nodes, the primary database with any read replicas the production design uses, load balancing and a shared file store mounted on every node. Mattermost requires shared storage on Amazon S3, an S3-compatible service or NAS, and local file system storage will not work correctly. Deploy the tagged plugin build to the cluster and confirm each node loads it and that the file store is reachable at startup. The output is a cluster build record with topology, versions, storage type and the plugin build hash. The step is done when every node reports the plugin as active.

  6. Test node loss, rolling restarts and monthly upgrade

    Run the failure and change scenarios that a cluster will see in operation: stop one application node during plugin activity and confirm that background jobs still run exactly once, restart nodes one at a time and check that cluster events reach every node, and apply a monthly server release to the cluster and confirm the plugin still loads. Record the observed behavior for each scenario, including any duplicate job runs, lost events or stale state. The output is a failure test result set with pass or fail status and linked evidence such as logs. The step is done when every failing case has a fix and a retest on the cluster.

  7. Document the runbook and hand over

    The team writes the runbook that operators will follow after go-live. It covers installing and upgrading the plugin across the cluster, the order of node restarts, how to check which node runs the scheduled job, what to do when the file store is unavailable, the rollback procedure, and the upgrade checklist for each new server release. Include the decision record and test result sets as appendices. Hand over to the operations team in a session where they perform one rolling restart and one rollback on the test cluster. The output is a signed-off runbook and a handover record listing who accepted it.

What drives the effort of clustering a plugin and how to keep it down

This table lists the factors that change how much work it takes to make a custom plugin safe on a multi-node Mattermost cluster, and what each one costs in redesign and retesting. Read each row as a lever: the reduction column shows where scope can shrink before a quote is requested. The main takeaway is that most of the effort sits in the existing code's single-node assumptions and in how many Mattermost versions must be tested, both of which recur with every monthly or ESR upgrade.

DriverWhy it adds effortHow to keep it down
Number of stateful featuresEach feature that keeps data in plugin memory or on one node must be moved to shared storage and tested under concurrent requests on every node.Inventory stateful features first and keep state in the database or the plugin KV store where possible. Drop features that do not need to persist.
Number of scheduled jobsJobs such as cron-style tasks run on every node unless guarded, so each one needs a leader election or lock and a failover test.Consolidate jobs into one scheduler with a single lock key. Remove jobs that can run on demand instead.
Use of local filesFiles written to a node's local disk are invisible to other nodes, and cluster deployments require shared storage such as S3, an S3-compatible service or NAS on each node. Local writes risk corrupting files.Route all plugin file output through the shared file store APIs. Audit the code for direct disk paths before design starts.
External API calls that need idempotencyWhen a request is retried after a node failure or a timeout, the external system may receive duplicate posts, tickets or charges unless each call carries a stable key.Attach a deterministic idempotency key to each outbound call and record completed keys. Confirm each external system supports this.
State of the existing code (single-node assumptions)Code that assumes one process, in-memory caches, or ordering of events across requests usually needs rework rather than a configuration change.Run a short review of globals, caches and goroutines before estimating. Scope a refactor only for the paths that fail that review.
Number of Mattermost versions to test againstEach supported server version in your upgrade window needs a test pass on the cluster, and plugin APIs can change between releases.Agree the version matrix in writing, such as the current monthly release and the ESR your organization runs, and test only those.
Availability of a non-production clusterWithout a multi-node staging cluster that mirrors the production file store and database replicas, failover tests must run in production or be skipped.Confirm early whether a staging cluster with shared storage exists. Ask the partner whether it will be provisioned or reused.

How to verify clustered plugin behavior and run it after go-live

Verify clustered plugin behavior with failure tests before go-live, not just feature tests on a single node. Run each plugin job and hook on a staging cluster that matches production's node count, shared file store and database topology. Stop an application node while a scheduled job is mid-run and confirm the job completes once on another node, not twice and not never. Trigger a load balancer failover during active posting and confirm the plugin's HTTP routes and websocket-driven features recover. Introduce database replica lag and confirm that any plugin code reading state it just wrote on the primary handles stale reads correctly. Document the expected result for each case before you run it.

Duplicate-action checks matter as much as failures. Send one inbound webhook request, then retry it the way a sending system would after a timeout, and count the posts that appear in the channel. Repeat with a slash command or a plugin-triggered post during a node restart. For files, write an attachment through the plugin and confirm it lands on the shared store (Amazon S3, an S3-compatible service or NAS, as the high availability docs require) and is readable from every node. Confirm the exact file store path and permissions with the Mattermost operations documentation and your storage team, since those details depend on your setup.

After go-live, watch plugin errors per node in your logs and metrics, so a fault on one application server does not hide behind healthy traffic on the others. Confirm log locations and health check endpoints in the Mattermost operations documentation before you build alerts on them. Retest the plugin against each monthly server release, published on the 16th, and against each Extended Support Release upgrade, before those versions reach production. Keep a rollback path that includes the previous server binary, the previous plugin bundle and a database backup taken before the upgrade, and rehearse it once so the team knows the steps.

How clustered plugins connect to the rest of the platform

A plugin on a high availability cluster does not run alone. It depends on the database, the shared file store, identity, the load balancer, external services and the monitoring stack, and each of those can behave differently across nodes. Confirm each connection with the platform owner before the plugin design is fixed.

PostgreSQL primary and read replicas

Writes from a plugin go to the primary database, while reads sent to a replica can lag behind the primary. A plugin that writes a record and reads it back on another node may not see its own change yet. Confirm with the database owner which replica the plugin's read path uses, how much lag is acceptable, and whether any plugin logic must read from the primary to stay correct.

HA cluster docs

Shared file store on S3 or NAS

Plugin bundles and any files a plugin writes must live on the shared file store that every node mounts. Local disk storage will not work correctly in a cluster and risks corrupting files. Confirm with the platform owner which bucket or NAS path the plugin uses, who holds the write permissions, and how files are named so two nodes never write the same object.

Identity through SSO and AD/LDAP sync

Plugin actions tied to a user depend on how that user is identified and provisioned. SSO (SAML, OIDC, OAuth) and AD/LDAP user sync are available from the Professional plan. Confirm with the identity owner which user attributes the plugin trusts, how deprovisioned accounts are handled, and whether any service identity used by the plugin is a bot account rather than a personal login.

SAML SSO docs

Load balancers and TLS termination

The load balancer decides which node receives a plugin's HTTP requests, and TLS termination affects the URLs that plugins and external callbacks see. Session affinity, timeouts and header forwarding all change plugin behavior. Confirm with the network owner how requests reach plugin routes, which timeout applies to long plugin calls, and that the forwarded client address and protocol headers are what the plugin expects.

External systems and idempotency

When several nodes run the same plugin code, any call a plugin makes to an outside system can happen once per node or once per retry. A ticket creation or payment notification sent twice causes real harm. Confirm with each external system's owner whether it accepts an idempotency key, what it does with duplicate requests, and which plugin action must carry that key.

Monitoring and node-level log collection

A plugin error on one node may never reach users, so it can stay hidden unless logs from every node are collected. Confirm with the operations owner that plugin logs from each application server reach the central log platform, that the log entries identify the node, and that alerts fire on repeated plugin failures rather than on single events.

Questions teams ask before running plugins on a Mattermost cluster

What does it cost to run a plugin on a Mattermost cluster?

Cost depends on how much of the plugin has to change for multi-node operation, and on how many parts of it touch shared state. The main line items are the engineering time to review the plugin for cluster safety, changes to shared storage and cluster event handling, test cluster infrastructure, and the Mattermost subscription itself. The subscription is separate from any services work and is priced on seat licenses, with no public list prices on the Mattermost pricing page, so ask Mattermost sales for a quote. Ask any partner for a fixed-scope quote that lists each item, what is one-time, and what recurs, such as retesting after each upgrade.

How long does it take to make a plugin work on a cluster?

The timeline is driven by the number of plugin features that need changes, the number of background jobs that must run once across nodes, and how much of the plugin already stores data in the file store. A plugin with simple, stateless behavior moves faster than one that keeps state in memory or runs scheduled tasks on every node. Other factors include whether a test cluster is ready, how quickly the client can provide the plugin source and a named reviewer, and whether the team has to wait for a Mattermost plan change or procurement. Agree on the timeline in writing once the scope is known.

What does our team need to provide for this work?

You need four things: access to the plugin source code and its build pipeline, a test cluster that mirrors production with multiple application nodes, a named owner who can make decisions about behavior and data, and a Mattermost plan that includes high availability clustering. High availability is available only on the Enterprise and Enterprise Advanced plans, so confirm your plan before the work starts. The test cluster should also use shared file storage on Amazon S3, an S3-compatible service or NAS mounted on each node, because local file storage will not work correctly in a cluster.

Can an internal team make a plugin cluster-safe without a partner?

Yes, if the team has Go engineers who understand the plugin's server component, can run a multi-node test environment, and have time to test failover and upgrades. The hard parts are less about code syntax and more about finding every place where a plugin assumes a single node, such as in-memory caches, local files, or scheduled jobs that would run on each node. A partner can help with a structured review and test plan, while your team keeps ownership of the code. Decide early who will maintain the plugin after the first release, because that person will carry the cluster-specific knowledge forward.

Is high availability available on every Mattermost plan?

No. Mattermost high availability, which consists of redundant application servers, redundant database servers and redundant load balancers, is available only on the Enterprise and Enterprise Advanced plans. According to the Mattermost pricing page, SSO and AD/LDAP sync start at the Professional plan, while high availability clustering and FIPS 140-3 compliance start at Enterprise. If your organization is on a lower plan, a plugin cluster design is not needed yet, but confirm the plan entitlement with Mattermost before planning any cluster work.

What happens when Mattermost ships a new monthly or ESR release?

Mattermost releases a new server version in binary form on the 16th of each month, and it publishes Extended Support Releases with their own support windows. Each new server version can change plugin APIs, cluster behavior or dependencies, so your plugin needs a test pass on a cluster before production upgrades. Teams on an Extended Support Release typically test less often, but they still need to check the plugin against the ESR before its support ends. Plan for a repeatable regression test, a rollback path, and a named owner who approves each upgrade. Confirm the current release dates on the Mattermost server releases page before scheduling.

How DeployOpen scopes, delivers and supports clustered plugin work

DeployOpen treats plugins on a high availability Mattermost cluster as part of the platform, not an add-on. We agree the written scope first, then build and test the plugin against the shared file store, cluster behavior and background job design your cluster actually uses, and hand over documentation your team can run.

How we scope

  • Written scope lists each plugin, its server and web components, and the cluster nodes it must run on.
  • We confirm the plan level and whether high availability clustering is already licensed for your deployment.
  • Scope records shared file store details, database replicas and which background jobs must run exactly once.

How we build

  • We implement cluster-safe state handling so each node reads consistent plugin data from the database or the shared store.
  • Background jobs get a single-runner design, with lock or leader logic tested under node restarts and failover.
  • Plugin file storage is tested on your shared file store, not on local disk, before any node goes into production use.

How we hand over

  • Deliverables include the plugin source, build steps, and a runbook covering cluster event handling and job ownership.
  • Test records show how the plugin behaved during node loss, rolling restarts and a test upgrade to a newer monthly release.
  • Your team receives a walkthrough so administrators can install, update and roll back the plugin on the cluster.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer, scoped in writing.
  • Retained support covers re-testing the plugin against each new Mattermost release before your planned upgrade window.
  • Ask in any quote which Mattermost release and support window the work targets, and who owns plugin upgrades after handover.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.