Skip to content

Deployment Guide ​

This guide covers production deployment of the SirrMesh server.

System Requirements ​

Hardware Requirements ​

yaml
Minimum Configuration:
  CPU: 2 cores
  RAM: 2GB
  Storage: 20GB SSD
  Network: 100Mbps

Recommended Configuration:
  CPU: 4 cores
  RAM: 4GB
  Storage: 100GB SSD
  Network: 1Gbps

Software Requirements ​

yaml
Operating System:
  - Ubuntu 20.04+
  - Debian 11+
  - CentOS 8+
  - macOS 12+

Dependencies:
  - Go 1.24+ (only required for compilation)
  - Git
  - Make

Port Requirements ​

PortServiceDescription
25SMTPMail receiving (optional)
587SubmissionMail submission
465SMTPSEncrypted mail submission
993IMAPSEncrypted IMAP
143IMAPIMAP (optional)
8825SMTP AltAlternative SMTP port

Quick Deployment ​

One-Click Deployment Script ​

Use the automated script for quick deployment:

bash
# Download and execute the deployment script
curl -sSL https://raw.githubusercontent.com/sirrmesh/SirrMesh/main/start.sh | bash

# Or download and execute separately
wget https://raw.githubusercontent.com/sirrmesh/SirrMesh/main/start.sh
chmod +x start.sh
sudo ./start.sh

The script will automatically:

  1. Detect system architecture and download the correct binary
  2. Initialize configuration directory
  3. Configure DNS and TLS certificates (supports 15 DNS providers)
  4. Create and start systemd service

Manual Deployment ​

1. System Preparation ​

bash
# Update system
sudo apt update && sudo apt upgrade -y

# Install dependencies
sudo apt install -y build-essential git curl wget

# Create working directory
export SIRRCHAT_HOME="${SIRRCHAT_HOME:-$HOME/.sirrmeshd}"
mkdir -p $SIRRCHAT_HOME

2. Download Binary ​

bash
# Auto-detect system architecture
get_system_arch() {
    local os=$(uname -s | tr '[:upper:]' '[:lower:]')
    local arch=$(uname -m)

    case "$arch" in
        x86_64|amd64) arch="amd64" ;;
        aarch64|arm64) arch="arm64" ;;
        *) arch="amd64" ;;
    esac

    echo "${os}-${arch}"
}

SYSTEM_ARCH=$(get_system_arch)
VERSION="v0.3.1"

# Download the corresponding version
wget https://download.sirrchat.org/sirrmeshd-${SYSTEM_ARCH}-${VERSION}
sudo mv sirrmeshd-${SYSTEM_ARCH}-${VERSION} /usr/local/bin/sirrmeshd
sudo chmod +x /usr/local/bin/sirrmeshd

# Verify installation
sirrmeshd --help

3. Build from Source (Optional) ​

bash
# Clone repository
git clone https://github.com/sirrmesh/SirrMesh.git
cd sirrmeshd

# Build
make build

# Install
sudo cp build/sirrmeshd /usr/local/bin/

Configuration ​

Basic Configuration ​

Create $SIRRCHAT_HOME/sirrmeshd.conf:

conf
# Domain configuration
$(hostname) = mx1.example.com
$(primary_domain) = example.com
$(local_domains) = $(primary_domain)

# TLS certificate configuration
tls {
    loader acme {
        hostname $(hostname)
        email postmaster@$(hostname)
        agreed
        challenge dns-01
        dns cloudflare {
            api_token YOUR_CLOUDFLARE_API_TOKEN
        }
    }
}

# Storage configuration
storage.imapsql local_mailboxes {
    driver sqlite3
    dsn $SIRRCHAT_HOME/imapsql.db
}

# Authentication configuration
auth.pass_table local_auth {
    table file $SIRRCHAT_HOME/users
}

# SMTP service
smtp tcp://0.0.0.0:8825 {
    hostname $(hostname)

    limits {
        all rate 20 1s
        all concurrency 10
    }

    dmarc yes

    check {
        require_mx_record
        dkim
        spf
    }

    source $(local_domains) {
        deliver_to &local_mailboxes
    }
}

# Submission service
submission tls://0.0.0.0:465 tcp://0.0.0.0:587 {
    hostname $(hostname)
    auth &local_auth

    source $(local_domains) {
        default_destination {
            modify {
                dkim $(primary_domain) $(local_domains) default
            }
            deliver_to &remote_queue
        }
    }
}

# IMAP service
imap tls://0.0.0.0:993 tcp://0.0.0.0:143 {
    auth &local_auth
    storage &local_mailboxes
}

DNS Provider Configuration ​

Supported DNS providers and configuration:

Cloudflare ​

conf
dns cloudflare {
    api_token YOUR_API_TOKEN
}

Amazon Route53 ​

conf
dns route53 {
    access_key_id YOUR_ACCESS_KEY
    secret_access_key YOUR_SECRET_KEY
}

