No description
Find a file
2025-09-27 21:53:38 +02:00
app1_server.dSYM/Contents first commit 2025-09-12 10:10:24 +02:00
docker SUN RPC Unicast with Motif Display 2025-09-27 21:53:38 +02:00
k8s SUN RPC Unicast with Motif Display 2025-09-27 21:53:38 +02:00
scripts SUN RPC Unicast with Motif Display 2025-09-27 21:53:38 +02:00
app1_server.c SUN RPC Unicast with Motif Display 2025-09-27 21:53:20 +02:00
app2_client.c SUN RPC Unicast with Motif Display 2025-09-27 21:53:20 +02:00
app3_hybrid.c SUN RPC Unicast with Motif Display 2025-09-27 21:53:20 +02:00
app4_monitor.c First working 2025-09-15 20:33:19 +02:00
app5_display.c SUN RPC Unicast with Motif Display 2025-09-27 21:53:38 +02:00
build-images.sh SUN RPC Unicast with Motif Display 2025-09-27 21:53:20 +02:00
cleanup-k8s.sh Switched to podman from docker 2025-09-12 10:49:57 +02:00
create-kind-cluster.sh SUN RPC Unicast with Motif Display 2025-09-27 21:53:20 +02:00
create-registry-secret.sh First working 2025-09-15 20:33:19 +02:00
deploy-to-k8s.sh SUN RPC Unicast with Motif Display 2025-09-27 21:53:20 +02:00
diagnose-registry.sh First working 2025-09-15 20:33:19 +02:00
DISPLAY-APP-GUIDE.md SUN RPC Unicast with Motif Display 2025-09-27 21:53:38 +02:00
find-rhel9-repo.sh First working 2025-09-15 20:33:19 +02:00
install-rhel9-prerequisites.sh First working 2025-09-15 20:33:19 +02:00
kind-cluster-config.yaml first commit 2025-09-12 10:10:24 +02:00
kubectl First working 2025-09-15 20:33:19 +02:00
load-images-to-kind.sh First working 2025-09-15 20:33:19 +02:00
Makefile first commit 2025-09-12 10:10:24 +02:00
Makefile.container First working 2025-09-15 20:33:19 +02:00
motif_rpc.h SUN RPC Unicast with Motif Display 2025-09-27 21:53:20 +02:00
motif_rpc.x SUN RPC Unicast with Motif Display 2025-09-27 21:53:20 +02:00
motif_rpc_clnt.c First working 2025-09-15 20:33:19 +02:00
motif_rpc_svc.c First working 2025-09-15 20:33:19 +02:00
motif_rpc_xdr.c First working 2025-09-15 20:33:19 +02:00
overview-k8s-system.sh Switched to podman from docker 2025-09-12 10:49:57 +02:00
push-images-to-registry.sh SUN RPC Unicast with Motif Display 2025-09-27 21:53:20 +02:00
README-kubernetes.md First working 2025-09-15 20:33:19 +02:00
README.md First working 2025-09-15 20:33:19 +02:00
RHEL9-TROUBLESHOOTING.md First working 2025-09-15 20:33:19 +02:00
rpc_compat.c first commit 2025-09-12 10:10:24 +02:00
setup-kind-cluster.sh First working 2025-09-15 20:33:19 +02:00
test-podman-system.sh First working 2025-09-15 20:33:19 +02:00
test_system.sh first commit 2025-09-12 10:10:24 +02:00
TESTING-GUIDE.md Eerste tests 2025-09-15 21:29:37 +02:00
verify-registry.sh SUN RPC Unicast with Motif Display 2025-09-27 21:53:20 +02:00

SUN-RPC Motif Communication System

A distributed application system featuring 4 different applications that communicate using SUN-RPC (ONC-RPC) messages over UDP unicast and multicast protocols.

🚀 Quick Start

OCI Registry Deployment (Recommended):

# 1. Install RHEL9 host prerequisites first
./install-rhel9-prerequisites.sh

# 2. Build images with registry tags
./build-images.sh

# 3. Push to OCI registry
./push-images-to-registry.sh

# 4. Create registry pull secret for Kubernetes
./create-registry-secret.sh

# 5. Deploy to any Kubernetes cluster
./deploy-to-k8s.sh

Local KIND Deployment (Alternative):

# 1. Install prerequisites
./install-rhel9-prerequisites.sh

# 2. Build and deploy locally
IMAGE_VERSION=local ./build-images.sh
./create-kind-cluster.sh
./load-images-to-kind.sh
./deploy-to-k8s.sh

🌐 OCI Registry: code.it-speeltuin.eu/huub

🌟 Now powered by Podman for enhanced security and rootless containers!

See README-kubernetes.md for complete Kubernetes instructions.

