Skip to content

Commit bc3687e

Browse files
committed
Change default ports from 8080/8081 to 9670/9671
Updated all documentation, Dockerfiles, compose files, source code, and test scripts to use 9670 for the HTTP API and 9671 for the gossip protocol instead of the previous defaults (8080/8081). This ensures consistency across the project and avoids conflicts with common default ports.
1 parent 15164d6 commit bc3687e

24 files changed

+131
-131
lines changed

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ zig build -Doptimize=ReleaseFast # Optimized release build
1414
## Running the Server
1515

1616
```bash
17-
zig build run -- --port 8080 --data ./data --debug
18-
zig build run -- --join 192.168.1.10:8081 --id node2 # Join existing cluster
17+
zig build run -- --port 9670 --data ./data --debug
18+
zig build run -- --join 192.168.1.10:9671 --id node2 # Join existing cluster
1919
```
2020

2121
Key flags: `--port`, `--gossip-port`, `--data`, `--id`, `--join`, `--threads`, `--vnodes`, `--debug`

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ COPY --from=builder /build/zig-out/bin/z4 /app/z4
2323

2424
RUN mkdir /app/data
2525
VOLUME /app/data
26-
EXPOSE 8080 8081
26+
EXPOSE 9670 9671
2727

2828
CMD ["/app/z4", "server"]

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ services:
9595
z4:
9696
build: .
9797
ports:
98-
- "8080:8080" # S3 API
99-
- "8081:8081" # Gossip protocol
98+
- "9670:9670" # S3 API
99+
- "9671:9671" # Gossip protocol
100100
volumes:
101101
- ./data:/app/data
102102
environment:
@@ -138,8 +138,8 @@ Z4 includes a built-in CLI for administration.
138138

