How to self-host Infisical with Docker Swarm (HA).
Total Nodes | Max Nodes Down | Min Nodes Required |
---|---|---|
1 | 0 | 1 |
2 | 0 | 2 |
3 | 1 | 2 |
4 | 1 | 3 |
5 | 2 | 3 |
6 | 2 | 4 |
7 | 3 | 4 |
floor(n/2) + 1
, where n
is the total number of nodes.
This guide will demonstrate a setup with three nodes, which allows for one node to be down while the cluster remains operational. This fault tolerance applies to the following components:
haproxy.cfg
) to define the load balancing and health check rules.
infisical
network and uses secrets for environment variables.
infisical
network and use persistent volumes for data storage.
infisical
network.
infisical
network.
Install Docker on nodes
Initialize Docker Swarm on one of the VMs by running the following command
<MANAGER_NODE_IP>
with the IP address of the VM that will serve as the manager node. Remember to copy the join token returned by the this init command.On the other VMs, join the Docker Swarm by running the command provided by the manager node
<JOIN_TOKEN>
with the token provided by the manager node during initialization.Label the nodes with `node.labels.name` to specify their roles.
<NODE1_ID>
, <NODE2_ID>
, and <NODE3_ID>
with the respective node IDs.
To view the list of nodes and their ids, run the following on the manager node docker node ls
.Copy deployment assets to manager node
.env
file to the manager node. Ensure that all 3 files are placed in the same file directory.Deploy stack
Check service status
View service status
<NODE-IP>:7001
of any node in your Docker swarm.
This port will expose the HA Proxy stats.Run the following command to view the IPs of the nodes in your docker swarm.Initialize Infisical
<NODE-IP>:8080
of any node in the swarm. This will take you to the Infisical configuration page.How do I scale Infisical cluster further?
deploy
section of the relevant services, specifying the appropriate node.labels.name
constraints.
haproxy.cfg
) to include the new nodes in the backend sections for PostgreSQL and Redis.
docker stack deploy
command.
How do I configure backups for Postgres and Redis?