Skip to content

Latest commit

 

History

History
478 lines (329 loc) · 14.2 KB

File metadata and controls

478 lines (329 loc) · 14.2 KB

Anytype Self-Hosted Server Setup - Complete

Server: simplemap.safecast.org (65.108.24.131)
Date: February 19, 2026
Status:COMPLETE AND WORKING


Summary

Successfully set up an Anytype self-hosted sync server on Ubuntu 24.04 VPS using:

  • any-sync-bundle v1.3.1-2026-02-16
  • MongoDB 7.0 (with replica set)
  • RedisStack 7.4 (with Bloom filter module)

Prerequisites

  • VPS: Ubuntu 24.04.4 LTS (x86_64)
  • SSH access: ssh root@simplemap.safecast.org
  • Domain: simplemap.safecast.org → 65.108.24.131

Step-by-Step Commands Executed

Step 1: System Update

ssh root@simplemap.safecast.org "sudo apt update && sudo apt upgrade -y"

Step 2: Install MongoDB

# Add MongoDB GPG key
ssh root@simplemap.safecast.org "curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | sudo gpg --dearmor -o /usr/share/keyrings/mongodb-server-7.0.gpg"

# Add MongoDB repository
ssh root@simplemap.safecast.org "echo 'deb [ arch=amd64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list"

# Install MongoDB
ssh root@simplemap.safecast.org "sudo apt update && sudo apt install -y mongodb-org"

# Enable and start MongoDB
ssh root@simplemap.safecast.org "sudo systemctl enable --now mongod"

Step 3: Configure MongoDB Replica Set

# Stop MongoDB
ssh root@simplemap.safecast.org "sudo systemctl stop mongod"

# Start MongoDB with replica set mode
ssh root@simplemap.safecast.org "sudo mongod --replSet rs0 --bind_ip 127.0.0.1 --dbpath /var/lib/mongodb --fork --logpath /var/log/mongodb/mongod.log"

# Initialize replica set
ssh root@simplemap.safecast.org "mongosh --eval 'rs.initiate({_id: \"rs0\", members: [{_id: 0, host: \"127.0.0.1:27017\"}]})'"

# Add replication config to MongoDB
ssh root@simplemap.safecast.org "sudo bash -c 'echo -e \"\\n# Replication\\nreplication:\\n  replSetName: rs0\" >> /etc/mongod.conf'"

# Fix permissions and restart
ssh root@simplemap.safecast.org "sudo chown -R mongodb:mongodb /var/lib/mongodb && sudo chown -R mongodb:mongodb /var/log/mongodb && sudo systemctl start mongod"

Step 4: Install RedisStack (with Bloom Filter)

# Add Redis official repository
ssh root@simplemap.safecast.org "curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg"
ssh root@simplemap.safecast.org "echo 'deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb bullseye main' | sudo tee /etc/apt/sources.list.d/redis.list"

# Install RedisStack
ssh root@simplemap.safecast.org "sudo apt update && sudo apt install -y redis-stack-server"

# Install libssl1.1 dependency (required for RedisStack)
ssh root@simplemap.safecast.org "wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb && sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb"

# Enable and start RedisStack
ssh root@simplemap.safecast.org "sudo systemctl enable --now redis-stack-server"

# Verify Bloom filter module is loaded
ssh root@simplemap.safecast.org "redis-cli MODULE LIST"

Step 5: Download and Install any-sync-bundle

# Download latest version
ssh root@simplemap.safecast.org "curl -LO https://github.com/grishy/any-sync-bundle/releases/download/v1.3.1-2026-02-16/any-sync-bundle_1.3.1-2026-02-16_linux_amd64.tar.gz"

# Extract and install
ssh root@simplemap.safecast.org "tar -xzf any-sync-bundle_1.3.1-2026-02-16_linux_amd64.tar.gz"
ssh root@simplemap.safecast.org "sudo mv any-sync-bundle /usr/local/bin/"
ssh root@simplemap.safecast.org "sudo chmod +x /usr/local/bin/any-sync-bundle"

# Verify installation
ssh root@simplemap.safecast.org "any-sync-bundle --help"

Step 6: Create System User and Directories

ssh root@simplemap.safecast.org "sudo useradd --system --no-create-home --shell /bin/false anytype"
ssh root@simplemap.safecast.org "sudo mkdir -p /var/lib/anytype/data"
ssh root@simplemap.safecast.org "sudo chown -R anytype:anytype /var/lib/anytype"

Step 7: Initialize any-sync-bundle

# Clean up any old configs
ssh root@simplemap.safecast.org "sudo rm -f /var/lib/anytype/bundle-config.yml /var/lib/anytype/data/client-config.yml"
ssh root@simplemap.safecast.org "sudo rm -rf /var/lib/anytype/data/storage"

