Skip to content

Commit 28cfd6e

Browse files
committed
docs: add docs/deployment.md
1 parent 7a1f0fd commit 28cfd6e

1 file changed

Lines changed: 286 additions & 0 deletions

File tree

docs/deployment.md

Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
---
2+
title: Deployment
3+
layout: default
4+
nav_order: 5
5+
---
6+
7+
# Deployment Guide
8+
{: .no_toc }
9+
10+
## Table of Contents
11+
{: .no_toc .text-delta }
12+
13+
1. TOC
14+
{:toc}
15+
16+
---
17+
18+
## Docker (Single Node)
19+
20+
```bash
21+
docker run -d \
22+
--name eseilane \
23+
--restart unless-stopped \
24+
-p 6379:6379 \
25+
-p 3000:3000 \
26+
-v $(pwd)/data:/data \
27+
-e ESEILANE_REQUIREPASS=your-strong-password \
28+
-e ESEILANE_MAX_MEMORY=4gb \
29+
eseilane/eseilane:latest
30+
```
31+
32+
---
33+
34+
## Docker Compose (Production)
35+
36+
```yaml
37+
version: "3.9"
38+
39+
services:
40+
eseilane:
41+
image: eseilane/eseilane:latest
42+
restart: unless-stopped
43+
ports:
44+
- "127.0.0.1:6379:6379" # Bind only to localhost
45+
- "3000:3000"
46+
volumes:
47+
- eseilane-data:/data
48+
- ./eseilane.conf:/etc/eseilane/eseilane.conf
49+
environment:
50+
- ESEILANE_REQUIREPASS=${ESEILANE_PASSWORD}
51+
- ESEILANE_MAX_MEMORY=4gb
52+
- ESEILANE_MAX_MEMORY_POLICY=noeviction
53+
- ESEILANE_APPENDONLY=yes
54+
- ESEILANE_LOGLEVEL=notice
55+
healthcheck:
56+
test: ["CMD", "eseilane-cli", "ping"]
57+
interval: 30s
58+
timeout: 10s
59+
retries: 3
60+
deploy:
61+
resources:
62+
limits:
63+
memory: 5G
64+
65+
nginx:
66+
image: nginx:alpine
67+
restart: unless-stopped
68+
ports:
69+
- "80:80"
70+
- "443:443"
71+
volumes:
72+
- ./nginx.conf:/etc/nginx/conf.d/default.conf
73+
- /etc/letsencrypt:/etc/letsencrypt:ro
74+
depends_on:
75+
- eseilane
76+
77+
volumes:
78+
eseilane-data:
79+
```
80+
81+
---
82+
83+
## Kubernetes
84+
85+
```yaml
86+
apiVersion: apps/v1
87+
kind: StatefulSet
88+
metadata:
89+
name: eseilane
90+
namespace: eseilane
91+
spec:
92+
serviceName: eseilane
93+
replicas: 1
94+
selector:
95+
matchLabels:
96+
app: eseilane
97+
template:
98+
metadata:
99+
labels:
100+
app: eseilane
101+
spec:
102+
containers:
103+
- name: eseilane
104+
image: eseilane/eseilane:latest
105+
ports:
106+
- containerPort: 6379
107+
name: client
108+
- containerPort: 3000
109+
name: ui
110+
env:
111+
- name: ESEILANE_REQUIREPASS
112+
valueFrom:
113+
secretKeyRef:
114+
name: eseilane-secret
115+
key: password
116+
- name: ESEILANE_MAX_MEMORY
117+
value: "4gb"
118+
volumeMounts:
119+
- name: data
120+
mountPath: /data
121+
resources:
122+
requests:
123+
memory: "2Gi"
124+
cpu: "500m"
125+
limits:
126+
memory: "5Gi"
127+
cpu: "2000m"
128+
livenessProbe:
129+
exec:
130+
command: ["eseilane-cli", "ping"]
131+
initialDelaySeconds: 30
132+
periodSeconds: 10
133+
readinessProbe:
134+
exec:
135+
command: ["eseilane-cli", "ping"]
136+
initialDelaySeconds: 5
137+
periodSeconds: 5
138+
volumeClaimTemplates:
139+
- metadata:
140+
name: data
141+
spec:
142+
accessModes: ["ReadWriteOnce"]
143+
storageClassName: "fast-ssd"
144+
resources:
145+
requests:
146+
storage: 50Gi
147+
---
148+
apiVersion: v1
149+
kind: Service
150+
metadata:
151+
name: eseilane
152+
namespace: eseilane
153+
spec:
154+
selector:
155+
app: eseilane
156+
ports:
157+
- name: client
158+
port: 6379
159+
targetPort: 6379
160+
- name: ui
161+
port: 3000
162+
targetPort: 3000
163+
type: ClusterIP
164+
```
165+
166+
---
167+
168+
## AWS (ECS + Fargate)
169+
170+
```json
171+
{
172+
"family": "eseilane",
173+
"networkMode": "awsvpc",
174+
"requiresCompatibilities": ["FARGATE"],
175+
"cpu": "2048",
176+
"memory": "5120",
177+
"containerDefinitions": [
178+
{
179+
"name": "eseilane",
180+
"image": "eseilane/eseilane:latest",
181+
"portMappings": [
182+
{ "containerPort": 6379, "protocol": "tcp" },
183+
{ "containerPort": 3000, "protocol": "tcp" }
184+
],
185+
"environment": [
186+
{ "name": "ESEILANE_MAX_MEMORY", "value": "4gb" },
187+
{ "name": "ESEILANE_APPENDONLY", "value": "yes" }
188+
],
189+
"secrets": [
190+
{
191+
"name": "ESEILANE_REQUIREPASS",
192+
"valueFrom": "arn:aws:secretsmanager:us-east-1:123456789:secret:eseilane-password"
193+
}
194+
],
195+
"mountPoints": [
196+
{ "sourceVolume": "data", "containerPath": "/data" }
197+
],
198+
"logConfiguration": {
199+
"logDriver": "awslogs",
200+
"options": {
201+
"awslogs-group": "/ecs/eseilane",
202+
"awslogs-region": "us-east-1",
203+
"awslogs-stream-prefix": "ecs"
204+
}
205+
}
206+
}
207+
]
208+
}
209+
```
210+
211+
---
212+
213+
## Security Hardening
214+
215+
{: .important }
216+
Always follow these steps in production.
217+
218+
1. **Enable authentication:**
219+
```bash
220+
ESEILANE_REQUIREPASS=use-a-long-random-password-here
221+
```
222+
223+
2. **Bind to localhost only** — use a reverse proxy (nginx/Traefik) for TLS termination:
224+
```bash
225+
ESEILANE_BIND=127.0.0.1
226+
```
227+
228+
3. **Enable TLS** for connections from the network:
229+
```bash
230+
ESEILANE_TLS_PORT=6380
231+
ESEILANE_TLS_CERT_FILE=/certs/server.crt
232+
ESEILANE_TLS_KEY_FILE=/certs/server.key
233+
```
234+
235+
4. **Disable dangerous commands:**
236+
```bash
237+
ESEILANE_RENAME_COMMAND_CONFIG="CONFIG \"\""
238+
ESEILANE_RENAME_COMMAND_DEBUG="DEBUG \"\""
239+
ESEILANE_RENAME_COMMAND_FLUSHALL="FLUSHALL \"\""
240+
```
241+
242+
5. **Run as non-root user** in Docker:
243+
```dockerfile
244+
USER eseilane
245+
```
246+
247+
---
248+
249+
## Backup & Restore
250+
251+
```bash
252+
# Create a snapshot
253+
docker exec eseilane eseilane-cli BGSAVE
254+
255+
# Copy snapshot
256+
docker cp eseilane:/data/dump.rdb ./backups/dump-$(date +%Y%m%d).rdb
257+
258+
# Restore from snapshot
259+
docker cp ./backups/dump-20260623.rdb eseilane:/data/dump.rdb
260+
docker restart eseilane
261+
```
262+
263+
---
264+
265+
## Monitoring
266+
267+
ESEILANE exposes metrics compatible with **Prometheus** via the exporter:
268+
269+
```bash
270+
docker run -d \
271+
--name eseilane-exporter \
272+
-p 9121:9121 \
273+
-e ESEILANE_ADDR=eseilane:6379 \
274+
-e ESEILANE_PASSWORD=your-password \
275+
eseilane/exporter:latest
276+
```
277+
278+
Key metrics to monitor:
279+
280+
| Metric | Alert Threshold | Description |
281+
|---|---|---|
282+
| `eseilane_memory_used_bytes` | > 80% of max | Memory usage |
283+
| `eseilane_connected_clients` | > 1000 | Active connections |
284+
| `eseilane_command_duration_seconds` | p99 > 100ms | Query latency |
285+
| `eseilane_rejected_connections_total` | > 0 | Connection rejections |
286+
| `eseilane_rdb_last_save_time` | > 1h ago | Last successful backup |

0 commit comments

Comments
 (0)