How to Install Huginn with Docker: A Step-by-Step Guide for Tinkerers


Introduction 

If you're the kind of Linux user who loves automation, self-hosting, and experimenting with new tools, Huginn might be your next favorite project. Think of it as your own personal version of IFTTT, but completely under your control. With Huginn, you can create agents that monitor websites, send notifications, scrape data, and even automate workflows. In this guide, we'll walk through deploying Huginn using Docker Compose. It's a fairly straightforward setup, but we’ll dive into the details to make sure everything runs smoothly. By the end, you'll have a fully functional Huginn instance ready for automation magic.


What is Huginn? 

Huginn is an open-source system for building agents that perform automated tasks online. These agents can do things like:

  • Monitor websites for changes
  • Send email or chat notifications
  • Scrape web pages
  • Interact with APIs
  • Automate workflows with conditional logic
  • It’s extremely customizable and extendable, making it a powerful tool for developers, tinkerers, and automation enthusiasts. There are quite a few docs on the github for Huginn as well, at https://github.com/huginn/huginn


    Prerequisites Before we begin, make sure you have the following:
  • A Linux machine (Ubuntu, Debian, etc.)
  • Git installed
  • Docker and Docker Compose installed
  • Basic terminal skills
  • If Docker isn’t installed yet, you can follow the official Docker installation guide.


    Step 1: Clone the Huginn Repository First, open your terminal and clone the official Huginn repository: 

    git clone https://github.com/huginn/huginn.git  

    cd huginn/docker/multi-process 

    This will give you access to the Docker Compose configuration files included with the project. We are using the multi-process version so that the database runs in its own container.


    Step 2: Configure the Environment 

     Huginn uses environment variables to configure things like timezone, domain, and secrets. 

    The Docker Compose file specifically calls the file secrets.env in the parent directory of multi-process. 

    The important things in secrets.env include your e-mail and API keys for some services. 

    • INVITATION_CODE=secret-invite-code 
    • SMTP_SERVER=smtp.mailgun.org 
    • SMTP_USER_NAME=huginn@example.com 
    • SMTP_PASSWORD=<secret password>
    • EMAIL_FROM_ADDRESS=huginn@example.com 

    Additionally, you will need to choose which database you will use. This example assumes you are using PostgreSQL. The configuration file for that is postgres.env

    • POSTGRES_PASSWORD=<secret password>
    • POSTGRES_USER=huginn 
    • HUGINN_DATABASE_PASSWORD=<secret password>
    • HUGINN_DATABASE_USERNAME=huginn 
    • HUGINN_DATABASE_NAME=huginn 

    Make sure to set your database passwords appropriately.


    Step 3: Start Huginn with Docker Compose 

    With everything in place, you can spin up the Huginn containers: 

     docker-compose up -d 

    Docker will pull the required images, set up the containers, and run Huginn in the background. 

    You can check the status with:  

    docker ps


    Step 4: Accessing Huginn 

     Once everything is up and running, open your browser and go to: 

     http://localhost:3000 

    Login with the default credentials: 

    • Email: admin 
    • Password: password 

    Be sure to change your credentials immediately after logging in.


    Step 5: Setting Up Persistent Storage 

     By default, Huginn stores data in containers, which means you’ll lose it if the containers are removed. To make data persistent, modify your docker-compose.yml to include 

    volumes:  

    volumes: - huginn-data:/var/lib/mysql  

    volumes: huginn-data: 

    This ensures your MySQL data survives container restarts.


    Step 6: (Optional) Running Behind a Reverse Proxy 

    If you want to access Huginn via a custom domain with HTTPS, setting up a reverse proxy like Nginx or Traefik is recommended. 

    Here’s a basic Nginx config snippet:  

    server {
       
    listen 80;
        server_name huginn.yourdomain.com;

           
    location / {
                    proxy_pass http://localhost:3000;
                    proxy_set_header Host $host;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header X-Forwarded-Proto $scheme;
            }
    } 

    Combine this with Let's Encrypt for HTTPS and you're good to go.


    Step 7: Useful Tips & Troubleshooting 

    • View logs: 
    • docker-compose logs -f 
    • Restart containers: 
    • docker-compose restart 
    • Database errors? Make sure the password in .env matches the one used by MySQL. 
    • Port conflicts? You can change the exposed ports in docker-compose.yml.


    Conclusion 

    That’s it! You now have Huginn running in Docker using Docker Compose. From here, you can start building your own agents or importing scenarios from the community. Huginn is a powerful playground for automation fans, and this setup is a solid foundation to build on. Have fun automating, and don’t forget to share your favorite use cases!

    Comments

    Popular posts from this blog

    Growth Industry next decade

    Change for the sake of change