# Run initialization (generates config files)
ssh root@simplemap.safecast.org "sudo -u anytype any-sync-bundle start-bundle --bundle-config /var/lib/anytype/bundle-config.yml --client-config /var/lib/anytype/data/client-config.yml --initial-storage /var/lib/anytype/data/storage --initial-external-addrs \"simplemap.safecast.org\" --initial-mongo-uri \"mongodb://127.0.0.1:27017/?replicaSet=rs0\" --initial-redis-uri \"redis://127.0.0.1:6379/\""

Step 8: Create systemd Service

ssh root@simplemap.safecast.org "sudo tee /etc/systemd/system/anytype.service > /dev/null << 'ENDOFFILE'
[Unit]
Description=Anytype Self-Hosted Sync Server
After=network.target mongod.service redis-stack-server.service
Requires=mongod.service redis-stack-server.service

[Service]
Type=simple
User=anytype
Group=anytype
ExecStart=/usr/local/bin/any-sync-bundle start-bundle --bundle-config /var/lib/anytype/bundle-config.yml --client-config /var/lib/anytype/data/client-config.yml
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
ENDOFFILE"

# Reload and enable service
ssh root@simplemap.safecast.org "sudo systemctl daemon-reload"
ssh root@simplemap.safecast.org "sudo systemctl enable --now anytype"

Step 9: Verify Services

# Check all services
ssh root@simplemap.safecast.org "echo '=== MongoDB ===' && sudo systemctl status mongod --no-pager | grep -E 'Active|Loaded' && echo '=== RedisStack ===' && sudo systemctl status redis-stack-server --no-pager | grep -E 'Active|Loaded' && echo '=== Anytype ===' && sudo systemctl status anytype --no-pager | grep -E 'Active|Loaded'"

Step 10: Copy Client Configuration

# Copy client config to local machine
scp root@simplemap.safecast.org:/var/lib/anytype/data/client-config.yml ~/anytype-client-config.yml

# View configuration
cat ~/anytype-client-config.yml

Client Configuration File

Location: ~/anytype-client-config.yml

id: 6996fb7874db9ded5e9daba0
networkId: N5Xkmn5vF7cwthDjh6avXem2q1Q56P5xkji19SDU8PQ9m6uD
nodes:
    - peerId: 12D3KooWCDxPTGbLoaBJewKcMRpppKzwG36Zp57evuUBGkcVURhQ
      addresses:
        - quic://simplemap.safecast.org:33020
        - simplemap.safecast.org:33010
        - quic://65.108.24.131:33020
        - 65.108.24.131:33010
      types:
        - coordinator
        - consensus
        - tree
        - file
creationTime: 2026-02-19T12:01:37.702749073Z

Note: The config includes both domain and IP addresses for maximum compatibility.


Required Firewall Ports

IMPORTANT: These ports must be opened in the Hetzner Cloud Firewall:

Port Protocol Component Status
33010 TCP any-sync-node ✅ Open
33020 UDP any-sync-node (QUIC) ✅ Open

Note: Only ports 33010 (TCP) and 33020 (UDP) are required for the any-sync-bundle to function. The bundle consolidates all services into a single process.

Hetzner Firewall Rules (Incoming)

Add these rules in the Hetzner Cloud Console → Security → Firewalls:

Name Protocol Source IP Destination Port Action
anytype-sync TCP 0.0.0.0/0 33010 Accept
anytype-quic UDP 0.0.0.0/0 33020 Accept

Connecting the Anytype Client

  1. Open Anytype app on your Linux/macOS/Windows computer

  2. Log out if already logged in (you need to be on the onboarding screen)

  3. Click the gear icon ⚙️ in the top right corner

  4. Go to Networks → Self-hosted

  5. Click "Tap to provide your network configuration"

  6. Upload the config file: ~/anytype-client-config.yml

  7. Click Save

  8. Log in with your Anytype account credentials

✅ Success Indicators

  • You should see "Connected to self-hosted network" message
  • Your sync status should show as active
  • You can now create/edit objects and they will sync to your server

Troubleshooting Connection Issues

Error: "HTTP response at 400 or 500 level, http status code: 0"

This usually means:

  1. Firewall blocking ports - Ensure ports 33010/tcp and 33020/udp are open in your VPS provider's firewall
  2. Config not loaded - Remove old network config and re-import the client-config.yml file
  3. Version mismatch - Ensure your Anytype client version is compatible with the bundle version

Test connectivity:

# From your local machine
nc -zv 65.108.24.131 33010  # Should succeed
nc -zuv 65.108.24.131 33020 # Should succeed

Regenerate config if needed:

ssh root@simplemap.safecast.org "sudo systemctl stop anytype && sudo rm -f /var/lib/anytype/bundle-config.yml /var/lib/anytype/data/client-config.yml && sudo -u anytype any-sync-bundle start-bundle --bundle-config /var/lib/anytype/bundle-config.yml --client-config /var/lib/anytype/data/client-config.yml --initial-storage /var/lib/anytype/data/storage --initial-external-addrs \"simplemap.safecast.org,65.108.24.131\" --initial-mongo-uri \"mongodb://127.0.0.1:27017/?replicaSet=rs0\" --initial-redis-uri \"redis://127.0.0.1:6379/\" && sudo systemctl start anytype"

