CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-surge

Static web publishing CLI tool for deploying web applications to a CDN with a single command

Pending
Overview
Eval results
Files

dns.mddocs/

DNS Management

Comprehensive DNS management for custom domains, including zone management, record manipulation, and DNS configuration for Surge deployments.

Capabilities

DNS Records Management

View and manage DNS records for domains hosted on Surge.

/**
 * View and manage DNS records for domain
 * @param hooks - Optional lifecycle hooks
 * @returns Command function
 */
function dns(hooks?: HookConfig): CommandFunction;

CLI Usage:

# View DNS records for domain
surge dns example.com

# Add DNS record
surge dns example.com add A www 192.168.1.1

# Add CNAME record
surge dns example.com add CNAME api api.example.com

# Remove DNS record by ID
surge dns example.com rem 12345

# List all DNS operations
surge dns --help

Supported Record Types:

  • A: IPv4 address records
  • AAAA: IPv6 address records
  • CNAME: Canonical name records
  • MX: Mail exchange records
  • TXT: Text records
  • NS: Name server records

Library Usage:

surge.dns({})(process.argv.slice(2));

DNS Zone Management

Full DNS zone management and configuration.

/**
 * Full DNS zone management for domain
 * @param hooks - Optional lifecycle hooks
 * @returns Command function
 */
function zone(hooks?: HookConfig): CommandFunction;

CLI Usage:

# View complete DNS zone
surge zone example.com

# Zone management interface
surge zone example.com --edit

Zone Management Features:

  • View complete DNS zone configuration
  • Bulk DNS record operations
  • Zone file import/export
  • DNS propagation checking

Library Usage:

surge.zone({})(process.argv.slice(2));

DNS Record Operations

Adding DNS Records

A Records (IPv4):

# Point domain to IP address
surge dns example.com add A @ 192.168.1.1

# Point subdomain to IP
surge dns example.com add A www 192.168.1.1

AAAA Records (IPv6):

# Point domain to IPv6 address
surge dns example.com add AAAA @ 2001:db8::1

# Point subdomain to IPv6
surge dns example.com add AAAA www 2001:db8::1

CNAME Records:

# Point subdomain to another domain
surge dns example.com add CNAME api api.example.com

# Point subdomain to Surge
surge dns example.com add CNAME blog blog.example.surge.sh

MX Records (Mail):

# Add mail server
surge dns example.com add MX @ mail.example.com 10

# Add backup mail server
surge dns example.com add MX @ backup.example.com 20

TXT Records:

# Add SPF record
surge dns example.com add TXT @ "v=spf1 include:_spf.google.com ~all"

# Add domain verification
surge dns example.com add TXT @ "verification-code-12345"

# Add DKIM record
surge dns example.com add TXT selector._domainkey "k=rsa; p=public-key-here"

Viewing DNS Records

List All Records:

surge dns example.com

Record Display Format:

ID    Type  Name  Value                TTL   Status
---   ----  ----  -------------------- ----  ------
001   A     @     192.168.1.1          300   Active
002   A     www   192.168.1.1          300   Active  
003   CNAME api   api.example.com      300   Active
004   MX    @     mail.example.com 10  300   Active
005   TXT   @     "v=spf1..."          300   Active

Removing DNS Records

Remove by ID:

surge dns example.com rem 001

Remove Multiple Records:

surge dns example.com rem 001 002 003

DNS Configuration

Custom Domain Setup

Step 1: Configure DNS

# Point domain to Surge
surge dns example.com add CNAME @ example.surge.sh

# Or use A record if CNAME not supported for apex
surge dns example.com add A @ 45.55.110.124

Step 2: Deploy to Domain

# Deploy project to custom domain
surge ./build example.com

Step 3: Verify Configuration

# Check DNS propagation
dig example.com

# Verify HTTPS
curl -I https://example.com

Subdomain Configuration

Multiple Subdomains:

# API subdomain
surge dns example.com add CNAME api api.example.surge.sh

# Blog subdomain
surge dns example.com add CNAME blog blog.example.surge.sh

# CDN subdomain
surge dns example.com add CNAME cdn cdn.example.surge.sh

