Deploy Mattermost in Air-Gapped Environments¶
An air-gapped environment is one that is isolated from the public internet, requiring all necessary components to be available locally. This guide outlines what you’ll need to deploy Mattermost in a self-hosted air-gapped environment, focusing on appropriate preparation, deployment guidance and configurations required for a successful deployment.
Overview¶
At a high level, deploying Mattermost in an air-gapped environment requires preparing all necessary software, container images, and configuration resources in advance, since the target system has no direct internet access; transferring these artifacts to the isolated network using secure media; and then installing, configuring, and validating the deployment within the air-gapped environment. This is a summary of the steps involved:
Select your preferred Mattermost deployment option:
This step is often dictated by the infrastruture already running in your air-gapped environment. If you’re deploying from scratch, we recommend reviewing our server deployment documentation to select the optimal option given your organizations needs.
Setup a private container registry or package mirror:
Ideally the air-gapped environment already has a private container registry or package mirror available. If not, we recommend following our frequently asked questions or referencing online resources specific to your environment.
Prepare your Bill of Materials:
Depending on your deployment method method, you’ll need to download, tag, and push required materials into your private registry or mirror.
Transfer materials into the air-gapped environment:
If the private registry cannot access the public internet, you can prepare an archive of the registry data on your internet connected machine and securely transfer it using approved data transfer methods - for example, burning to a disk.
Install Mattermost
Once you have all the necessary resources in your air-gapped environment, you can move forward with deployment following the instructions for Linux, Kubernetes, or Docker.
Configure Mattermost for air-gapped operation
The configuration settings recommended in this document accomodate for the lack of internet access to operate Mattermost in an air-gapped environment.
Note
Consider talking to a Mattermost expert if your organization needs support deploying Mattermost and supporting services in an air-gapped environment.
Bill of Materials¶
On an internet connected machine, you must gather all required packages, container images, and dependencies needed for the installation process. The resources you’ll need will depend on your deployment method, specifically:
Using our provided tarball is recommeded as the simplest installation method for air-gapped environments. You can install the Mattermost Server in a few minutes on any air-gapped 64-bit Linux system.
Prerequisites
Mattermost tarball. We recommend using the latest ESR for extended support where server upgrades may be infrequent.
Database: PostgreSQL installation packages or container images for your Linux distribution
File Storage: Local filesystem storage is sufficient for deployments under 2,000 users. For larger deployments requiring high availability, we recommend using an S3-compatible object storage solution, such as MinIO. NFS can also be considered as an alternative for shared storage needs.
Load balancer: If you already have a load balancer running in your air-gapped environment you can skip this resource, otherwise we recommend deploying NGINX from these Linux packages.
(Optional) Supporting Services Consider downloading these additional resources if you plan to enable these optional components:
Mattermost Calls: mattermost-calls-offloader (required for recording, transcription and live captions) and mattermost-rtcd (required for performance and scalability).
Elasticsearch can be deployed for enhanced search performance at scale.
Prometheus and Grafana for monitoring and observability
Kubernetes is recommended for a highly scalable and robust deployment if your organization is already running a Kubernetes cluster in the air-gapped environment.
Prerequisites
Database: We recommend options such as the Postgres Operator from Crunchy Data, CloudNativePG or pgEdge.
File Storage: We recommend the MinIO Operator.
Load balancer: If you already have a load balancer running in your air-gapped environment you can skip this resource, otherwise we recommend deploying NGINX, using the NGINX Ingress Controller operator.
(Optional) Supporting Services Consider downloading these additional resources if you plan to enable these optional components:
Mattermost Calls helm charts: mattermost-calls-offloader and values (required for recording, transcription and live captions), mattermost-rtcd and values (required for performance and scalability).
Elasticsearch can be deployed in air-gapped k8 environments for enhanced search performance at scale.
Prometheus and Grafana operators for monitoring and observability
Docker can be used if you don’t have a running Kubernetes cluster in the air-gapped environment, but want to use containers for simplified installation and dependency management. Docker is not recommended for production environments at high scale, as it doesn’t support clustered deployments or High Availability (HA) configurations out-of-the-box.
Prerequisites
Database: PostgreSQL image.
Load balancer: If you already have a load balancer running in your air-gapped environment you can skip this resource, otherwise we recommend deploying NGINX from this images.
(Optional) Supporting Services Consider downloading these additional resources if you plan to enable these optional components:
Mattermost Calls images: calls-offloader (required for recording, transcription and live captions) and rtcd (required for performance and scalability).
Elasticsearch image for enhanced search performance at scale.
Prometheus and Grafana images for monitoring and observability.
Mattermost Plugins¶
Mattermost includes a number of pre-built integrations for mission-critical tools. If you’d like to use any plugins beyond those that are pre-built in the Mattermost package you’ll need to download the plugin binaries from the Mattermost Marketplace. Once you have Mattermost deployed, these plugin binaries can be uploaded directly in the System Console.
SSL/TLS Certificates and Keys¶
If your deployment requires SSL, ensure you have the necessary certificates. This includes certificates and keys for enabling HTTPS with Mattermost, as well as any CA files or certificates needed to access internal services such as LDAP or SAML.
Local Documentation¶
Mattermost documenation can be built locally so you’ll have access to installation and configuration documentation in the air-gapped environment. Otherwise, you can download the necessary deployment and configuration documents directly from the GitHub docs repository.
Prerequisites The following software is required to build the documentation locally:
Git [download]
Python 3.11 or later [download]
Pipenv [download]
GNU Make 3.82 or later [download]
Server configuration¶
After successful deployment, you’ll need to configure Mattermost for air-gapped operation. The following sections describe these configuration options and offers recommendations for settings.
Mobile push notifications¶
Mattermost can use mobile push notifications to notify users of new messages and activity. These notifications require a server component to be deployed to send the notifications to the mobile devices. By default, Mattermost will use the public push notification service which is not available in an air-gapped environment. We recommend disabling push notifications in System Console > Environment > Push Notification Server.
Email¶
Unless you have setup an internal air-gapped email service, we recommend disabling email invitations and email verification from System Console > Authentication > Signup.
Website link previews¶
Website link previews require a connection to the internet to fetch the content of the links. We recommend disabling website link previews in System Console > Site Configuration > Posts.
GIF picker¶
The GIF picker relies on a third-party service which has a dependency on external internet access. You can disable it in System Console > Integrations > GIF.
Notices¶
In-product notices require internet access to periodcally inform administrators and end users of new product improvements, features, and releases. You can disable notices in System Console > Site Configuration > Notices.
Telemetry¶
To avoid log errors we recommend disabling Telemetry-related features, including the security update check, and error and diagnostics reporting features.
Frequently Asked Questions¶
What if my air-gapped environment doesn’t have a private container registry or package mirror?¶
A private container registry securely stores the Docker images necessary for air-gapped deployments, ensuring compliance with data isolation requirements. Similarly, a private package mirror stores operating system packages necessary for air-gapped deployments in Ubuntu or RHEL/CentOS Linux environments. Setting up a local registry or mirror is a critical step in deploying Mattermost to ensure all images, dependencies and packages are available to you in the air-gapped environment. The steps below outline the process required to setup a local registry or mirror, depending on the deployment method you are using. These steps are a rough guide, and can be supplemented with online resources depending on your specific deployment needs.
(Ubuntu) Set up a private Debian package mirror
We will use Aptly to create a local mirror, although you can also use other options such as debmirror.
Install Aptly (on an internet-connected machine):
apt-get update apt-get install aptly gnupg
Create GPG key for signing packages:
gpg --gen-key
Create a mirror configuration:
aptly mirror create -architectures=amd64 debian-bullseye http://deb.debian.org/debian bullseye main contrib non-free
Update the mirror to download packages:
aptly mirror update debian-bullseye
Create and publish a snapshot:
aptly snapshot create debian-bullseye-$(date +%Y%m%d) from mirror debian-bullseye aptly publish snapshot debian-bullseye-$(date +%Y%m%d)
Serve the repository:
aptly serve
Client configuration: Configure apt to use your local mirror:
cat > /etc/apt/sources.list << EOF deb http://mirror.example.com/debian bullseye main contrib non-free EOF
(RHEL/CentOS) Set up a private RHEL package mirror
We will use reprosync for a local mirror.
Install required tools (on an internet-connected RHEL system):
yum install yum-utils createrepo
Download packages:
mkdir -p /var/www/html/repos/rhel8 reposync -p /var/www/html/repos/rhel8 --download-metadata --repo=rhel-8-for-x86_64-baseos-rpms reposync -p /var/www/html/repos/rhel8 --download-metadata --repo=rhel-8-for-x86_64-appstream-rpms
Create repository metadata:
createrepo /var/www/html/repos/rhel8/rhel-8-for-x86_64-baseos-rpms createrepo /var/www/html/repos/rhel8/rhel-8-for-x86_64-appstream-rpms
Set up a web server:
yum install httpd systemctl enable httpd systemctl start httpd
Client configuration: Disable existing repositories:
cd /etc/yum.repos.d/ mkdir backup mv *.repo backup/
Client configuration: Create new repository files:
cat > /etc/yum.repos.d/local-baseos.repo << EOF [local-baseos] name=Red Hat Enterprise Linux 8 BaseOS baseurl=http://mirror.example.com/repos/rhel8/rhel-8-for-x86_64-baseos-rpms enabled=1 gpgcheck=0 EOF cat > /etc/yum.repos.d/local-appstream.repo << EOF [local-appstream] name=Red Hat Enterprise Linux 8 AppStream baseurl=http://mirror.example.com/repos/rhel8/rhel-8-for-x86_64-appstream-rpms enabled=1 gpgcheck=0 EOF
Client configuration: Clear cache and test:
yum clean all yum repolist
Set up a self-hosted private container registry
Install Docker Registry:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
Configure persistent storage:
docker run -d -p 5000:5000 --restart=always --name registry \ -v /mnt/registry:/var/lib/registry \ registry:2
Add TLS security (recommended):
Generate self-signed certificates:
mkdir -p certs openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key \ -x509 -days 365 -out certs/domain.crt
Run the registry with TLS:
docker run -d -p 5000:5000 --restart=always --name registry \ -v /mnt/registry:/var/lib/registry \ -v $(pwd)/certs:/certs \ -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \ -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \ registry:2
Configure Kubernetes to use private image registries
When using Kubernetes in an air-gapped environment, you need to configure it to use your private registry.
Create a kubernetes secret for registry authentication:
kubectl create secret docker-registry regcred \ --docker-server=registry.example.com:5000 \ --docker-username=your_username \ --docker-password=your_password \ --docker-email=your_email@example.com
Reference the secret in pod specifications:
apiVersion: v1 kind: Pod metadata: name: mattermost-pod spec: containers: - name: mattermost image: registry.example.com:5000/mattermost/mattermost-enterprise-edition:latest imagePullSecrets: - name: regcred
For Helm deployments, specify the registry in
values.yaml
:image: repository: registry.example.com:5000/mattermost/mattermost-enterprise-edition tag: latest pullPolicy: IfNotPresent imagePullSecrets: - name: regcred
Set up a self-hosted private container registry
Install Docker Registry:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
Configure persistent storage:
docker run -d -p 5000:5000 --restart=always --name registry \ -v /mnt/registry:/var/lib/registry \ registry:2
Add TLS security (recommended):
Generate self-signed certificates:
mkdir -p certs openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key \ -x509 -days 365 -out certs/domain.crt
Run the registry with TLS:
docker run -d -p 5000:5000 --restart=always --name registry \ -v /mnt/registry:/var/lib/registry \ -v $(pwd)/certs:/certs \ -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \ -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \ registry:2
Populate your private registry
Ensure the required images from the Bill of Materials are downloaded and pushed to the private registry.
Configure Docker to use private image registries
Configure Docker on all hosts to trust and use your private registry.
Add your registry to Docker’s trusted registries:
Edit or create
/etc/docker/daemon.json
:{ "insecure-registries": ["registry.example.com:5000"] }
For registries using self-signed certificates:
mkdir -p /etc/docker/certs.d/registry.example.com:5000 cp domain.crt /etc/docker/certs.d/registry.example.com:5000/ca.crt
Restart Docker daemon:
systemctl restart docker
Test the configuration:
docker pull registry.example.com:5000/mattermost/mattermost-enterprise-edition:latest