6 KiB
Broadcaster Software (icecast and darkice)
Summary
User: grace Hostname: portal.local Password: emergence Running icecast (port 8000) with nginx proxy (port 80) and Cloudflare Tunnel for external access. No port forwarding or static IP required.
Bill of Materials
- Raspberry pi 4b (1 gig ram) - https://www.sparkfun.com/raspberry-pi-4-model-b-1gb.html
- 3 x USB to XLR sound card cable - https://www.amazon.com/dp/B089WFYZ5R?ref=ppx_yo2ov_dt_b_fed_asin_title&th=1
- 3 x XLR microphones -
- Raspberry pi 4 Power supply - https://www.waveshare.com/pi-psu-us-w.htm
- ethernet cable - https://hosatech.com/products/data/network-cable/cat-500/
- micro hdmi to regular hdmi cable- https://www.waveshare.com/pi-official-micro-hdmi-cable-1m.htm
Hardware setup
- Plug the mic into the the usb cable
- Plug the usb cable into the pi
- Plug the pi into the wall
Pre work
- install raspian lite 64 for raspi model 4b
- configure user and wifi and turn on ssh services when you install
- boot
- find the ip address of the pi and ssh to it
Setup instructions
Creature comforts
- sudo apt update && install git vim zsh
- sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Icecast2 and Darkice installation
Loosely following this tutorial: https://dev.to/shilleh/stream-audio-from-raspberry-pi-to-local-computer-1a1c
Install icecast2
- sudo apt install icecast2
- It will ask you for three passwords. Set them all as emergence.
Install darkice
- sudo apt install darkice
- sudo vim /etc/darkice.cfg
[general]
duration = 0 # Stream indefinitely
bufferSecs = 5 # Buffer for the input, in seconds
reconnect = yes # Reconnect to the server if disconnected
[input]
device = plughw:1,0 # Your audio capture device
sampleRate = 44100
bitsPerSample = 16 # Bits per sample
channel = 1 # 2 = stereo, 1 = mono
[icecast2-0]
bitrateMode = cbr # Constant bit rate
format = mp3 # Audio format
bitrate = 128 # Bitrate in kbps
server = localhost # Server name or IP
port = 80 # Port number
password=emergence # Your Icecast password
mountPoint = portal # Mount point to stream to
name = Black Portal # Name of the stream
description = Black Portal Project # Description of the stream
url = http://blackportaldetroit.com # URL related to the stream
genre = politics # Genre of the stream
public = no # Do not list on public lists
Daemonize darkice
- sudo vim /lib/systemd/system/darkice.service
[Unit]
Description=Darkice Service
[Service]
User=root
Type=simple
Restart=on-failure
RestartSec=5
WorkingDirectory=/home/grace
ExecStart=/usr/bin/darkice -c /etc/darkice.cfg
[Install]
WantedBy=multi-user.target
- sudo systemctl daemon-reload
- sudo systemctl enable icecast2
- sudo systemctl enable darkice
Cloudflare Tunnel Configuration (Automated)
The install script automatically configures Cloudflare Tunnel to make the stream accessible at blackportaldetroit.com. This bypasses CG-NAT, port forwarding, and firewall issues completely.
What gets installed:
- cloudflared - Creates secure tunnel to Cloudflare edge servers
- Configuration file - Pre-configured tunnel settings at
/etc/cloudflared/config.yml - Systemd service - Runs cloudflared as a background service
- Nginx reverse proxy - Proxies port 80 to icecast port 8000 (no root privileges needed)
Manual steps required after installation:
- Transfer domain: Move blackportaldetroit.com nameservers to Cloudflare (if not already done)
- Authenticate: Run
cloudflared tunnel loginwhen prompted - Create tunnel: Run
cloudflared tunnel create blackportal - Add DNS record: Create CNAME record in Cloudflare dashboard pointing to tunnel
- Start service: Tunnel starts automatically via systemd
Verify Cloudflare Tunnel is working:
# Check tunnel status
sudo systemctl status cloudflared
# View tunnel logs
sudo journalctl -u cloudflared -f
# Test DNS resolution
nslookup blackportaldetroit.com
# Test external access
curl -I https://blackportaldetroit.com/portal
Verify nginx proxy is working:
# Check nginx status
sudo systemctl status nginx
# Check icecast status
sudo systemctl status icecast2
# Check listening ports
sudo netstat -tlnp | grep -E ':(80|8000)'
# Test local access
curl -I http://localhost:80
curl -I http://localhost:8000
Troubleshooting Cloudflare Tunnel
Common Issues and Solutions
1. Domain Not on Cloudflare
Problem: Domain still using Namecheap nameservers Solution: Transfer nameservers to Cloudflare
- Login to Cloudflare, add blackportaldetroit.com
- Copy Cloudflare nameservers (e.g.
alice.ns.cloudflare.com) - Update nameservers in Namecheap domain settings
- Wait for DNS propagation (up to 24 hours)
2. Authentication Issues
Problem: cloudflared tunnel login fails
Solution: Manual authentication
# Run authentication manually
cloudflared tunnel login
# If browser doesn't open automatically, copy the URL and open manually
# Complete authentication in browser
3. Tunnel Not Connecting
Problem: Tunnel shows as disconnected Solution: Check service and logs
# Check tunnel service status
sudo systemctl status cloudflared
# View detailed logs
sudo journalctl -u cloudflared -f
# Restart tunnel service
sudo systemctl restart cloudflared
4. DNS Record Issues
Problem: Domain doesn't resolve to tunnel Solution: Check CNAME record in Cloudflare
- Login to Cloudflare dashboard
- Go to DNS → Records
- Ensure CNAME record exists:
@→tunnel-id.cfargotunnel.com - Ensure Proxy status is enabled (orange cloud)
Architecture Diagram with Cloudflare Tunnel
Internet → Cloudflare Edge → Cloudflare Tunnel → Raspberry Pi 4B
↓
nginx (port 80) → icecast (port 8000)
Key Benefits:
- Bypasses CG-NAT completely
- No router configuration needed
- Built-in SSL and DDoS protection
- Works with any internet connection