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", "mode": "debug",
"program": "./cmd/gateway", "program": "./cmd/gateway",
"env": { "env": {
"GATEWAY_ADDR": ":8080", "GATEWAY_ADDR": ":6001",
"GATEWAY_BOOTSTRAP_PEERS": "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWSHHwEY6cga3ng7tD1rzStAU58ogQXVMX3LZJ6Gqf6dee", "GATEWAY_BOOTSTRAP_PEERS": "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWSHHwEY6cga3ng7tD1rzStAU58ogQXVMX3LZJ6Gqf6dee",
"GATEWAY_NAMESPACE": "default", "GATEWAY_NAMESPACE": "default",
"GATEWAY_API_KEY": "ak_iGustrsFk9H8uXpwczCATe5U:default" "GATEWAY_API_KEY": "ak_iGustrsFk9H8uXpwczCATe5U:default"
@ -30,12 +30,12 @@
}, },
{ {
"adapter": "Delve", "adapter": "Delve",
"label": "Gateway Go 8005 Port (Delve)", "label": "Gateway Go 6001 Port (Delve)",
"request": "launch", "request": "launch",
"mode": "debug", "mode": "debug",
"program": "./cmd/gateway", "program": "./cmd/gateway",
"env": { "env": {
"GATEWAY_ADDR": ":8005", "GATEWAY_ADDR": ":6001",
"GATEWAY_BOOTSTRAP_PEERS": "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWSHHwEY6cga3ng7tD1rzStAU58ogQXVMX3LZJ6Gqf6dee", "GATEWAY_BOOTSTRAP_PEERS": "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWSHHwEY6cga3ng7tD1rzStAU58ogQXVMX3LZJ6Gqf6dee",
"GATEWAY_NAMESPACE": "default", "GATEWAY_NAMESPACE": "default",
"GATEWAY_API_KEY": "ak_iGustrsFk9H8uXpwczCATe5U: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
- Added Gateway port on install-debros-network.sh
### Changed ### Changed
- Updated Gateway port from 8080/8005 to 6001
### Deprecated ### Deprecated
### Removed ### Removed

View File

@ -7,12 +7,12 @@ test:
# Gateway-focused E2E tests assume gateway and nodes are already running # Gateway-focused E2E tests assume gateway and nodes are already running
# Configure via env: # 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) # GATEWAY_API_KEY (required for auth-protected routes)
.PHONY: test-e2e .PHONY: test-e2e
test-e2e: test-e2e:
@echo "Running gateway E2E tests (HTTP/WS only)..." @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) @test -n "$$GATEWAY_API_KEY" || (echo "GATEWAY_API_KEY must be set" && exit 1)
go test -v -tags e2e ./e2e 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 .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) COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ) DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -X 'main.version=$(VERSION)' -X 'main.commit=$(COMMIT)' -X 'main.date=$(DATE)' 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 ```bash
# Basic Configuration # 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_NAMESPACE="my-app"
export GATEWAY_BOOTSTRAP_PEERS="/ip4/127.0.0.1/tcp/4001/p2p/YOUR_PEER_ID" 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 #### Wallet Authentication Flow
```bash ```bash
# 1. Get challenge (automatic) # 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) # 2. Sign challenge with wallet (handled by client)
# 3. Verify signature (automatic) # 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" \ -H "Content-Type: application/json" \
-d '{"wallet":"0x...","nonce":"...","signature":"0x..."}' -d '{"wallet":"0x...","nonce":"...","signature":"0x..."}'
``` ```
@ -547,7 +547,7 @@ curl -X POST http://localhost:8080/v1/auth/verify \
#### Real-time Messaging #### Real-time Messaging
```javascript ```javascript
// WebSocket connection // 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) => { ws.onmessage = (event) => {
console.log('Received:', event.data); console.log('Received:', event.data);
@ -661,8 +661,8 @@ export LOG_LEVEL=debug
./bin/network-cli pubsub subscribe test 10s ./bin/network-cli pubsub subscribe test 10s
# Gateway health checks # Gateway health checks
curl http://localhost:8080/health curl http://localhost:6001/health
curl http://localhost:8080/v1/status curl http://localhost:6001/v1/status
``` ```
### Service Logs ### Service Logs

View File

@ -39,7 +39,7 @@ func getEnvBoolDefault(key string, def bool) bool {
// parseGatewayConfig parses flags and environment variables into GatewayConfig. // parseGatewayConfig parses flags and environment variables into GatewayConfig.
// Priority: flags > env > defaults. // Priority: flags > env > defaults.
func parseGatewayConfig(logger *logging.ColoredLogger) *gateway.Config { 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") 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") 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 { 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 { func httpClient() *http.Client {

View File

@ -6,7 +6,7 @@ Usage:
```bash ```bash
npm i 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 export GATEWAY_API_KEY=your_api_key
``` ```

View File

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

View File

@ -173,7 +173,7 @@ func GetDefaultGatewayURL() string {
if envURL := os.Getenv("DEBROS_GATEWAY"); envURL != "" { if envURL := os.Getenv("DEBROS_GATEWAY"); envURL != "" {
return envURL return envURL
} }
return "http://localhost:8005" return "http://localhost:6001"
} }
// HasValidCredentials checks if there are valid credentials for the default gateway // 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" MIN_GO_VERSION="1.21"
NODE_PORT="4001" NODE_PORT="4001"
RQLITE_PORT="5001" RQLITE_PORT="5001"
GATEWAY_PORT="6001"
RAFT_PORT="7001" RAFT_PORT="7001"
UPDATE_MODE=false UPDATE_MODE=false
NON_INTERACTIVE=false NON_INTERACTIVE=false
@ -249,7 +250,7 @@ install_rqlite() {
} }
check_ports() { 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 for port in "${ports[@]}"; do
if sudo netstat -tuln 2>/dev/null | grep -q ":$port " || ss -tuln 2>/dev/null | grep -q ":$port "; then 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." error "Port $port is already in use. Please free it up and try again."
@ -427,7 +428,7 @@ configure_firewall() {
log "Configuring firewall rules..." log "Configuring firewall rules..."
if command -v ufw &> /dev/null; then if command -v ufw &> /dev/null; then
log "Adding UFW rules for DeBros Network ports..." 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 if ! sudo ufw allow $port; then
error "Failed to allow port $port" error "Failed to allow port $port"
exit 1 exit 1
@ -562,6 +563,7 @@ main() {
log "${GREEN}Node Port:${NOCOLOR} ${CYAN}$NODE_PORT${NOCOLOR}" log "${GREEN}Node Port:${NOCOLOR} ${CYAN}$NODE_PORT${NOCOLOR}"
log "${GREEN}RQLite Port:${NOCOLOR} ${CYAN}$RQLITE_PORT${NOCOLOR}" log "${GREEN}RQLite Port:${NOCOLOR} ${CYAN}$RQLITE_PORT${NOCOLOR}"
log "${GREEN}Raft Port:${NOCOLOR} ${CYAN}$RAFT_PORT${NOCOLOR}" log "${GREEN}Raft Port:${NOCOLOR} ${CYAN}$RAFT_PORT${NOCOLOR}"
log "${GREEN}Gateway Port:${NOCOLOR} ${CYAN}$GATEWAY_PORT${NOCOLOR}"
log "${BLUE}==================================================${NOCOLOR}" log "${BLUE}==================================================${NOCOLOR}"
log "${GREEN}Management Commands:${NOCOLOR}" log "${GREEN}Management Commands:${NOCOLOR}"
log "${CYAN} - sudo systemctl status debros-node${NOCOLOR} (Check status)" log "${CYAN} - sudo systemctl status debros-node${NOCOLOR} (Check status)"