Refactored.
This commit is contained in:
parent
f4a49ad4b9
commit
9dad75464b
37 changed files with 667 additions and 247 deletions
|
|
@ -7,7 +7,7 @@
|
|||
**What You'll Build**:
|
||||
- Single Redis instance on existing worker-1
|
||||
- Password-protected with Docker secrets
|
||||
- Private network communication only (maple-private-prod overlay)
|
||||
- Private network communication only (mapleopentech-private-prod overlay)
|
||||
- Persistent data with AOF + RDB
|
||||
- Ready for Go application connections
|
||||
|
||||
|
|
@ -37,23 +37,23 @@ Docker Swarm Cluster:
|
|||
│
|
||||
├── mapleopentech-swarm-worker-1-prod (10.116.0.3)
|
||||
│ └── Redis (single instance)
|
||||
│ ├── Network: maple-private-prod (overlay, shared)
|
||||
│ ├── Network: mapleopentech-private-prod (overlay, shared)
|
||||
│ ├── Port: 6379 (private only)
|
||||
│ ├── Auth: Password (Docker secret)
|
||||
│ └── Data: Persistent volume
|
||||
│
|
||||
└── mapleopentech-swarm-worker-2,3,4-prod
|
||||
└── Cassandra Cluster (3 nodes)
|
||||
└── Same network: maple-private-prod
|
||||
└── Same network: mapleopentech-private-prod
|
||||
|
||||
Shared Network (maple-private-prod):
|
||||
Shared Network (mapleopentech-private-prod):
|
||||
├── All services can communicate
|
||||
├── Service discovery by name (redis, cassandra-1, etc.)
|
||||
└── No public internet access
|
||||
|
||||
Future Application:
|
||||
└── mapleopentech-swarm-worker-X-prod
|
||||
└── Go Backend → Connects to redis:6379 and cassandra:9042 on maple-private-prod
|
||||
└── Go Backend → Connects to redis:6379 and cassandra:9042 on mapleopentech-private-prod
|
||||
```
|
||||
|
||||
### Redis Configuration
|
||||
|
|
@ -164,7 +164,7 @@ Copy and paste the following:
|
|||
version: '3.8'
|
||||
|
||||
networks:
|
||||
maple-private-prod:
|
||||
mapleopentech-private-prod:
|
||||
external: true
|
||||
|
||||
volumes:
|
||||
|
|
@ -179,7 +179,7 @@ services:
|
|||
image: redis:7-alpine
|
||||
hostname: redis
|
||||
networks:
|
||||
- maple-private-prod
|
||||
- mapleopentech-private-prod
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
secrets:
|
||||
|
|
@ -240,16 +240,16 @@ Save and exit (`:wq` in vi).
|
|||
|
||||
### Step 2: Verify Shared Overlay Network
|
||||
|
||||
**Check if the maple-private-prod network exists:**
|
||||
**Check if the mapleopentech-private-prod network exists:**
|
||||
|
||||
```bash
|
||||
docker network ls | grep maple-private-prod
|
||||
docker network ls | grep mapleopentech-private-prod
|
||||
```
|
||||
|
||||
**You should see:**
|
||||
|
||||
```
|
||||
abc123... maple-private-prod overlay swarm
|
||||
abc123... mapleopentech-private-prod overlay swarm
|
||||
```
|
||||
|
||||
**If you completed 02_cassandra.md** (Step 4), the network already exists and you're good to go!
|
||||
|
|
@ -257,14 +257,14 @@ abc123... maple-private-prod overlay swarm
|
|||
**If the network doesn't exist**, create it now:
|
||||
|
||||
```bash
|
||||
# Create the shared maple-private-prod network
|
||||
# Create the shared mapleopentech-private-prod network
|
||||
docker network create \
|
||||
--driver overlay \
|
||||
--attachable \
|
||||
maple-private-prod
|
||||
mapleopentech-private-prod
|
||||
|
||||
# Verify it was created
|
||||
docker network ls | grep maple-private-prod
|
||||
docker network ls | grep mapleopentech-private-prod
|
||||
```
|
||||
|
||||
**What is this network?**
|
||||
|
|
@ -436,22 +436,22 @@ docker stack deploy -c redis-stack.yml redis
|
|||
|
||||
### Problem: Network Not Found During Deployment
|
||||
|
||||
**Symptom**: `network "maple-private-prod" is declared as external, but could not be found`
|
||||
**Symptom**: `network "mapleopentech-private-prod" is declared as external, but could not be found`
|
||||
|
||||
**Solution:**
|
||||
|
||||
Create the shared `maple-private-prod` network first:
|
||||
Create the shared `mapleopentech-private-prod` network first:
|
||||
|
||||
```bash
|
||||
# Create the network
|
||||
docker network create \
|
||||
--driver overlay \
|
||||
--attachable \
|
||||
maple-private-prod
|
||||
mapleopentech-private-prod
|
||||
|
||||
# Verify it exists
|
||||
docker network ls | grep maple-private-prod
|
||||
# Should show: maple-private-prod overlay swarm
|
||||
docker network ls | grep mapleopentech-private-prod
|
||||
# Should show: mapleopentech-private-prod overlay swarm
|
||||
|
||||
# Then deploy Redis
|
||||
docker stack deploy -c redis-stack.yml redis
|
||||
|
|
@ -487,10 +487,10 @@ docker stack deploy -c redis-stack.yml redis
|
|||
# Must show: map[redis:true]
|
||||
```
|
||||
|
||||
4. **Verify maple-private-prod network exists:**
|
||||
4. **Verify mapleopentech-private-prod network exists:**
|
||||
```bash
|
||||
docker network ls | grep maple-private-prod
|
||||
# Should show: maple-private-prod overlay swarm
|
||||
docker network ls | grep mapleopentech-private-prod
|
||||
# Should show: mapleopentech-private-prod overlay swarm
|
||||
```
|
||||
|
||||
### Problem: Can't Connect (Authentication Failed)
|
||||
|
|
@ -548,9 +548,9 @@ docker stack deploy -c redis-stack.yml redis
|
|||
|
||||
1. **Verify both services on same network:**
|
||||
```bash
|
||||
# Check your app is on maple-private-prod network
|
||||
# Check your app is on mapleopentech-private-prod network
|
||||
docker service inspect your_app --format '{{.Spec.TaskTemplate.Networks}}'
|
||||
# Should show maple-private-prod
|
||||
# Should show mapleopentech-private-prod
|
||||
```
|
||||
|
||||
2. **Test DNS resolution:**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue