Merge pull request #30 from DeBrosOfficial/port-change

Updated Gateway port from 8080/8005 to 6001 - Added Gateway port on
This commit is contained in:
anonpenguin 2025-09-20 08:18:47 +03:00 committed by GitHub
commit 5da956ab9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 25 additions and 19 deletions

View File

@ -10,7 +10,7 @@
"mode": "debug",
"program": "./cmd/gateway",
"env": {
"GATEWAY_ADDR": ":8080",
"GATEWAY_ADDR": ":6001",
"GATEWAY_BOOTSTRAP_PEERS": "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWSHHwEY6cga3ng7tD1rzStAU58ogQXVMX3LZJ6Gqf6dee",
"GATEWAY_NAMESPACE": "default",
"GATEWAY_API_KEY": "ak_iGustrsFk9H8uXpwczCATe5U:default"
@ -30,12 +30,12 @@
},
{
"adapter": "Delve",
"label": "Gateway Go 8005 Port (Delve)",
"label": "Gateway Go 6001 Port (Delve)",
"request": "launch",
"mode": "debug",
"program": "./cmd/gateway",
"env": {
"GATEWAY_ADDR": ":8005",
"GATEWAY_ADDR": ":6001",
"GATEWAY_BOOTSTRAP_PEERS": "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWSHHwEY6cga3ng7tD1rzStAU58ogQXVMX3LZJ6Gqf6dee",
"GATEWAY_NAMESPACE": "default",
"GATEWAY_API_KEY": "ak_iGustrsFk9H8uXpwczCATe5U:default"

View File

@ -8,8 +8,12 @@ The format is based on [Keep a Changelog][keepachangelog] and adheres to [Semant
### Added
- Added Gateway port on install-debros-network.sh
### Changed
- Updated Gateway port from 8080/8005 to 6001
### Deprecated
### Removed

View File

@ -7,12 +7,12 @@ test:
# Gateway-focused E2E tests assume gateway and nodes are already running
# Configure via env:
# GATEWAY_BASE_URL (default http://127.0.0.1:8080)
# GATEWAY_BASE_URL (default http://127.0.0.1:6001)
# GATEWAY_API_KEY (required for auth-protected routes)
.PHONY: test-e2e
test-e2e:
@echo "Running gateway E2E tests (HTTP/WS only)..."
@echo "Base URL: $${GATEWAY_BASE_URL:-http://127.0.0.1:8080}"
@echo "Base URL: $${GATEWAY_BASE_URL:-http://127.0.0.1:6001}"
@test -n "$$GATEWAY_API_KEY" || (echo "GATEWAY_API_KEY must be set" && exit 1)
go test -v -tags e2e ./e2e
@ -21,7 +21,7 @@ test-e2e:
.PHONY: build clean test run-node run-node2 run-node3 run-example deps tidy fmt vet lint clear-ports
VERSION := 0.42.4-beta
VERSION := 0.42.5-beta
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -X 'main.version=$(VERSION)' -X 'main.commit=$(COMMIT)' -X 'main.date=$(DATE)'

View File

@ -379,7 +379,7 @@ The gateway can be configured via environment variables:
```bash
# Basic Configuration
export GATEWAY_ADDR="0.0.0.0:8080"
export GATEWAY_ADDR="0.0.0.0:6001"
export GATEWAY_NAMESPACE="my-app"
export GATEWAY_BOOTSTRAP_PEERS="/ip4/127.0.0.1/tcp/4001/p2p/YOUR_PEER_ID"
@ -533,11 +533,11 @@ resp, err := http.DefaultClient.Do(req)
#### Wallet Authentication Flow
```bash
# 1. Get challenge (automatic)
curl -X POST http://localhost:8080/v1/auth/challenge
curl -X POST http://localhost:6001/v1/auth/challenge
# 2. Sign challenge with wallet (handled by client)
# 3. Verify signature (automatic)
curl -X POST http://localhost:8080/v1/auth/verify \
curl -X POST http://localhost:6001/v1/auth/verify \
-H "Content-Type: application/json" \
-d '{"wallet":"0x...","nonce":"...","signature":"0x..."}'
```
@ -547,7 +547,7 @@ curl -X POST http://localhost:8080/v1/auth/verify \
#### Real-time Messaging
```javascript
// WebSocket connection
const ws = new WebSocket('ws://localhost:8080/v1/pubsub/ws?topic=chat');
const ws = new WebSocket('ws://localhost:6001/v1/pubsub/ws?topic=chat');
ws.onmessage = (event) => {
console.log('Received:', event.data);
@ -661,8 +661,8 @@ export LOG_LEVEL=debug
./bin/network-cli pubsub subscribe test 10s
# Gateway health checks
curl http://localhost:8080/health
curl http://localhost:8080/v1/status
curl http://localhost:6001/health
curl http://localhost:6001/v1/status
```
### Service Logs

View File

@ -39,7 +39,7 @@ func getEnvBoolDefault(key string, def bool) bool {
// parseGatewayConfig parses flags and environment variables into GatewayConfig.
// Priority: flags > env > defaults.
func parseGatewayConfig(logger *logging.ColoredLogger) *gateway.Config {
addr := flag.String("addr", getEnvDefault("GATEWAY_ADDR", ":8080"), "HTTP listen address (e.g., :8080)")
addr := flag.String("addr", getEnvDefault("GATEWAY_ADDR", ":6001"), "HTTP listen address (e.g., :6001)")
ns := flag.String("namespace", getEnvDefault("GATEWAY_NAMESPACE", "default"), "Client namespace for scoping resources")
peers := flag.String("bootstrap-peers", getEnvDefault("GATEWAY_BOOTSTRAP_PEERS", ""), "Comma-separated bootstrap peers for network client")

View File

@ -34,7 +34,7 @@ func requireAPIKey(t *testing.T) string {
}
func gatewayBaseURL() string {
return getEnv("GATEWAY_BASE_URL", "http://127.0.0.1:8080")
return getEnv("GATEWAY_BASE_URL", "http://127.0.0.1:6001")
}
func httpClient() *http.Client {

View File

@ -6,7 +6,7 @@ Usage:
```bash
npm i
export GATEWAY_BASE_URL=http://127.0.0.1:8080
export GATEWAY_BASE_URL=http://127.0.0.1:6001
export GATEWAY_API_KEY=your_api_key
```

View File

@ -4,7 +4,7 @@ info:
version: 0.40.0
description: REST API over the DeBros Network client for storage, database, and pubsub.
servers:
- url: http://localhost:8080
- url: http://localhost:6001
security:
- ApiKeyAuth: []
- BearerAuth: []

View File

@ -173,7 +173,7 @@ func GetDefaultGatewayURL() string {
if envURL := os.Getenv("DEBROS_GATEWAY"); envURL != "" {
return envURL
}
return "http://localhost:8005"
return "http://localhost:6001"
}
// HasValidCredentials checks if there are valid credentials for the default gateway

View File

@ -21,6 +21,7 @@ REPO_URL="https://github.com/DeBrosOfficial/network.git"
MIN_GO_VERSION="1.21"
NODE_PORT="4001"
RQLITE_PORT="5001"
GATEWAY_PORT="6001"
RAFT_PORT="7001"
UPDATE_MODE=false
NON_INTERACTIVE=false
@ -249,7 +250,7 @@ install_rqlite() {
}
check_ports() {
local ports=($NODE_PORT $RQLITE_PORT $RAFT_PORT)
local ports=($NODE_PORT $RQLITE_PORT $RAFT_PORT $GATEWAY_PORT)
for port in "${ports[@]}"; do
if sudo netstat -tuln 2>/dev/null | grep -q ":$port " || ss -tuln 2>/dev/null | grep -q ":$port "; then
error "Port $port is already in use. Please free it up and try again."
@ -427,7 +428,7 @@ configure_firewall() {
log "Configuring firewall rules..."
if command -v ufw &> /dev/null; then
log "Adding UFW rules for DeBros Network ports..."
for port in $NODE_PORT $RQLITE_PORT $RAFT_PORT; do
for port in $NODE_PORT $RQLITE_PORT $RAFT_PORT $GATEWAY_PORT; do
if ! sudo ufw allow $port; then
error "Failed to allow port $port"
exit 1
@ -562,6 +563,7 @@ main() {
log "${GREEN}Node Port:${NOCOLOR} ${CYAN}$NODE_PORT${NOCOLOR}"
log "${GREEN}RQLite Port:${NOCOLOR} ${CYAN}$RQLITE_PORT${NOCOLOR}"
log "${GREEN}Raft Port:${NOCOLOR} ${CYAN}$RAFT_PORT${NOCOLOR}"
log "${GREEN}Gateway Port:${NOCOLOR} ${CYAN}$GATEWAY_PORT${NOCOLOR}"
log "${BLUE}==================================================${NOCOLOR}"
log "${GREEN}Management Commands:${NOCOLOR}"
log "${CYAN} - sudo systemctl status debros-node${NOCOLOR} (Check status)"