Email Configuration

Google Workspace:

# MX records for Gmail
surge dns example.com add MX @ aspmx.l.google.com 1
surge dns example.com add MX @ alt1.aspmx.l.google.com 5
surge dns example.com add MX @ alt2.aspmx.l.google.com 5

# SPF record
surge dns example.com add TXT @ "v=spf1 include:_spf.google.com ~all"

Custom Mail Server:

# Primary mail server
surge dns example.com add MX @ mail.example.com 10

# Backup mail server  
surge dns example.com add MX @ backup.example.com 20

# SPF record
surge dns example.com add TXT @ "v=spf1 mx ~all"

Advanced DNS Features

DNS Propagation

Check Propagation Status:

# Check DNS propagation globally
dig @8.8.8.8 example.com
dig @1.1.1.1 example.com

# Check from multiple locations
nslookup example.com 8.8.8.8
nslookup example.com 1.1.1.1

Propagation Timing:

  • TTL: Time-to-live affects propagation speed
  • Global Propagation: Can take 24-48 hours
  • Local Cache: Clear DNS cache for testing

Load Balancing

Round Robin DNS:

# Multiple A records for load balancing
surge dns example.com add A @ 192.168.1.1
surge dns example.com add A @ 192.168.1.2
surge dns example.com add A @ 192.168.1.3

Geographic Distribution:

# Different servers for different regions
surge dns example.com add A us 192.168.1.1
surge dns example.com add A eu 192.168.2.1
surge dns example.com add A asia 192.168.3.1

DNS Security

CAA Records (Certificate Authority Authorization):

# Allow only specific CAs to issue certificates
surge dns example.com add CAA @ "0 issue letsencrypt.org"
surge dns example.com add CAA @ "0 issuewild letsencrypt.org"

DMARC Policy:

# Email authentication policy
surge dns example.com add TXT _dmarc "v=DMARC1; p=reject; rua=mailto:dmarc@example.com"

DNS Best Practices

Record Management

  1. Use Appropriate TTL: Balance between performance and flexibility
  2. Monitor Changes: Track DNS record modifications
  3. Test Before Deployment: Verify DNS changes in staging
  4. Document Records: Keep record of all DNS configurations

Performance Optimization

  1. Short TTL for Testing: Use low TTL during testing, increase for production
  2. CNAME Chains: Avoid long CNAME chains that slow resolution
  3. Multiple A Records: Use for redundancy and load distribution
  4. Geographic DNS: Consider geographic distribution for global users

Security Considerations

  1. Secure DNS Providers: Use reputable DNS providers
  2. Monitor Changes: Set up alerts for DNS modifications
  3. Access Control: Limit who can modify DNS records
  4. DNSSEC: Consider DNSSEC for additional security

Troubleshooting

Common DNS Issues

DNS Not Propagating:

  • Check TTL settings
  • Verify record syntax
  • Clear local DNS cache
  • Test from multiple locations

Wrong IP Resolution:

  • Check A/AAAA record values
  • Verify CNAME targets
  • Check for conflicting records

Email Not Working:

  • Verify MX record priorities
  • Check SPF record syntax
  • Test mail server connectivity

Debugging Tools

Command Line Tools:

# Query DNS records
dig example.com
nslookup example.com

# Check MX records
dig MX example.com

# Check TXT records
dig TXT example.com

# Trace DNS resolution
dig +trace example.com

Online Tools:

  • DNS Checker websites
  • MX Toolbox for mail testing
  • SSL Labs for certificate verification
  • DNS propagation checkers

Error Resolution

Record Not Found:

  • Verify record was created successfully
  • Check DNS propagation status
  • Confirm correct record type

Invalid Record Format:

  • Check record syntax
  • Verify value format for record type
  • Ensure proper escaping of special characters

Access Denied:

  • Verify domain ownership
  • Check user permissions
  • Ensure proper authentication

Install with Tessl CLI

npx tessl i tessl/npm-surge

docs

account.md

analytics.md

authentication.md

collaboration.md

configuration.md

dns.md

index.md

publishing.md

revisions.md

ssl.md

tile.json