|
| 1 | +# Magnet IRC Network |
| 2 | + |
| 3 | +A modern, distributed IRC network infrastructure built for irc.perl.org with |
| 4 | +multi-region deployment. |
| 5 | + |
| 6 | +## Overview |
| 7 | + |
| 8 | +The Magnet IRC Network is IRC infrastructure that provides reliable, secure, |
| 9 | +and performant IRC services across multiple geographic regions. Built using |
| 10 | +Solanum IRCd and Atheme services, it leverages Fly.io's global infrastructure |
| 11 | +and Tailscale's mesh networking for secure inter-server communication. |
| 12 | + |
| 13 | +### Key Features |
| 14 | + |
| 15 | +- **Multi-Region Deployment**: US (Chicago) and EU (Amsterdam) regions for |
| 16 | + optimal global performance |
| 17 | +- **Security-First Design**: Tailscale mesh networking, ephemeral |
| 18 | + authentication keys, auto-generated passwords |
| 19 | +- **High Availability**: Geographic redundancy with automatic failover |
| 20 | + capabilities |
| 21 | +- **Modern Infrastructure**: Container-based deployment with proper health |
| 22 | + checks and monitoring |
| 23 | + |
| 24 | +## Architecture |
| 25 | + |
| 26 | +``` |
| 27 | +┌─────────────────┐ Tailscale ┌─────────────────┐ |
| 28 | +│ magnet-9RL │◄─────────────────►│ magnet-1EU │ |
| 29 | +│ (US Hub/IRC) │ Private Mesh │ (EU IRC) │ |
| 30 | +│ SID: 9RL │ │ SID: 1EU │ |
| 31 | +│ OpenSSL+EPYC │ │ OpenSSL+EPYC │ |
| 32 | +└─────────────────┘ └─────────────────┘ |
| 33 | + │ │ |
| 34 | + ▼ ▼ |
| 35 | +┌─────────────────┐ Tailscale ┌─────────────────┐ |
| 36 | +│ magnet-atheme │◄─────────────────►│ magnet-postgres │ |
| 37 | +│ (US Services) │ Private Mesh │ (Fly MPG) │ |
| 38 | +│ OpenSSL+EPYC │ │ │ |
| 39 | +└─────────────────┘ └─────────────────┘ |
| 40 | +``` |
| 41 | + |
| 42 | +### Components |
| 43 | + |
| 44 | +1. **magnet-9RL** - Primary IRC server (US/Chicago) |
| 45 | + - Solanum IRCd with OpenSSL optimizations |
| 46 | + - Hub server for network coordination |
| 47 | + - SSL/TLS client connections on port 6697 |
| 48 | + |
| 49 | +2. **magnet-1EU** - Secondary IRC server (EU/Amsterdam) |
| 50 | + - Solanum IRCd with OpenSSL optimizations |
| 51 | + - Linked to US hub for global federation |
| 52 | + - Regional optimization for European users |
| 53 | + |
| 54 | +3. **magnet-atheme** - IRC Services (US/Chicago) |
| 55 | + - User registration and authentication (NickServ) |
| 56 | + - Channel management services (ChanServ) |
| 57 | + - Persistent data storage via PostgreSQL |
| 58 | + |
| 59 | +4. **magnet-postgres** - Database (US/Chicago) |
| 60 | + - PostgreSQL database for services persistence |
| 61 | + - User accounts, channel registrations, configurations |
| 62 | + - Automated backups and high availability |
| 63 | + |
| 64 | +## Getting Started |
| 65 | + |
| 66 | +### Prerequisites |
| 67 | + |
| 68 | +- Access to the perl-irc Github organization |
| 69 | +- [Fly.io CLI](https://fly.io/docs/hands-on/install-flyctl/) installed and authenticated |
| 70 | +- Access to the `magnet-irc` Fly.io organization |
| 71 | +- Tailscale account with access to the `perl-irc` organization |
| 72 | +- Basic familiarity with IRC network administration |
| 73 | + |
| 74 | +## Deployment |
| 75 | + |
| 76 | +### Development Deployment |
| 77 | + |
| 78 | +For testing and development purposes, use development-specific app names to avoid |
| 79 | +conflicts with production: |
| 80 | + |
| 81 | +```bash |
| 82 | +# Create development apps with -dev suffix |
| 83 | +fly apps create magnet-hub-dev --org magnet-irc |
| 84 | +fly apps create magnet-atheme-dev --org magnet-irc |
| 85 | + |
| 86 | +# Set up Tailscale authentication for dev |
| 87 | +fly secrets set TAILSCALE_AUTHKEY=tskey-auth-xxxxx --app magnet-9rl-dev |
| 88 | + |
| 89 | +# Deploy base infrastructure (development) |
| 90 | +fly deploy --app magnet-hub-dev |
| 91 | +fly deploy --app magnet-atheme-dev |
| 92 | + |
| 93 | +# Validate mesh connectivity |
| 94 | +fly ssh console --app magnet-hub-dev |
| 95 | +tailscale status |
| 96 | +``` |
| 97 | + |
| 98 | +**Important**: Always use the `-dev` suffix for development deployments to prevent |
| 99 | +conflicts with production infrastructure. |
| 100 | + |
| 101 | +### Production Deployment |
| 102 | + |
| 103 | +Follow the systematic approach outlined in `github-issues.md`: |
| 104 | + |
| 105 | +1. **Start with Issue #1** - Implement base infrastructure with proper testing |
| 106 | +2. **Follow TDD methodology** - Write failing tests, implement minimal code to pass |
| 107 | +3. **Validate each step** - Ensure all tests pass before proceeding |
| 108 | +4. **Build incrementally** - Each issue adds functionality while maintaining stability |
| 109 | + |
| 110 | +## Configuration |
| 111 | + |
| 112 | +### Key Environment Variables |
| 113 | + |
| 114 | +- `SERVER_NAME` - Unique server identifier (magnet-9RL, magnet-1EU) |
| 115 | +- `SERVER_SID` - Three-character server ID for IRC protocol |
| 116 | +- `SERVER_DESCRIPTION` - Human-readable server description |
| 117 | +- `TAILSCALE_AUTHKEY` - Ephemeral auth key for mesh networking |
| 118 | +- `SERVICES_PASSWORD` - Authentication between IRC server and services |
| 119 | +- `LINK_PASSWORD_9RL_1EU` - Authentication between linked IRC servers |
| 120 | + |
| 121 | +### Configuration Templates |
| 122 | + |
| 123 | +The project uses environment variable substitution in configuration templates: |
| 124 | + |
| 125 | +- `ircd.conf.template` - Solanum server configuration |
| 126 | +- `atheme.conf.template` - Atheme services configuration |
| 127 | +- Startup scripts handle dynamic password generation and Tailscale initialization |
| 128 | + |
| 129 | +## Security |
| 130 | + |
| 131 | +### Security Features |
| 132 | + |
| 133 | +- **Ephemeral Tailscale Keys** - Devices automatically cleaned up on container termination |
| 134 | +- **Auto-Generated Passwords** - 24-32 character secure passwords for all inter-service communication |
| 135 | +- **SSL/TLS Everywhere** - All client and server-to-server communications encrypted |
| 136 | +- **Private Mesh Networking** - Inter-server communication isolated via Tailscale |
| 137 | +- **AMD EPYC Optimizations** - Hardware-accelerated cryptography with OpenSSL |
| 138 | + |
| 139 | +### Security Best Practices |
| 140 | + |
| 141 | +- No passwords stored in plain text or logs |
| 142 | +- Secure credential distribution via Fly.io secrets |
| 143 | +- Network isolation from public internet for internal communication |
| 144 | +- Regular password rotation capabilities |
| 145 | +- Comprehensive security audit coverage in test suite |
| 146 | + |
| 147 | +## Performance |
| 148 | + |
| 149 | +### Optimization Features |
| 150 | + |
| 151 | +- **OpenSSL with AES-NI** acceleration on AMD EPYC processors |
| 152 | +- **Multi-core compilation** during Docker builds |
| 153 | +- **Optimized connection classes** for different user types and regions |
| 154 | +- **Efficient resource allocation** (1-2GB RAM, 1-2 vCPUs per service) |
| 155 | +- **Geographic distribution** for optimal user experience |
| 156 | + |
| 157 | +### Performance Monitoring |
| 158 | + |
| 159 | +The project includes comprehensive performance testing: |
| 160 | +- Response time measurement and SLA establishment |
| 161 | +- Throughput testing under load |
| 162 | +- Resource utilization monitoring |
| 163 | +- Capacity planning metrics |
| 164 | +- Performance regression detection |
| 165 | + |
| 166 | +## Troubleshooting |
| 167 | + |
| 168 | +### Common Operations |
| 169 | + |
| 170 | +```bash |
| 171 | +# Check application status |
| 172 | +fly status --app magnet-9rl |
| 173 | + |
| 174 | +# View logs |
| 175 | +fly logs --app magnet-9rl |
| 176 | + |
| 177 | +# SSH into container |
| 178 | +fly ssh console --app magnet-9rl |
| 179 | + |
| 180 | +# Check Tailscale mesh status |
| 181 | +tailscale status |
| 182 | + |
| 183 | +# Monitor SSL connections |
| 184 | +netstat -an | grep :6697 |
| 185 | + |
| 186 | +# Test OpenSSL performance |
| 187 | +openssl speed aes-256-cbc |
| 188 | + |
| 189 | +# Verify AMD EPYC features |
| 190 | +cat /proc/cpuinfo | grep flags |
| 191 | +``` |
| 192 | + |
| 193 | +### Health Checks |
| 194 | + |
| 195 | +All components include comprehensive health checks: |
| 196 | +- Tailscale mesh connectivity |
| 197 | +- IRC server responsiveness |
| 198 | +- Services authentication status |
| 199 | +- Database connectivity |
| 200 | +- SSL certificate validity |
| 201 | + |
| 202 | +## Development |
| 203 | + |
| 204 | +### Contributing |
| 205 | + |
| 206 | +1. **Use GitHub Issues** - Follow the systematic 15-issue implementation plan |
| 207 | +2. **Maintain Documentation** - Update relevant documentation with changes |
| 208 | +3. **Test Thoroughly** - Ensure all tests pass before submitting changes |
| 209 | +4. **Security Review** - Consider security implications of all changes |
| 210 | + |
| 211 | +### Testing |
| 212 | + |
| 213 | +The project emphasizes comprehensive testing: |
| 214 | +- **Unit Tests** - Component-level functionality validation |
| 215 | +- **Integration Tests** - Inter-component communication testing |
| 216 | +- **End-to-End Tests** - Complete IRC network functionality |
| 217 | +- **Load Tests** - Performance and stability under realistic usage |
| 218 | +- **Security Tests** - Vulnerability and penetration testing |
| 219 | + |
| 220 | +### Code Style |
| 221 | + |
| 222 | +- Simple, clean, maintainable solutions preferred |
| 223 | +- Match existing code style and formatting |
| 224 | +- Preserve comments and documentation |
| 225 | +- Use descriptive, evergreen naming conventions |
| 226 | +- No mock implementations - always use real data and APIs |
| 227 | + |
| 228 | +## Documentation |
| 229 | + |
| 230 | +### Key Files |
| 231 | + |
| 232 | +- **`README.md`** - This comprehensive project overview |
| 233 | +- **`LICENSE`** - MIT License for the project |
| 234 | + |
| 235 | +### Additional Resources |
| 236 | + |
| 237 | +- [Fly.io Documentation](https://fly.io/docs/) |
| 238 | +- [Tailscale Documentation](https://tailscale.com/kb/) |
| 239 | +- [Solanum IRCd Documentation](https://github.com/solanum-ircd/solanum) |
| 240 | +- [Atheme Services Documentation](https://github.com/atheme/atheme) |
| 241 | + |
| 242 | +## License |
| 243 | + |
| 244 | +This project is licensed under the MIT License - see the |
| 245 | +[LICENSE](/Users/perigrin/dev/magnet/LICENSE) file for details. |
| 246 | + |
| 247 | +## Organizations |
| 248 | + |
| 249 | +- **Fly.io Organization**: `magnet-irc` |
| 250 | +- **Tailscale Organization**: `perl-irc` |
| 251 | +- **Github Organization**: `perl-irc` |
| 252 | + |
| 253 | +## Support |
| 254 | + |
| 255 | +For issues, questions, or contributions: |
| 256 | +1. Submit issues following the established format |
| 257 | +2. Ensure all tests pass before requesting reviews |
| 258 | + |
| 259 | +--- |
| 260 | + |
| 261 | +**Note**: This infrastructure is designed for production IRC network operation. |
| 262 | +Follow all security best practices and test thoroughly in development |
| 263 | +environments before production deployment. |
0 commit comments