Skip to main content
Version: Next

Configure the Development Environment

This document describes how to configure a local development environment for Dragonfly.

Prerequisites

NameVersionDocument
Git1.9.1+git-scm
Golang1.16.xgo.dev
Rust1.6+rustup.rs
DatabaseMysql 5.6+ OR PostgreSQL 12+mysql OR postgresql
Redis3.0+redis.io

Clone Dragonfly

Clone the source code of Dragonfly:

git clone --recurse-submodules https://github.com/dragonflyoss/Dragonfly2.git
cd Dragonfly2

Clone the source code of Client:

git clone https://github.com/dragonflyoss/client.git
cd client

Operation

Manager

Setup Manager

Configure Manager yaml file, The default path in Linux is /etc/dragonfly/manager.yaml in linux, refer to Manager.

Set the database.mysql.addrs and database.redis.addrs address in the configuration file to your actual address. Configuration content is as follows:

# Manager configuration.
database:
type: mysql
mysql:
user: dragonfly-mysql
password: your_mysql_password
host: your_mysql_host
port: your_mysql_port
dbname: manager
migrate: true
redis:
addrs:
- dragonfly-redis
masterName: your_redis_master_name
username: your_redis_username
password: your_redis_passwprd
db: 0
brokerDB: 1
backendDB: 2

Run Manager:

Notice : Run Manager under Dragonfly2

# Setup Manager.
go run cmd/manager/main.go --config /etc/dragonfly/manager.yaml --verbose --console

Verify

After the Manager deployment is complete, run the following commands to verify if Manager is started, and if Port 8080 and 65003 is available.

telnet 127.0.0.1 8080
telnet 127.0.0.1 65003

Scheduler

Setup Scheduler

Configure Scheduler yaml file, The default path in Linux is /etc/dragonfly/scheduler.yaml in linux, refer to Scheduler.

Set the database.redis.addrs and manager.addr address in the configuration file to your actual address. Configuration content is as follows:

# Scheduler configuration.
database:
redis:
addrs:
- dragonfly-redis
masterName: your_redis_master_name
username: your_redis_username
password: your_redis_password
brokerDB: 1
backendDB: 2
networkTopologyDB: 3
manager:
addr: 127.0.0.1:65003
schedulerClusterID: 1
keepAlive:
interval: 5s

Run Scheduler:

Notice : Run Scheduler under Dragonfly2

# Setup Scheduler.
go run cmd/scheduler/main.go --config /etc/dragonfly/scheduler.yaml --verbose --console

Verify

After the Scheduler deployment is complete, run the following commands to verify if Scheduler is started, and if Port 8002 is available.

telnet 127.0.0.1 8002

Dfdaemon

Setup Dfdaemon as Seed Peer

Configure Dfdaemon yaml file, The default path in Linux is /etc/dragonfly/dfdaemon.yaml in linux, refer to Dfdaemon.

Set the manager.addrs address in the configuration file to your actual address. Configuration content is as follows:

# Seed Peer configuration.
manager:
addrs:
- http://127.0.0.1:65003
seedPeer:
enable: true
type: super
clusterID: 1

Run Dfdaemon as Seed Peer:

Notice : Run Dfdaemon under Client

# Setup Dfdaemon.
cargo run --bin dfdaemon -- --config /etc/dragonfly/dfdaemon.yaml -l info --verbose

Verify

After the Seed Peer deployment is complete, run the following commands to verify if Seed Peer is started, and if Port 4000, 4001 and 4002 is available.

telnet 127.0.0.1 4000
telnet 127.0.0.1 4001
telnet 127.0.0.1 4002

Setup Dfdaemon as Peer

Configure Dfdaemon yaml file, The default path in Linux is /etc/dragonfly/dfdaemon.yaml in linux, refer to Dfdaemon.

Set the manager.addrs address in the configuration file to your actual address. Configuration content is as follows:

# Peer configuration.
manager:
addrs:
- http://127.0.0.1:65003

Run Dfdaemon as Peer:

Notice : Run Dfdaemon under Client

# Setup Dfdaemon.
cargo run --bin dfdaemon -- --config /etc/dragonfly/dfdaemon.yaml -l info --verbose

Verify

After the Peer deployment is complete, run the following commands to verify if Peer is started, and if Port 4000, 4001 and 4002 is available.

telnet 127.0.0.1 4000
telnet 127.0.0.1 4001
telnet 127.0.0.1 4002