# Copy new config
scp root@simplemap.safecast.org:/var/lib/anytype/data/client-config.yml ~/anytype-client-config.yml

Maintenance Commands

View Logs

# Anytype logs
ssh root@simplemap.safecast.org "sudo journalctl -u anytype -f"

# MongoDB logs
ssh root@simplemap.safecast.org "sudo journalctl -u mongod -f"

# RedisStack logs
ssh root@simplemap.safecast.org "sudo journalctl -u redis-stack-server -f"

Check Service Status

ssh root@simplemap.safecast.org "sudo systemctl status anytype mongod redis-stack-server"

Restart Services

# Restart Anytype
ssh root@simplemap.safecast.org "sudo systemctl restart anytype"

# Restart MongoDB
ssh root@simplemap.safecast.org "sudo systemctl restart mongod"

# Restart RedisStack
ssh root@simplemap.safecast.org "sudo systemctl restart redis-stack-server"

Backup

# File storage backup
ssh root@simplemap.safecast.org "sudo tar -czf anytype-backup-$(date +%F).tar.gz /var/lib/anytype/data/storage"

# MongoDB dump
ssh root@simplemap.safecast.org "mongodump --out /var/lib/anytype/backup/mongo-$(date +%F)"

Update any-sync-bundle

# Stop service
ssh root@simplemap.safecast.org "sudo systemctl stop anytype"

# Download new version (update VERSION as needed)
ssh root@simplemap.safecast.org "curl -LO https://github.com/grishy/any-sync-bundle/releases/download/v1.3.1-2026-02-16/any-sync-bundle_1.3.1-2026-02-16_linux_amd64.tar.gz"
ssh root@simplemap.safecast.org "tar -xzf any-sync-bundle_1.3.1-2026-02-16_linux_amd64.tar.gz"
ssh root@simplemap.safecast.org "sudo mv any-sync-bundle /usr/local/bin/"

# Start service
ssh root@simplemap.safecast.org "sudo systemctl start anytype"

Troubleshooting

Test Port Connectivity

# From local machine
nc -zv 65.108.24.131 33010
nc -zuv 65.108.24.131 33020

Check Listening Ports

ssh root@simplemap.safecast.org "ss -tlnp | grep -E '33010|33030|33060|33080'"
ssh root@simplemap.safecast.org "ss -ulnp | grep 33020"

Verify MongoDB Replica Set

ssh root@simplemap.safecast.org "mongosh --eval 'rs.status().ok'"

Verify Redis Modules

ssh root@simplemap.safecast.org "redis-cli MODULE LIST"

Resource Usage

  • MongoDB: ~180MB RAM
  • RedisStack: ~50MB RAM
  • any-sync-bundle: ~25MB RAM
  • Total: ~250-300MB RAM at idle

References


Notes

  • The server is configured to use the domain simplemap.safecast.org instead of IP
  • MongoDB is configured as a single-node replica set (required for change streams)
  • RedisStack includes the Bloom filter module required by any-sync-bundle
  • All services are set to auto-start on boot
  • Configuration files are stored in /var/lib/anytype/

Final Summary

✅ Setup Complete!

Your Anytype self-hosted sync server is now fully operational on simplemap.safecast.org.

What Was Installed

Component Version Status
any-sync-bundle v1.3.1-2026-02-16 ✅ Running
MongoDB 7.0.30 ✅ Running (replica set)
RedisStack 7.4.0-v8 ✅ Running (with Bloom filter)

Server Details

Item Value
Domain simplemap.safecast.org
IP Address 65.108.24.131
Network ID N5Xkmn5vF7cwthDjh6avXem2q1Q56P5xkji19SDU8PQ9m6uD
Peer ID 12D3KooWCDxPTGbLoaBJewKcMRpppKzwG36Zp57evuUBGkcVURhQ
Config File ~/anytype-client-config.yml

Open Ports

Port Protocol Purpose
33010 TCP DRPC sync protocol
33020 UDP QUIC protocol

Resource Usage

  • Total RAM: ~250-300MB at idle
  • CPU: Minimal (< 5% at idle)
  • Disk: Varies based on stored data

Important Files to Backup

# Critical - contains private keys!
/var/lib/anytype/bundle-config.yml

# Your sync data
/var/lib/anytype/data/storage/

# MongoDB data (use mongodump)
/var/lib/mongodb/

Quick Start Commands

# Check all services status
ssh root@simplemap.safecast.org "sudo systemctl status anytype mongod redis-stack-server"

# View live logs
ssh root@simplemap.safecast.org "sudo journalctl -u anytype -f"

# Restart anytype service
ssh root@simplemap.safecast.org "sudo systemctl restart anytype"

# Test port connectivity from local machine
nc -zv 65.108.24.131 33010
nc -zuv 65.108.24.131 33020

References