etcd is a distributed, key-value store designed for storing and managing configuration data with high availability and strong consistency guarantees in distributed systems. As of FlagFlow 1.5.0, etcd is optional - you can use filesystem storage instead for simpler deployments.
💡 Recommendation: Start with filesystem storage for initial deployments and migrate to etcd when you need distributed features or real-time synchronization across multiple instances.
version: '3.8'
services:
etcd:
image: bitnami/etcd:3.6.4-debian-12-r2
container_name: flagflow-etcd
environment:
- ETCD_ROOT_PASSWORD=pw_flagflow
# Not needed, because network allows communication between containers
ports:
- "2379:2379"
volumes:
- etcd-data:/bitnami/etcd
networks:
- flagflow-network
# Health check is not mandatory, but recommended in production
healthcheck:
test: ["CMD", "etcdctl", "--user=root:pw_flagflow", "endpoint", "health"]
interval: 15s
timeout: 10s
retries: 2
restart: on-failure
volumes:
etcd-data:
networks:
flagflow-network:
driver: bridgeapiVersion: apps/v1
kind: StatefulSet
metadata:
name: etcd
namespace: flagflow
spec:
serviceName: etcd
replicas: 3
selector:
matchLabels:
app: etcd
template:
metadata:
labels:
app: etcd
spec:
containers:
- name: etcd
image: bitnami/etcd:3.6.4-debian-12-r2
ports:
- containerPort: 2379
name: client
env:
- name: ETCD_ROOT_PASSWORD
value: pw_flagflow
volumeMounts:
- name: etcd-data
mountPath: /var/lib/etcd
# Kubernetes healthchecks for production reliability
livenessProbe:
exec:
command:
- etcdctl
- --user=root:pw_flagflow
- endpoint
- health
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
exec:
command:
- etcdctl
- --user=root:pw_flagflow
- endpoint
- health
initialDelaySeconds: 15
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 2
volumeClaimTemplates:
- metadata:
name: etcd-data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Giwget https://github.com/etcd-io/etcd/releases/download/v3.6.4-debian-12-r2/etcd-v3.6.4-debian-12-r2-linux-amd64.tar.gz tar -xzf etcd-v3.6.4-debian-12-r2-linux-amd64.tar.gz sudo mv etcd-v3.6.4-debian-12-r2-linux-amd64/etcd* /usr/local/bin/
[Unit] Description=etcd key-value store Documentation=https://github.com/etcd-io/etcd After=network.target [Service] Type=notify ExecStart=/usr/local/bin/etcd \ --name etcd-server \ --data-dir=/var/lib/etcd \ --listen-client-urls=http://0.0.0.0:2379 \ --advertise-client-urls=http://localhost:2379 \ --listen-peer-urls=http://0.0.0.0:2380 \ --initial-advertise-peer-urls=http://localhost:2380 \ --initial-cluster=etcd-server=http://localhost:2380 Restart=always RestartSec=10s [Install] WantedBy=multi-user.target
sudo systemctl enable etcd sudo systemctl start etcd
# Test basic connectivity etcdctl --endpoints=http://etcd-server:2379 endpoint health # Check FlagFlow data structure etcdctl --endpoints=http://etcd-server:2379 get --prefix /flagflow/ # Monitor real-time changes (useful for debugging) etcdctl --endpoints=http://etcd-server:2379 watch --prefix /flagflow/
ETCD_SERVER=etcd-server:2379 ETCD_USERNAME=flagflow ETCD_PASSWORD=********** ETCD_NAMESPACE=default