Alienos - Nostr Relay Installation Guide with Docker Compose and Nginx Proxy Manager

Alienos is a performant and easy-to-deploy Nostr relay. This guide explains how to install and configure it with Docker Compose using Nginx Proxy Manager for SSL certificate management and reverse proxy.
Alienos - Nostr Relay Installation Guide with Docker Compose and Nginx Proxy Manager

Alienos - Nostr Relay Installation Guide with Docker Compose and Nginx Proxy Manager

Prerequisites

  • Docker and Docker Compose installed on your server
  • A domain name pointing to your server
  • Ports 80, 443, and 81 available on your server
  • Root or sudo access on your server

Step 1: Environment Preparation

Create working directory

mkdir alienos-nostr
cd alienos-nostr

Create data directories

mkdir -p alienos_data
mkdir -p nginx-proxy-manager
mkdir -p nginx-proxy-manager/letsencrypt

Step 2: Docker Compose Configuration

Create the docker-compose.yml file:

services:

  alienos:
    container_name: alienos
    image: dezhtech/alienos:latest
    restart: unless-stopped
    ports:
      - "7771:7771"
    environment:
      ALIENOS_WORK_DIR: "alienos_wd/"
      ALIENOS_RELAY_NAME: "My Nostr Relay"
      ALIENOS_RELAY_ICON: "!(image)[ https://example.com/icon.webp]"
      ALIENOS_RELAY_BANNER: "!(image)[ https://example.com/banner.webp]"
      ALIENOS_RELAY_DESCRIPTION: "Your Nostr relay description"
      ALIENOS_RELAY_PUBKEY: "your_nostr_public_key"
      ALIENOS_RELAY_CONTACT: "contact@your-domain.com"
      ALIENOS_RELAY_SELF: "your_personal_public_key"
      ALIENOS_RELAY_PORT: 7771
      ALIENOS_RELAY_BIND: "0.0.0.0"
      ALIENOS_RELAY_URL: "your-domain.com"
      ALIENOS_BACKUP_ENABLE: "false"
      ALIENOS_BACKUP_INTERVAL_HOURS: 24
      ALIENOS_S3_ACCESS_KEY_ID: ""
      ALIENOS_S3_SECRET_KEY: ""
      ALIENOS_S3_ENDPOINT: ""
      ALIENOS_S3_REGION: ""
      ALIENOS_S3_BUCKET_NAME: "alienos-relay-backups"
      ALIENOS_S3_AS_BLOSSOM_STORAGE: "false"
      ALIENOS_S3_BLOSSOM_BUCKET: "alienos-blossom"
      ALIENOS_PUBKEY_WHITE_LISTED: "false"
      ALIENOS_KIND_WHITE_LISTED: "false"
      ALIENOS_ADMINS: "your_admin_key"
    volumes:
      - ./alienos_data:/app/alienos_wd/

  nginx-proxy-manager:
    container_name: nginx-proxy-manager
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./nginx-proxy-manager:/data
      - ./nginx-proxy-manager/letsencrypt:/etc/letsencrypt

Step 3: Environment Variables Configuration

Important variables to customize:

  • ALIENOS_RELAY_NAME: Your relay name
  • ALIENOS_RELAY_DESCRIPTION: Your relay description
  • ALIENOS_RELAY_PUBKEY: Your Nostr public key (hex format)
  • ALIENOS_RELAY_CONTACT: Your contact email
  • ALIENOS_RELAY_URL: Your domain name
  • ALIENOS_ADMINS: Administrator public key

Getting your Nostr public key:

You can use a Nostr client like Damus, Amethyst, or a command-line tool to generate or retrieve your public key.

Step 4: Starting Services

Launch containers

docker-compose up -d

Check status

docker-compose ps
docker-compose logs alienos
docker-compose logs nginx-proxy-manager

Step 5: Nginx Proxy Manager Configuration

Access web interface

  1. Open your browser and go to http://your-server:81
  2. Login with default credentials:
    • Email: admin@example.com
    • Password: changeme

