Skip to content

Commit

Permalink
[#730] Add Remote-Node support (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
yohamta authored Dec 6, 2024
1 parent a3bda7b commit 39169e8
Show file tree
Hide file tree
Showing 24 changed files with 448 additions and 64 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Dagu is a powerful Cron alternative that comes with a Web UI. It allows you to d
- [3. Edit the DAG](#3-edit-the-dag)
- [4. Execute the DAG](#4-execute-the-dag)
- [**CLI**](#cli)
- [**Remote Node Management support**](#remote-node-management-support)
- [Configuration](#configuration)
- [**Localized Documentation**](#localized-documentation)
- [**Documentation**](#documentation)
- [**Running as a daemon**](#running-as-a-daemon)
Expand Down Expand Up @@ -92,6 +94,10 @@ Dagu is a powerful Cron alternative that comes with a Web UI. It allows you to d
- Sending emails
- Running jq command
- Executing remote commands via SSH
- Remote Node support for managing multiple Dagu instances:
- Monitor DAGs across different environments
- Switch between nodes through UI dropdown
- Centralized management interface
- Email notification
- Scheduling with Cron expressions
- REST API Interface
Expand Down Expand Up @@ -253,6 +259,29 @@ dagu scheduler [--dags=<path to directory>]
dagu version
```

## **Remote Node Management support**

Dagu supports managing multiple Dagu servers from a single UI through its remote node feature. This allows you to:

- Monitor and manage DAGs across different environments (dev, staging, prod)
- Access multiple Dagu instances from a centralized UI
- Switch between nodes easily through the UI dropdown

See [Remote Node Configuration](https://dagu.readthedocs.io/en/latest/config_remote.html) for more details.

### Configuration

Remote nodes can be configured by creating `admin.yaml` in `$HOME/.config/dagu/`:

```yaml
# admin.yaml
remoteNodes:
- name: "prod" # Name of the remote node
apiBaseUrl: "https://prod.example.com/api/v1" # Base URL of the remote node API
- name: "staging"
apiBaseUrl: "https://staging.example.com/api/v1"
```

## **Localized Documentation**

- [中文文档 (Chinese Documentation)](https://dagu.readthedocs.io/zh)
Expand Down Expand Up @@ -289,6 +318,7 @@ dagu version
- [JSON Processing](https://dagu.readthedocs.io/en/latest/examples.html#querying-json-data-with-jq)
- [Email](https://dagu.readthedocs.io/en/latest/examples.html#sending-email)
- [Configurations](https://dagu.readthedocs.io/en/latest/config.html)
- [Remote Node](https://dagu.readthedocs.io/en/latest/config_remote.html)
- [Scheduler](https://dagu.readthedocs.io/en/latest/scheduler.html)
- [Docker Compose](https://dagu.readthedocs.io/en/latest/docker-compose.html)
- [REST API Documentation](https://app.swaggerhub.com/apis/YOHAMTA_1/dagu)
Expand Down
42 changes: 42 additions & 0 deletions docs/source/config_remote.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.. _Remote Node Configuration:

Remote Node
===========

.. contents::
:local:

Introduction
-------------
Dagu UI can be configured to connect to remote nodes, allowing management of DAGs across different environments from a single interface.

How to configure
----------------
Create ``admin.yaml`` in ``$HOME/.config/dagu/`` to configure remote nodes. Example configuration:

.. code-block:: yaml
# Remote Node Configuration
remoteNodes:
- name: "dev" # name of the remote node
apiBaseUrl: "http://localhost:8080/api/v1" # Base API URL of the remote node it must end with /api/v1
# Authentication settings for the remote node
# Basic authentication
isBasicAuth: true # Enable basic auth (optional)
basicAuthUsername: "admin" # Basic auth username (optional)
basicAuthPassword: "secret" # Basic auth password (optional)
# api token authentication
isAuthToken: true # Enable API token (optional)
authToken: "your-secret-token" # API token value (optional)
Using Remote Nodes
-----------------
Once configured, remote nodes can be selected from the dropdown menu in the top right corner of the UI. This allows you to:

- Switch between different environments
- View and manage DAGs on remote nodes
- Monitor execution status across nodes

The UI will maintain all functionality while operating on the selected remote node.
4 changes: 4 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ Quick Start
:ref:`Configuration Options`
Configuration options.

:ref:`Remote Node Configuration`
Remote Node Configuration.

.. toctree::
:caption: Installation
:hidden:
Expand Down Expand Up @@ -75,6 +78,7 @@ Quick Start
:hidden:

config
config_remote
scheduler
auth
email
Expand Down
13 changes: 13 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (

// Config represents the configuration for the server.
type Config struct {
RemoteNodes []RemoteNode // Remote node API URLs (e.g., http://localhost:8080/api/v1)
Host string // Server host
Port int // Server port
DAGs string // Location of DAG files
Expand Down Expand Up @@ -62,6 +63,18 @@ type Config struct {
MaxDashboardPageLimit int // The default page limit for the dashboard
}

// RemoteNode is the configuration for a remote host that can be proxied by the server.
// This is useful for fetching data from a remote host and displaying it on the server.
type RemoteNode struct {
Name string // Name of the remote host
APIBaseURL string // Base URL for the remote host API (e.g., http://localhost:9090/api/v1)
IsBasicAuth bool // Enable basic auth
BasicAuthUsername string // Basic auth username
BasicAuthPassword string // Basic auth password
IsAuthToken bool // Enable auth token for API
AuthToken string // Auth token for API
}

type TLS struct {
CertFile string
KeyFile string
Expand Down
Loading

0 comments on commit 39169e8

Please sign in to comment.