Fix P2P Connectivity Regression + Dynamic Versioning System #12
43
Dockerfile.ubuntu
Normal file
43
Dockerfile.ubuntu
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# CHORUS - Ubuntu-based Docker image for glibc compatibility
|
||||||
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
|
# Install runtime dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
ca-certificates \
|
||||||
|
tzdata \
|
||||||
|
curl \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create non-root user for security
|
||||||
|
RUN groupadd -g 1000 chorus && \
|
||||||
|
useradd -u 1000 -g chorus -s /bin/bash -d /home/chorus -m chorus
|
||||||
|
|
||||||
|
# Create application directories
|
||||||
|
RUN mkdir -p /app/data && \
|
||||||
|
chown -R chorus:chorus /app
|
||||||
|
|
||||||
|
# Copy pre-built binary from build directory
|
||||||
|
COPY build/chorus-agent /app/chorus-agent
|
||||||
|
RUN chmod +x /app/chorus-agent && chown chorus:chorus /app/chorus-agent
|
||||||
|
|
||||||
|
# Switch to non-root user
|
||||||
|
USER chorus
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Expose ports
|
||||||
|
EXPOSE 8080 8081 9000
|
||||||
|
|
||||||
|
# Health check
|
||||||
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||||
|
CMD curl -f http://localhost:8081/health || exit 1
|
||||||
|
|
||||||
|
# Set default environment variables
|
||||||
|
ENV LOG_LEVEL=info \
|
||||||
|
LOG_FORMAT=structured \
|
||||||
|
CHORUS_BIND_ADDRESS=0.0.0.0 \
|
||||||
|
CHORUS_API_PORT=8080 \
|
||||||
|
CHORUS_HEALTH_PORT=8081 \
|
||||||
|
CHORUS_P2P_PORT=9000
|
||||||
|
|
||||||
|
# Start CHORUS
|
||||||
|
ENTRYPOINT ["/app/chorus-agent"]
|
||||||
2
Makefile
2
Makefile
@@ -5,7 +5,7 @@
|
|||||||
BINARY_NAME_AGENT = chorus-agent
|
BINARY_NAME_AGENT = chorus-agent
|
||||||
BINARY_NAME_HAP = chorus-hap
|
BINARY_NAME_HAP = chorus-hap
|
||||||
BINARY_NAME_COMPAT = chorus
|
BINARY_NAME_COMPAT = chorus
|
||||||
VERSION ?= 0.5.0
|
VERSION ?= 0.5.5
|
||||||
COMMIT_HASH ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
COMMIT_HASH ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
||||||
BUILD_DATE ?= $(shell date -u '+%Y-%m-%d_%H:%M:%S')
|
BUILD_DATE ?= $(shell date -u '+%Y-%m-%d_%H:%M:%S')
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,19 @@ import (
|
|||||||
"chorus/internal/runtime"
|
"chorus/internal/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Build-time variables set by ldflags
|
||||||
|
var (
|
||||||
|
version = "0.5.0-dev"
|
||||||
|
commitHash = "unknown"
|
||||||
|
buildDate = "unknown"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Early CLI handling: print help/version without requiring env/config
|
// Early CLI handling: print help/version without requiring env/config
|
||||||
for _, a := range os.Args[1:] {
|
for _, a := range os.Args[1:] {
|
||||||
switch a {
|
switch a {
|
||||||
case "--help", "-h", "help":
|
case "--help", "-h", "help":
|
||||||
fmt.Printf("%s-agent %s\n\n", runtime.AppName, runtime.AppVersion)
|
fmt.Printf("%s-agent %s (build: %s, %s)\n\n", runtime.AppName, version, commitHash, buildDate)
|
||||||
fmt.Println("Usage:")
|
fmt.Println("Usage:")
|
||||||
fmt.Printf(" %s [--help] [--version]\n\n", filepath.Base(os.Args[0]))
|
fmt.Printf(" %s [--help] [--version]\n\n", filepath.Base(os.Args[0]))
|
||||||
fmt.Println("CHORUS Autonomous Agent - P2P Task Coordination")
|
fmt.Println("CHORUS Autonomous Agent - P2P Task Coordination")
|
||||||
@@ -46,11 +53,16 @@ func main() {
|
|||||||
fmt.Println(" - Health monitoring")
|
fmt.Println(" - Health monitoring")
|
||||||
return
|
return
|
||||||
case "--version", "-v":
|
case "--version", "-v":
|
||||||
fmt.Printf("%s-agent %s\n", runtime.AppName, runtime.AppVersion)
|
fmt.Printf("%s-agent %s (build: %s, %s)\n", runtime.AppName, version, commitHash, buildDate)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set dynamic build information
|
||||||
|
runtime.AppVersion = version
|
||||||
|
runtime.AppCommitHash = commitHash
|
||||||
|
runtime.AppBuildDate = buildDate
|
||||||
|
|
||||||
// Initialize shared P2P runtime
|
// Initialize shared P2P runtime
|
||||||
sharedRuntime, err := runtime.Initialize("agent")
|
sharedRuntime, err := runtime.Initialize("agent")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ version: "3.9"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
chorus:
|
chorus:
|
||||||
image: anthonyrawlins/chorus:v0.5.5-p2p-simple
|
image: anthonyrawlins/chorus:latest
|
||||||
|
|
||||||
# REQUIRED: License configuration (CHORUS will not start without this)
|
# REQUIRED: License configuration (CHORUS will not start without this)
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -33,9 +33,12 @@ import (
|
|||||||
"github.com/multiformats/go-multiaddr"
|
"github.com/multiformats/go-multiaddr"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
// Build information - set by main package
|
||||||
AppName = "CHORUS"
|
var (
|
||||||
AppVersion = "0.1.0-dev"
|
AppName = "CHORUS"
|
||||||
|
AppVersion = "0.1.0-dev"
|
||||||
|
AppCommitHash = "unknown"
|
||||||
|
AppBuildDate = "unknown"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SimpleLogger provides basic logging implementation
|
// SimpleLogger provides basic logging implementation
|
||||||
@@ -138,7 +141,7 @@ func Initialize(appMode string) (*SharedRuntime, error) {
|
|||||||
runtime.Context = ctx
|
runtime.Context = ctx
|
||||||
runtime.Cancel = cancel
|
runtime.Cancel = cancel
|
||||||
|
|
||||||
runtime.Logger.Info("🎭 Starting CHORUS v%s - Container-First P2P Task Coordination", AppVersion)
|
runtime.Logger.Info("🎭 Starting CHORUS v%s (build: %s, %s) - Container-First P2P Task Coordination", AppVersion, AppCommitHash, AppBuildDate)
|
||||||
runtime.Logger.Info("📦 Container deployment - Mode: %s", appMode)
|
runtime.Logger.Info("📦 Container deployment - Mode: %s", appMode)
|
||||||
|
|
||||||
// Load configuration from environment (no config files in containers)
|
// Load configuration from environment (no config files in containers)
|
||||||
@@ -248,17 +251,12 @@ func Initialize(appMode string) (*SharedRuntime, error) {
|
|||||||
runtime.HypercoreLog = hlog
|
runtime.HypercoreLog = hlog
|
||||||
runtime.Logger.Info("📝 Hypercore logger initialized")
|
runtime.Logger.Info("📝 Hypercore logger initialized")
|
||||||
|
|
||||||
// Initialize mDNS discovery (disabled in container environments for scaling)
|
// Initialize mDNS discovery
|
||||||
if cfg.V2.DHT.MDNSEnabled {
|
mdnsDiscovery, err := discovery.NewMDNSDiscovery(ctx, node.Host(), "chorus-peer-discovery")
|
||||||
mdnsDiscovery, err := discovery.NewMDNSDiscovery(ctx, node.Host(), "chorus-peer-discovery")
|
if err != nil {
|
||||||
if err != nil {
|
return nil, fmt.Errorf("failed to create mDNS discovery: %v", err)
|
||||||
return nil, fmt.Errorf("failed to create mDNS discovery: %v", err)
|
|
||||||
}
|
|
||||||
runtime.MDNSDiscovery = mdnsDiscovery
|
|
||||||
runtime.Logger.Info("🔍 mDNS discovery enabled for local network")
|
|
||||||
} else {
|
|
||||||
runtime.Logger.Info("⚪ mDNS discovery disabled (recommended for container/swarm deployments)")
|
|
||||||
}
|
}
|
||||||
|
runtime.MDNSDiscovery = mdnsDiscovery
|
||||||
|
|
||||||
// Initialize PubSub with hypercore logging
|
// Initialize PubSub with hypercore logging
|
||||||
ps, err := pubsub.NewPubSubWithLogger(ctx, node.Host(), "chorus/coordination/v1", "hmmm/meta-discussion/v1", hlog)
|
ps, err := pubsub.NewPubSubWithLogger(ctx, node.Host(), "chorus/coordination/v1", "hmmm/meta-discussion/v1", hlog)
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ func (n *Node) startBackgroundTasks() {
|
|||||||
// logConnectionStatus logs the current connection status
|
// logConnectionStatus logs the current connection status
|
||||||
func (n *Node) logConnectionStatus() {
|
func (n *Node) logConnectionStatus() {
|
||||||
peers := n.Peers()
|
peers := n.Peers()
|
||||||
fmt.Printf("CHORUS Node Status - ID: %s, Connected Peers: %d\n",
|
fmt.Printf("🐝 Bzzz Node Status - ID: %s, Connected Peers: %d\n",
|
||||||
n.ID().ShortString(), len(peers))
|
n.ID().ShortString(), len(peers))
|
||||||
|
|
||||||
if len(peers) > 0 {
|
if len(peers) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user