Architecture Overview

The system consists of 4 applications that demonstrate different communication patterns:

  1. Application 1 (app1_server) - Main RPC Server

    • Central server that handles RPC requests from other applications
    • Supports UDP unicast for point-to-point communication
    • Broadcasts messages via UDP multicast
    • Manages client registration and status tracking
  2. Application 2 (app2_client) - RPC Client

    • Pure client application that sends RPC requests
    • Interactive menu for user operations
    • Listens for multicast broadcasts
    • Sends periodic heartbeats
  3. Application 3 (app3_hybrid) - Hybrid Client/Server

    • Acts as both RPC client and server
    • Can receive RPC calls while also making calls to other applications
    • Dual-mode operation for complex communication patterns
    • Threaded design for concurrent client/server operations
  4. Application 4 (app4_monitor) - Monitoring/Logging Application

    • Passive monitoring of all multicast traffic
    • Logs all communications to file
    • Periodic status polling of other applications
    • Statistical reporting and analysis

Communication Protocols

SUN-RPC (ONC-RPC) Procedures

The system defines the following RPC procedures:

  • SEND_MESSAGE - Send a message between applications
  • GET_STATUS - Retrieve application status information
  • SEND_HEARTBEAT - Send heartbeat for monitoring
  • BROADCAST_MESSAGE - Broadcast message to all applications
  • REGISTER_APP - Register application for multicast group
  • SHUTDOWN_NOTIFY - Notify about application shutdown

UDP Multicast

  • Multicast Group: 224.0.0.1
  • Multicast Port: 8888
  • Used for broadcasting messages to all registered applications
  • Monitored by the monitoring application for logging

Deployment Options

For a complete distributed environment with RHEL9 UBI containers powered by Podman:

Quick Start:

# Build images with Podman, setup KIND cluster, and deploy
./build-images.sh && ./setup-kind-cluster.sh && ./deploy-to-k8s.sh

🌟 Features:

  • Rootless containers for enhanced security
  • Daemonless architecture - no Docker daemon required
  • Enterprise-grade RHEL9 UBI base images

See README-kubernetes.md for detailed Kubernetes deployment instructions.

🖥️ Local macOS/Linux Build

Prerequisites:

  • GCC compiler with C99 support
  • rpcgen utility (part of Sun RPC/ONC-RPC)
  • POSIX threads library
  • Network Services Library (libnsl on Linux)

Build Instructions:

# Build all applications (Linux/macOS)
make all

# Or build individual components
make rpc-stubs  # Generate RPC stubs from .x file
make app1_server
make app2_client  # ⚠️ Has macOS compatibility issues
make app3_hybrid  # ⚠️ Has macOS compatibility issues
make app4_monitor # ⚠️ Has macOS compatibility issues

# Clean build artifacts
make clean

Generated Files

The build process generates the following files from motif_rpc.x:

  • motif_rpc.h - RPC header definitions
  • motif_rpc_clnt.c - Client stub functions
  • motif_rpc_svc.c - Server stub functions
  • motif_rpc_xdr.c - XDR serialization functions

Running the Applications

The easiest way to run the complete system:

# Deploy to KIND cluster
./deploy-to-k8s.sh

# Monitor the system
kubectl get pods -n motif-rpc --watch
kubectl logs -f deployment/motif-server -n motif-rpc

🖥️ Local Execution (macOS/Linux)

Server Only (macOS Compatible):

./app1_server

Full System (Linux Recommended):

# Start the main server
./app1_server

# In separate terminals, start client applications
./app2_client <server_host>
./app3_hybrid <server_host>  
./app4_monitor <server_host>

Note: Use localhost or 127.0.0.1 if running locally.

Step 3: Interact with Applications

Each client application provides an interactive menu:

App2 Client Menu:

  1. Send message to server
  2. Get server status
  3. Send broadcast message
  4. Send heartbeat
  5. Register for multicast
  6. Exit

App3 Hybrid Menu:

  1. Send message to main server
  2. Get main server status
  3. Send broadcast message
  4. Send heartbeat to main server
  5. Show local status
  6. Exit

App4 Monitor Menu:

  1. Show statistics
  2. Poll application status
  3. Send test broadcast
  4. Force heartbeat
  5. Exit

Communication Examples

Unicast RPC Communication

App2 Client ---[RPC SEND_MESSAGE]---> App1 Server
App2 Client <--[RPC Response]--------- App1 Server

Multicast Broadcasting

App2 Client ---[RPC BROADCAST]---> App1 Server
App1 Server ---[UDP Multicast]---> All Applications

Monitoring

All Apps ---[UDP Multicast]---> App4 Monitor
App4 Monitor ---[Log to File]---> motif_monitor.log