139139
| Option | Default | Description |
140140
|--------|---------|-------------|
141-
| `--port` | 8080 | HTTP API port |
142-
| `--gossip-port` | 8081 | Cluster gossip port (UDP) |
141+
| `--port` | 9670 | HTTP API port |
142+
| `--gossip-port` | 9671 | Cluster gossip port (UDP) |
143143
| `--data` | data | Storage directory |
144144
| `--id` | node1 | Unique node identifier |
145145
| `--join` | - | Seed node address (host:port) |
@@ -163,8 +163,8 @@ After creating a key via CLI:
163163
aws configure set aws_access_key_id <YOUR_ACCESS_KEY_ID>
164164
aws configure set aws_secret_access_key <YOUR_SECRET_KEY>
165165
166-
aws --endpoint-url http://localhost:8080 s3 cp file.txt s3://mybucket/
167-
aws --endpoint-url http://localhost:8080 s3 ls s3://mybucket/
166+
aws --endpoint-url http://localhost:9670 s3 cp file.txt s3://mybucket/
167+
aws --endpoint-url http://localhost:9670 s3 ls s3://mybucket/
168168
```
169169

170170
## Architecture

docker-compose.cluster.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ services:
33
build: .
44
container_name: z4-node1
55
ports:
6-
- "8080:8080"
7-
- "8081:8081"
6+
- "9670:9670"
7+
- "9671:9671"
88
volumes:
99
- ./data/node1:/app/data
1010
environment:
1111
- Z4_ENCRYPTION_KEY=${Z4_ENCRYPTION_KEY:-}
12-
command: ["/app/z4", "server", "--id", "node1", "--port", "8080", "--gossip-port", "8081"]
12+
command: ["/app/z4", "server", "--id", "node1", "--port", "9670", "--gossip-port", "9671"]
1313
networks:
1414
- z4net
1515
restart: unless-stopped
@@ -18,13 +18,13 @@ services:
1818
build: .
1919
container_name: z4-node2
2020
ports:
21-
- "8082:8080"
22-
- "8083:8081"
21+
- "8082:9670"
22+
- "8083:9671"
2323
volumes:
2424
- ./data/node2:/app/data
2525
environment:
2626
- Z4_ENCRYPTION_KEY=${Z4_ENCRYPTION_KEY:-}
27-
command: ["/app/z4", "server", "--id", "node2", "--port", "8080", "--gossip-port", "8081", "--join", "z4-node1:8081"]
27+
command: ["/app/z4", "server", "--id", "node2", "--port", "9670", "--gossip-port", "9671", "--join", "z4-node1:9671"]
2828
depends_on:
2929
- z4-node1
3030
networks:
@@ -35,13 +35,13 @@ services:
3535
build: .
3636
container_name: z4-node3
3737
ports:
38-
- "8084:8080"
39-
- "8085:8081"
38+
- "8084:9670"
39+
- "8085:9671"
4040
volumes:
4141
- ./data/node3:/app/data
4242
environment:
4343
- Z4_ENCRYPTION_KEY=${Z4_ENCRYPTION_KEY:-}
44-
command: ["/app/z4", "server", "--id", "node3", "--port", "8080", "--gossip-port", "8081", "--join", "z4-node1:8081"]
44+
command: ["/app/z4", "server", "--id", "node3", "--port", "9670", "--gossip-port", "9671", "--join", "z4-node1:9671"]
4545
depends_on:
4646
- z4-node1
4747
networks:

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ services:
22
z4:
33
build: .
44
ports:
5-
- "8080:8080"
6-
- "8081:8081"
5+
- "9670:9670"
6+
- "9671:9671"
77
volumes:
88
- ./data:/app/data
99
environment:
1010
- Z4_ENCRYPTION_KEY=${Z4_ENCRYPTION_KEY:-}
11-
command: ["/app/z4", "server", "--port", "8080", "--gossip-port", "8081", "--data", "/app/data"]
11+
command: ["/app/z4", "server", "--port", "9670", "--gossip-port", "9671", "--data", "/app/data"]
1212
restart: always

src/constants.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ pub const MIN_BUCKET_NAME_LENGTH: usize = 3;
1414
pub const MAX_REQUEST_LINE_LENGTH: usize = 8192;
1515
pub const LIST_OBJECTS_MAX_KEYS: usize = 1000;
1616

17-
pub const DEFAULT_HTTP_PORT: u16 = 8080;
18-
pub const DEFAULT_GOSSIP_PORT: u16 = 8081;
17+
pub const DEFAULT_HTTP_PORT: u16 = 9670;
18+
pub const DEFAULT_GOSSIP_PORT: u16 = 9671;
1919
pub const DEFAULT_DATA_PATH = "data";
2020
pub const DEFAULT_NODE_ID = "node1";
2121
pub const DEFAULT_OWNER_ID = "z4-owner";

src/main.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ fn printHelp() void {
391391
\\ help Show this help message
392392
\\
393393
\\SERVER OPTIONS:
394-
\\ --port <port> HTTP port (default: 8080)
395-
\\ --gossip-port <port> Gossip port (default: 8081)
394+
\\ --port <port> HTTP port (default: 9670)
395+
\\ --gossip-port <port> Gossip port (default: 9671)
396396
\\ --data <path> Data directory (default: data)
397397
\\ --id <id> Node ID (default: node1)
398398
\\ --join <host:port> Join existing cluster
@@ -407,7 +407,7 @@ fn printHelp() void {
407407
\\ --owner Grant owner access (full control)
408408
\\
409409
\\EXAMPLES:
410-
\\ z4 server --port 8080 --data ./data
410+
\\ z4 server --port 9670 --data ./data
411411
\\ z4 key create admin
412412
\\ z4 bucket create mybucket
413413
\\ z4 bucket allow mybucket --key admin --read --write
@@ -487,7 +487,7 @@ fn runServer(allocator: std.mem.Allocator, args: []const []const u8) !void {
487487
if (join_addr) |addr| {
488488
var iter = std.mem.splitScalar(u8, addr, ':');
489489
const host = iter.next() orelse "127.0.0.1";
490-
const p_str = iter.next() orelse "8081";
490+
const p_str = iter.next() orelse "9671";
491491
const p = try std.fmt.parseInt(u16, p_str, 10);
492492
try gossip.joinCluster(host, p);
493493
}

src/server.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ pub const Server = struct {
634634
var xml_buffer = std.ArrayList(u8){};
635635
defer xml_buffer.deinit(self.allocator);
636636

637-
const location = std.fmt.allocPrint(self.allocator, "http://localhost:8080/{s}/{s}", .{ bucket, key }) catch return;
637+
const location = std.fmt.allocPrint(self.allocator, "http://localhost:9670/{s}/{s}", .{ bucket, key }) catch return;
638638
defer self.allocator.free(location);
639639

640640
s3.writeCompleteMultipartUploadResult(self.allocator, xml_buffer.writer(self.allocator), location, bucket, key, etag) catch {

tests/stress_memory.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub fn main() !void {
99
const args = try std.process.argsAlloc(allocator);
1010
defer std.process.argsFree(allocator, args);
1111

12-
var endpoint: []const u8 = "http://127.0.0.1:8080";
12+
var endpoint: []const u8 = "http://127.0.0.1:9670";
1313
var concurrency: usize = 20;
1414
var size_mb: u64 = 100;
1515

@@ -72,7 +72,7 @@ fn worker(allocator: std.mem.Allocator, endpoint_str: []const u8, size_mb: u64,
7272
return;
7373
};
7474
const hostname = if (uri.host) |h| h.percent_encoded else "localhost";
75-
const port = uri.port orelse 8080;
75+
const port = uri.port orelse 9670;
7676

7777
const peer = std.net.Address.parseIp(hostname, port) catch |e| {
7878
std.debug.print("IP Parse Error (host={s}): {}\n", .{ hostname, e });

tests/test_aws_cli.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ docker rm -f z4-aws-test 2>/dev/null || true
99

1010
echo "Starting Docker container with encryption enabled..."
1111
docker build -t z4:latest .
12-
docker run -d --name z4-aws-test -p 8080:8080 \
12+
docker run -d --name z4-aws-test -p 9670:9670 \
1313
-e Z4_ENCRYPTION_KEY=my-32-byte-encryption-key-here! \
1414
-v $(pwd)/data:/app/data z4:latest /app/z4 server
1515

1616
echo "Waiting for service..."
1717
for i in {1..30}; do
18-
if curl -s http://localhost:8080/ > /dev/null; then
18+
if curl -s http://localhost:9670/ > /dev/null; then
1919
echo "Service is up!"
2020
break
2121
fi
@@ -37,21 +37,21 @@ echo "============================================="
3737

3838
echo ""
3939
echo "1. Create bucket..."
40-
aws s3api create-bucket --bucket aws-test-bucket --endpoint-url http://localhost:8080 2>&1 || echo "Bucket exists or created"
40+
aws s3api create-bucket --bucket aws-test-bucket --endpoint-url http://localhost:9670 2>&1 || echo "Bucket exists or created"
4141

4242
echo ""
4343
echo "2. List buckets..."
44-
aws s3api list-buckets --endpoint-url http://localhost:8080
44+
aws s3api list-buckets --endpoint-url http://localhost:9670
4545

4646
echo ""
4747
echo "3. Put object..."
4848
echo "Hello from AWS CLI" > /tmp/test-file.txt
49-
aws s3api put-object --bucket aws-test-bucket --key test-awscli.txt --body /tmp/test-file.txt --endpoint-url http://localhost:8080
49+
aws s3api put-object --bucket aws-test-bucket --key test-awscli.txt --body /tmp/test-file.txt --endpoint-url http://localhost:9670
5050
echo "SUCCESS: Put object"
5151

5252
echo ""
5353
echo "4. Get object..."
54-
aws s3api get-object --bucket aws-test-bucket --key test-awscli.txt /tmp/retrieved.txt --endpoint-url http://localhost:8080
54+
aws s3api get-object --bucket aws-test-bucket --key test-awscli.txt /tmp/retrieved.txt --endpoint-url http://localhost:9670
5555
cat /tmp/retrieved.txt
5656
if grep -q "AWS CLI" /tmp/retrieved.txt; then
5757
echo "SUCCESS: Get object content matches"
@@ -61,16 +61,16 @@ fi
6161

6262
echo ""
6363
echo "5. Head object..."
64-
aws s3api head-object --bucket aws-test-bucket --key test-awscli.txt --endpoint-url http://localhost:8080
64+
aws s3api head-object --bucket aws-test-bucket --key test-awscli.txt --endpoint-url http://localhost:9670
6565

6666
echo ""
6767
echo "6. Put bucket versioning..."
68-
aws s3api put-bucket-versioning --bucket aws-test-bucket --versioning-configuration Status=Enabled --endpoint-url http://localhost:8080
68+
aws s3api put-bucket-versioning --bucket aws-test-bucket --versioning-configuration Status=Enabled --endpoint-url http://localhost:9670
6969
echo "SUCCESS: Enabled versioning"
7070

7171
echo ""
7272
echo "7. Get bucket versioning..."
73-
aws s3api get-bucket-versioning --bucket aws-test-bucket --endpoint-url http://localhost:8080
73+
aws s3api get-bucket-versioning --bucket aws-test-bucket --endpoint-url http://localhost:9670
7474

7575
echo ""
7676
echo "8. Put bucket lifecycle..."
@@ -90,11 +90,11 @@ cat > /tmp/lifecycle.json << 'EOF'
9090
]
9191
}
9292
EOF
93-
aws s3api put-bucket-lifecycle-configuration --bucket aws-test-bucket --lifecycle-configuration file:///tmp/lifecycle.json --endpoint-url http://localhost:8080 2>&1 || echo "Lifecycle set or format issue"
93+
aws s3api put-bucket-lifecycle-configuration --bucket aws-test-bucket --lifecycle-configuration file:///tmp/lifecycle.json --endpoint-url http://localhost:9670 2>&1 || echo "Lifecycle set or format issue"
9494

9595
echo ""
9696
echo "9. Delete object..."
97-
aws s3api delete-object --bucket aws-test-bucket --key test-awscli.txt --endpoint-url http://localhost:8080
97+
aws s3api delete-object --bucket aws-test-bucket --key test-awscli.txt --endpoint-url http://localhost:9670
9898
echo "SUCCESS: Delete object"
9999

100100
echo ""

0 commit comments

Comments
 (0)