DigitalOcean ​

conf
dns digitalocean {
    api_token YOUR_API_TOKEN
}

Google Cloud DNS ​

conf
dns googleclouddns {
    service_account_json /path/to/service-account.json
}

Service Management ​

Systemd Service Configuration ​

Create Service ​

bash
sudo tee /etc/systemd/system/sirrmeshd.service > /dev/null <<EOF
[Unit]
Description=SirrMesh Mail Server
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=root
Environment="SIRRCHAT_HOME=/root/.sirrmeshd"
ExecStart=/usr/local/bin/sirrmeshd run
Restart=always
RestartSec=3
LimitNOFILE=65535
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
EOF

Start and Manage Service ​

bash
# Reload systemd configuration
sudo systemctl daemon-reload

# Start service
sudo systemctl start sirrmeshd

# Enable auto-start on boot
sudo systemctl enable sirrmeshd

# Check service status
sudo systemctl status sirrmeshd

# View logs
sudo journalctl -u sirrmeshd -f

# Restart service
sudo systemctl restart sirrmeshd

Monitoring and Maintenance ​

Log Viewing ​

bash
# View real-time logs
sudo journalctl -u sirrmeshd -f

# View recent error logs
sudo journalctl -u sirrmeshd -p err -n 100

# View today's logs
sudo journalctl -u sirrmeshd --since today

Health Check Script ​

Create ~/check_sirrchat_health.sh:

bash
#!/bin/bash

RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'

echo "=== SirrMesh Health Check ==="
echo "Time: $(date)"
echo "=============================="

# Check process status
if pgrep -x sirrmeshd > /dev/null; then
    echo -e "${GREEN}✓${NC} Process is running"
else
    echo -e "${RED}✗${NC} Process is not running"
    exit 1
fi

# Check ports
for port in 587 993 8825; do
    if netstat -tlnp 2>/dev/null | grep -q ":$port "; then
        echo -e "${GREEN}✓${NC} Port $port is listening"
    else
        echo -e "${RED}✗${NC} Port $port is not listening"
    fi
done

# Check disk space
DISK_USAGE=$(df -h $SIRRCHAT_HOME | awk 'NR==2 {print $5}' | tr -d '%')
if [ "$DISK_USAGE" -lt 80 ]; then
    echo -e "${GREEN}✓${NC} Disk usage: ${DISK_USAGE}%"
else
    echo -e "${RED}⚠${NC} High disk usage: ${DISK_USAGE}%"
fi

echo "=============================="

Troubleshooting ​

Common Issues ​

1. Service Won't Start ​

bash
# Check configuration file syntax
sirrmeshd run --config $SIRRCHAT_HOME/sirrmeshd.conf

# View detailed errors
sudo journalctl -u sirrmeshd-mail -n 50

2. TLS Certificate Issues ​

bash
# Check DNS configuration
sirrmeshd dns check

# Manually test DNS challenge
sirrmeshd dns export

3. Cannot Send/Receive Mail ​

bash
# Check if ports are open
netstat -tlnp | grep -E '25|587|993'

# Check firewall
sudo ufw status

Security Best Practices ​

Firewall Configuration ​

bash
# Basic firewall rules
sudo ufw default deny incoming
sudo ufw default allow outgoing

# SSH access
sudo ufw allow 22/tcp

# Mail service ports
sudo ufw allow 587/tcp comment 'Submission'
sudo ufw allow 993/tcp comment 'IMAPS'
sudo ufw allow 8825/tcp comment 'SMTP Alt'

# Enable firewall
sudo ufw enable

Security Checklist ​

  • [ ] Firewall rules properly configured
  • [ ] SSH using key authentication
  • [ ] TLS certificates configured with auto-renewal
  • [ ] System automatic security updates enabled
  • [ ] Log rotation configured
  • [ ] Regular backups implemented

Backup Recommendations ​

bash
# Backup configuration and data
BACKUP_DIR="/backup/sirrmeshd/$(date +%Y%m%d)"
mkdir -p $BACKUP_DIR

# Backup configuration
cp $SIRRCHAT_HOME/sirrmeshd.conf $BACKUP_DIR/

# Backup database
cp $SIRRCHAT_HOME/*.db $BACKUP_DIR/

# Keep only last 7 days of backups
find /backup/sirrmeshd -type d -mtime +7 -exec rm -rf {} +

Production Environment Recommendations ​

Database Selection ​

  • Development Environment: SQLite (simple, no additional setup)
  • Production Environment: PostgreSQL (best performance and features)
  • Alternative: MySQL 8.0+ (good performance)

Storage Backend ​

  • Development Environment: Filesystem storage
  • Production Environment: S3-compatible storage (scalable, durable)

Monitoring ​

  • Enable Prometheus metrics endpoint
  • Set up alerts for disk space, memory usage
  • Monitor mail queue size
  • Track authentication failure counts

Last updated: December 2025

Released under the GPL 3.0 License.