File Structure

sun-rpc-motif/
├── motif_rpc.x          # RPC protocol definition
├── Makefile             # Build configuration
├── app1_server.c        # Main RPC server
├── app2_client.c        # RPC client
├── app3_hybrid.c        # Hybrid client/server
├── app4_monitor.c       # Monitoring application
├── README.md            # This documentation
└── Generated files:
    ├── motif_rpc.h      # RPC header
    ├── motif_rpc_clnt.c # Client stubs
    ├── motif_rpc_svc.c  # Server stubs
    └── motif_rpc_xdr.c  # XDR functions

Logging and Monitoring

Server Logs

  • All applications log to stdout with timestamps
  • Format: [timestamp] APP_TYPE: message

Monitor Logs

  • App4 Monitor logs all activity to motif_monitor.log
  • Includes multicast messages, heartbeats, and status polls
  • Provides statistics on message counts and uptime

Status Information

  • Each application maintains status including:
    • Application ID and name
    • Current status (OK, ERROR, BUSY, SHUTDOWN)
    • Uptime information
    • Message counters

Network Configuration

Firewall Considerations

  • Ensure UDP ports are open for RPC communication
  • Multicast group 224.0.0.1 must be accessible
  • Port 8888 used for multicast communication

Multi-Host Deployment

  • Replace localhost with actual hostnames/IPs
  • Ensure all hosts can reach each other via UDP
  • Multicast routing must be configured for cross-subnet operation

Implementation Status

Working Components

  • 🐳 Kubernetes Deployment: Complete containerized system with RHEL9 UBI + Podman
  • 🖥️ RPC Server: Fully functional on all platforms (Linux/macOS)
  • 📡 Protocol Definition: Complete SUN-RPC interface defined in motif_rpc.x
  • 🔧 Build System: Multi-platform Makefile + Podman builds
  • 📚 Documentation: Complete system documentation

🌟 Kubernetes + Podman Features

  • Rootless containers for enhanced security
  • Daemonless architecture - no background daemon required
  • Multi-container deployment with service discovery
  • Persistent logging with volume mounts
  • Health checks and resource limits
  • External access via NodePort services
  • Auto-scaling and rolling updates

⚠️ macOS Compatibility (Local Build)

The client applications have compilation issues on macOS due to RPC implementation differences. Use Kubernetes deployment for full functionality.

Quick Test

Kubernetes with Podman (Recommended):

# Full system test with Podman-powered containers
./deploy-to-k8s.sh && kubectl get pods -n motif-rpc --watch

macOS (Server Only):

./test_system.sh

Troubleshooting

Common Issues

  1. "cannot create udp service" Error

    • Port may be in use
    • Check with netstat -un | grep <port>
    • Wait a few seconds and retry
  2. RPC Connection Failed

    • Verify server is running and accessible
    • Check firewall settings
    • Confirm hostname/IP is correct
  3. Multicast Not Working

    • Check multicast routing: route -n
    • Verify network interface supports multicast
    • Some virtual networks may not support multicast
  4. Build Errors on macOS

    • Client applications currently don't compile due to RPC compatibility issues
    • Server application works correctly
    • Consider using Linux for full functionality
  5. Build Errors on Linux

    • Install missing dependencies: sudo apt-get install libc6-dev rpcbind
    • Ensure rpcgen is available in PATH

Debug Mode

Add -DDEBUG to CFLAGS in Makefile for verbose output:

CFLAGS = -Wall -Wextra -std=c99 -g -O2 -DDEBUG

Advanced Features

Threading Model

  • App1 Server: Single-threaded RPC server with multicast support
  • App2 Client: Multi-threaded (main + multicast listener)
  • App3 Hybrid: Multi-threaded (RPC server + client menu + multicast)
  • App4 Monitor: Multi-threaded (multicast listener + heartbeat sender + menu)

Message Types

  • MSG_HEARTBEAT: Keep-alive messages
  • MSG_DATA: General data messages
  • MSG_COMMAND: Command messages
  • MSG_STATUS: Status inquiry messages
  • MSG_BROADCAST: Broadcast messages

Application IDs

  • APP_SERVER (1): Main server
  • APP_CLIENT (2): Pure client
  • APP_HYBRID (3): Hybrid app
  • APP_MONITOR (4): Monitor app

Security Considerations

  • No authentication implemented (suitable for trusted networks only)
  • UDP communications are not encrypted
  • Consider adding SSL/TLS for production use
  • Implement message validation for untrusted environments

Performance Notes

  • UDP provides low-latency communication
  • Multicast efficiently distributes messages to multiple recipients
  • RPC provides reliable request-response semantics
  • Threading enables concurrent operations

License

This is a demonstration system for educational purposes.