Change password

  1. Go to “Users” → “Edit” on your profile
  2. Change email and password

Create proxy host

  1. Go to “Hosts” → “Proxy Hosts”
  2. Click “Add Proxy Host”
  3. Fill in the information:
    • Domain Names: your-domain.com
    • Scheme: http
    • Forward Hostname/IP: alienos
    • Forward Port: 7771
    • Check “Block Common Exploits”
    • Check “Websockets Support”

SSL Configuration

  1. In the “SSL” tab:

    • Select “Request a new SSL Certificate”
    • Check “Force SSL”
    • Check “HTTP/2 Support”
    • Enter your email
    • Check “I Agree to the Let’s Encrypt Terms of Service”
  2. Click “Save”

Step 6: Test Your Relay

WebSocket verification

Test your relay with a Nostr client or use an online tool:

# WebSocket connection test
wscat -c wss://your-domain.com

Test with Nostr client

  1. Open your preferred Nostr client
  2. Add your relay: wss://your-domain.com
  3. Verify the connection is established correctly

Step 7: Maintenance and Monitoring

Container logs

# Alienos logs
docker-compose logs -f alienos

# Nginx Proxy Manager logs
docker-compose logs -f nginx-proxy-manager

Updates

# Stop services
docker-compose down

# Update images
docker-compose pull

# Restart
docker-compose up -d

Backup

# Backup Alienos data
tar -czf alienos-backup-$(date +%Y%m%d).tar.gz alienos_data/

# Backup Nginx Proxy Manager configuration
tar -czf npm-backup-$(date +%Y%m%d).tar.gz nginx-proxy-manager/

Advanced Configuration

Enable S3 backups

To enable automatic S3 backups, modify environment variables:

ALIENOS_BACKUP_ENABLE: "true"
ALIENOS_S3_ACCESS_KEY_ID: "your_access_key"
ALIENOS_S3_SECRET_KEY: "your_secret_key"
ALIENOS_S3_ENDPOINT: "s3.amazonaws.com"
ALIENOS_S3_REGION: "us-east-1"
ALIENOS_S3_BUCKET_NAME: "my-alienos-bucket"

Public key whitelist

To restrict access to certain public keys:

ALIENOS_PUBKEY_WHITE_LISTED: "true"

Then add authorized keys in the Alienos configuration file.

Troubleshooting

Common issues

  1. WebSocket connection error:

    • Check that port 7771 is accessible
    • Verify proxy configuration in Nginx Proxy Manager
  2. SSL certificate not generated:

    • Verify your domain points to your server
    • Check that ports 80 and 443 are open
  3. Alienos won’t start:

    • Check logs: docker-compose logs alienos
    • Verify alienos_data directory permissions

Useful commands

# Restart specific service
docker-compose restart alienos

# View resource usage
docker stats

# Clean unused images
docker system prune

Security Best Practices

Firewall configuration

# Allow only necessary ports
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 81/tcp
sudo ufw enable

Regular updates

  • Keep Docker images updated
  • Monitor security advisories
  • Regular backup verification

Monitoring

Consider implementing:

  • Log aggregation (ELK stack, Grafana)
  • Uptime monitoring
  • Resource usage alerts

Performance Optimization

Docker resource limits

Add resource limits to your docker-compose.yml:

alienos:
  # ... other configuration
  deploy:
    resources:
      limits:
        memory: 512M
        cpus: '0.5'
      reservations:
        memory: 256M
        cpus: '0.25'

Database optimization

For high-traffic relays, consider:

  • Regular database maintenance
  • Index optimization
  • Connection pooling

Conclusion

Your Alienos Nostr relay is now operational with automatic SSL thanks to Nginx Proxy Manager. Don’t forget to:

  • Monitor logs regularly
  • Perform regular backups
  • Update Docker images
  • Set up appropriate monitoring for production environments

Your relay now contributes to the decentralized Nostr network!

Additional Resources


Write a comment
No comments yet.