Skip to content

pxdogbo/opennode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opennode

Self-hosted Dify deployment on Hetzner using Docker Compose.

Overview

This repo contains everything you need to deploy Dify on a Hetzner VPS. It uses the official Dify Docker Compose setup with an nginx reverse proxy and optional SSL via Certbot.

Requirements

  • Hetzner VPS: CX22 or larger (2 vCPU, 4 GB RAM minimum — 4 GB RAM / 8 GB recommended for production)
    • Ubuntu 22.04 or 24.04
      • A domain pointed at your server's IP (for SSL)

      • Quick Start

      • 1. Provision your Hetzner server

      • Create a CX22 (or larger) server in the Hetzner Cloud Console with Ubuntu 22.04. Add your SSH key during creation.

      • 2. Run the bootstrap script on your server

      • ssh root@YOUR_SERVER_IP
        bash <(curl -fsSL https://raw.githubusercontent.com/pxdogbo/opennode/main/setup.sh)

        This installs Docker, Docker Compose, clones this repo to /opt/opennode, and sets everything up.

        3. Configure your environment

        cd /opt/opennode
        cp .env.example .env
        nano .env  # fill in your domain, secret keys, etc.

        Key variables to set:

        Variable Description
        DOMAIN Your domain name (e.g. dify.example.com)
        SECRET_KEY Random secret — run openssl rand -hex 32
        DB_PASSWORD Strong password for PostgreSQL
        REDIS_PASSWORD Strong password for Redis

        4. Start Dify

        docker compose up -d

        5. SSL (optional but recommended)

        # Certbot is included in the compose file
        docker compose run --rm certbot certonly --webroot \
          --webroot-path /var/www/certbot \
          -d YOUR_DOMAIN --email YOUR_EMAIL --agree-tos

        Then uncomment the HTTPS server block in nginx/conf.d/default.conf and restart nginx:

        docker compose restart nginx

        Upgrading Dify

        cd /opt/opennode
        git pull
        docker compose pull
        docker compose up -d
        # Optional: sync new .env variables
        bash dify-env-sync.sh

        File Structure

        opennode/
        ├── docker-compose.yml       # Main compose file
        ├── .env.example             # All configurable variables
        ├── .env                     # Your local config (gitignored)
        ├── nginx/
        │   └── conf.d/
        │       └── default.conf     # nginx reverse proxy config
        ├── dify-env-sync.sh         # Helper to sync .env with upstream
        └── setup.sh                 # Server bootstrap script
        

        Recommended Hetzner Specs

        Use Case Server RAM Cost
        Personal / testing CX22 4 GB ~€4/mo
        Small team CX32 8 GB ~€8/mo
        Production CX42 16 GB ~€17/mo

        Data & Backups

        All persistent data lives in Docker named volumes. To back up:

        # Backup Postgres
        docker compose exec db pg_dump -U postgres dify > dify_backup_$(date +%Y%m%d).sql
        
        # Backup all volumes (more thorough)
        docker run --rm -v opennode_db_data:/data -v $(pwd):/backup \
          ubuntu tar czf /backup/db_data_$(date +%Y%m%d).tar.gz /data

        Troubleshooting

        • Containers not starting: check logs with docker compose logs -f
          • Out of memory: upgrade your Hetzner server or disable unused vector DB services in .env
            • SSL not working: make sure ports 80 and 443 are open in Hetzner Firewall rules

About

Self-hosted Dify deployment on Hetzner using Docker Compose

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages