docs/docs/en/contribute/development-environment-setup.md
Before setting up the DolphinScheduler development environment, please make sure you have installed the software as below:
Download the git repository through your git management tool, here we use git-core as an example
mkdir dolphinscheduler
cd dolphinscheduler
git clone [email protected]:apache/dolphinscheduler.git
Supporting system:
Run ./mvnw clean install -Prelease -Dmaven.test.skip=true
DolphinScheduler uses Spotless for backend code style and formatting checks.
You could run the following command and Spotless will automatically fix
the backend code style and formatting errors for you:
./mvnw spotless:apply
We also have provided a pre-commit config file for easy configuration. To use it, you need to have python installed
and then install pre-commit by running the following command:
python -m pip install pre-commit
After that, you can run the following command to install the pre-commit hook:
pre-commit install
Now, every time you commit your code, pre-commit will automatically run Spotless to check the code style and formatting.
DolphinScheduler uses pnpm to check and automatically fix frontend code style and formatting issues.
First, navigate to the frontend project directory:
cd dolphinscheduler-ui
Then, run the following commands to automatically fix ESLint-fixable issues and format the code:
pnpm run lint # Fix ESLint issues
pnpm run prettier # Format code
Finally, you can run the following command to perform a full TypeScript type check and catch type-related errors early:
pnpm exec vue-tsc --noEmit # Type check
After modifying files related to Helm templates, you can use the following command to debug the Helm templates:
helm template ./deploy/kubernetes/dolphinscheduler --debug
Once the Helm templates are debugged and verified, use the following command to automatically update the README.md file (manually updating may likely result in incorrect formatting):
./mvnw validate -P helm-doc -pl :dolphinscheduler
DolphinScheduler will release new Docker images after it released, you could find them in Docker Hub.
-Pstaging contains plugins, suitable for development and testing as well as offline deployment without a network environment -Prelease does not contain plugins, suitable for production environments, and plugins can be downloaded on demand from a network that can access plugins
cd dolphinscheduler
./mvnw -B clean package \
-Dmaven.test.skip \
-Dspotless.skip = true \
-Ddocker.tag=<TAG> \
-Pdocker,[release|staging]
When the command is finished you could find them by command docker images.
cd dolphinscheduler
./mvnw -B clean deploy \
-Dmaven.test.skip \
-Dspotless.skip = true \
-Ddocker.tag=<TAG> \
-Ddocker.hub=<HUB_URL> \
-Pdocker,[release|staging]
cd dolphinscheduler
find . -iname 'Dockerfile'
Then run the Docker build command above
FROM dolphinscheduler-standalone-server
RUN apt update ; \
apt install -y <YOUR-CUSTOM-DEPENDENCE> ; \
Note: Docker will build and push linux/amd64,linux/arm64 multi-architecture images by default
Have to use version after Docker 19.03, because after 19.03 docker contains buildx
There are two ways to configure the DolphinScheduler development environment, standalone mode and normal mode
Note: Use standalone server only for development and debugging, because it uses H2 Database as default database and Zookeeper Testing Server which may not be stable in production.
Standalone is only supported in DolphinScheduler 1.3.9 and later versions.
Standalone server is able to connect to external databases like mysql and postgresql, see Standalone Deployment for instructions.
Use different Git branch to develop different codes
1.3.9-release.dev.Find the class org.apache.dolphinscheduler.StandaloneServer in IntelliJ IDEA and click run main function to startup.
Note: Please check the option
Add dependencies with "provided" scope to classpathin the startup configuration before starting, so as to avoid the problem that no dependencies can be found during startup.
Install frontend dependencies and run it.
Note: You can see more detail about the frontend setting in frontend development.
If you have not yet installed pnpm, you can install it using the following command before running the front-end component:
npm install -g pnpm
After ensuring that pnpm has been installed, run the following command:
cd dolphinscheduler-ui
pnpm install
pnpm run dev
The browser access address http://localhost:5173 can login DolphinScheduler UI. The default username and password are admin/dolphinscheduler123
Download ZooKeeper, and extract it.
Create directory zkData and zkLog
Go to the zookeeper installation directory, copy configure file zoo_sample.cfg to conf/zoo.cfg, and change value of dataDir in conf/zoo.cfg to dataDir=./tmp/zookeeper
# We use path /data/zookeeper/data and /data/zookeeper/datalog here as example
dataDir=/data/zookeeper/data
dataLogDir=/data/zookeeper/datalog
Run ./bin/zkServer.sh in terminal by command ./bin/zkServer.sh start.
The DolphinScheduler's metadata is stored in relational database. Currently supported MySQL and Postgresql. We use MySQL as an example. Start the database and create a new database named dolphinscheduler as DolphinScheduler metabase
After creating the new database, run the sql file under dolphinscheduler/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql directly in MySQL to complete the database initialization
Following steps will guide how to start the DolphinScheduler backend service
Open project: Use IDE open the project, here we use IntelliJ IDEA as an example, after opening it will take a while for IntelliJ IDEA to complete the dependent download
File change
dolphinscheduler-bom/pom.xml and change the scope of the mysql-connector-j dependency to compile. This step is not necessary to use PostgreSQLdolphinscheduler-master/src/main/resources/application.yamldolphinscheduler-api/src/main/resources/application.yamldolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application.yamlWe here use MySQL with database, username, password named dolphinscheduler as an example
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8
username: dolphinscheduler
password: dolphinscheduler
There are three services that need to be started, including MasterServer, WorkerServer, ApiApplicationServer.
main in the class org.apache.dolphinscheduler.server.master.MasterServer by IntelliJ IDEA, with the configuration VM Options -DDOCKER=true -Dspring.profiles.active=mysqlmain in the class org.apache.dolphinscheduler.server.worker.WorkerServer by IntelliJ IDEA, with the configuration VM Options -DDOCKER=truemain in the class org.apache.dolphinscheduler.alert.AlertServer by IntelliJ IDEA, with the configuration VM Options -DDOCKER=true -Dspring.profiles.active=mysqlmain in the class org.apache.dolphinscheduler.api.ApiApplicationServer by IntelliJ IDEA, with the configuration VM Options -DDOCKER=true -Dspring.profiles.active=mysql. After it started, you could find Open API documentation in http://localhost:12345/dolphinscheduler/swagger-ui/index.htmlThe
mysqlin the VM Options-Dspring.profiles.active=mysqlmeans specified configuration file
Install frontend dependencies and run it
cd dolphinscheduler-ui
pnpm install
pnpm run dev
The browser access address http://localhost:5173 can login DolphinScheduler UI. The default username and password are admin/dolphinscheduler123