[ISSUE #69] Integrate database credentials in auto-deploy (#70)

* add DB_ADDRESS env var

* add env file

* skip tests & add manual

* add a hello endpoint

* exclude .env

* refine manual
diff --git a/.gitignore b/.gitignore
index 1098c79..7f22e5a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,3 @@
-.gradle
-build/
-!gradle/wrapper/gradle-wrapper.jar
-!**/src/main/**/build/
-!**/src/test/**/build/
-
 ### STS ###
 .apt_generated
 .classpath
@@ -78,8 +72,18 @@
 buildNumber.properties
 .mvn/timing.properties
 
+### Gradle ###
+.gradle
+build/
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+
 ### Log Files ###
 *.log
 logs/
 # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
\ No newline at end of file
+hs_err_pid*
+
+### Devops ###
+.env
\ No newline at end of file
diff --git a/deployment/.env.example b/deployment/.env.example
new file mode 100644
index 0000000..5e2799d
--- /dev/null
+++ b/deployment/.env.example
@@ -0,0 +1,25 @@
+#
+# Licensed to Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Apache Software Foundation (ASF) licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Copy this .env.example file to the .env file
+# and edit your credentials.
+
+# Database credentials
+DB_ADDRESS=localhost:3306
+DB_USERNAME=root
+DB_PASSWORD=password
\ No newline at end of file
diff --git a/deployment/README.md b/deployment/README.md
new file mode 100644
index 0000000..f1bd747
--- /dev/null
+++ b/deployment/README.md
@@ -0,0 +1,27 @@
+## Auto Deploy EventMesh Dashboard
+
+### Usage
+
+```
+cd ~/service
+git clone -b dev https://github.com/apache/eventmesh-dashboard.git
+cd eventmesh-dashboard
+chmod +x deployment/auto-deploy-eventmesh-dashboard.sh
+```
+
+Edit credentials:
+
+```
+cp deployment/.env.example deployment/.env
+vim deployment/.env
+```
+
+Add task to crontab:
+
+```
+crontab -e
+```
+
+```
+0 * * * * ~/service/eventmesh-dashboard/deployment/auto-deploy-eventmesh-dashboard.sh
+```
\ No newline at end of file
diff --git a/deployment/auto-deploy-eventmesh-dashboard.sh b/deployment/auto-deploy-eventmesh-dashboard.sh
index 01aae6c..24ca44b 100644
--- a/deployment/auto-deploy-eventmesh-dashboard.sh
+++ b/deployment/auto-deploy-eventmesh-dashboard.sh
@@ -32,6 +32,10 @@
 # Jar file path
 JAR_FILE_PATH=~/service/eventmesh-dashboard/eventmesh-dashboard-console/target/eventmesh-dashboard-console-0.0.1-SNAPSHOT.jar
 
+# Load environment variables from external file
+ENV_FILE=~/service/eventmesh-dashboard/deployment/.env
+source $ENV_FILE
+
 # Update the git repository
 cd $REPO_PATH
 git fetch origin dev
@@ -56,10 +60,10 @@
     fi
     
     # Compile and package the Jar file
-    mvn clean package
+    mvn clean package -DskipTests
     
     # Start the springboot application and record the process id to pid.log file, redirect console logs to eventmesh-dashboard-<current time>.log file
-    nohup java -jar $JAR_FILE_PATH > $APP_LOG 2>&1 &
+    nohup java -DDB_ADDRESS=$DB_ADDRESS -DDB_USERNAME=$DB_USERNAME -DDB_PASSWORD=$DB_PASSWORD -jar $JAR_FILE_PATH > $APP_LOG 2>&1 &
     echo $! > $PID_LOG
     
     # Log the event
@@ -75,10 +79,10 @@
         echo "$(date +"%Y-%m-%d %H:%M:%S") - application running, no operation performed." >> $AUTO_DEPLOY_LOG
     else
         # If the pid.log file does not exist, compile and package the Jar file
-        mvn clean package
+        mvn clean package -DskipTests
 
         # Start the springboot application and record the process id to pid.log file, redirect console logs to eventmesh-dashboard-<current time>.log file
-        nohup java -jar $JAR_FILE_PATH > $APP_LOG 2>&1 &
+        nohup java -DDB_ADDRESS=$DB_ADDRESS -DDB_USERNAME=$DB_USERNAME -DDB_PASSWORD=$DB_PASSWORD -jar $JAR_FILE_PATH > $APP_LOG 2>&1 &
         echo $! > $PID_LOG
 
         # Log the event
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/MetricsController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/MetricsController.java
index 689f833..bedbbdd 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/MetricsController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/MetricsController.java
@@ -17,6 +17,8 @@
 
 package org.apache.eventmesh.dashboard.console.controller;
 
+import org.apache.eventmesh.dashboard.common.dto.Result;
+
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -30,4 +32,8 @@
         return DruidStatManagerFacade.getInstance().getDataSourceStatDataList();
     }
 
+    @GetMapping("/hello")
+    public Result<String> hello() {
+        return Result.success("Hello, EventMesh Dashboard!");
+    }
 }
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java
index 1af09ae..6d53a96 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java
@@ -69,5 +69,4 @@
         @RequestParam(name = "group", defaultValue = "") String group) {
         return Result.success(subscriptionCore.retrieveConfigs(page, size, dataId, group));
     }
-
 }
diff --git a/eventmesh-dashboard-console/src/main/resources/application-dev.yml b/eventmesh-dashboard-console/src/main/resources/application-dev.yml
index 3b3c83b..73f471b 100644
--- a/eventmesh-dashboard-console/src/main/resources/application-dev.yml
+++ b/eventmesh-dashboard-console/src/main/resources/application-dev.yml
@@ -30,7 +30,7 @@
     type: com.alibaba.druid.pool.DruidDataSource
     druid:
       driver-class-name: com.mysql.cj.jdbc.Driver
-      url: jdbc:mysql://localhost:3306/eventmesh_dashboard?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true
+      url: jdbc:mysql://${DB_ADDRESS:localhost:3306}/eventmesh_dashboard?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true
       username: ${DB_USERNAME:root}
       password: ${DB_PASSWORD:password}
 
diff --git a/eventmesh-dashboard-console/src/test/resources/application-test.yml b/eventmesh-dashboard-console/src/test/resources/application-test.yml
index ee44e7c..89dbea2 100644
--- a/eventmesh-dashboard-console/src/test/resources/application-test.yml
+++ b/eventmesh-dashboard-console/src/test/resources/application-test.yml
@@ -21,7 +21,7 @@
     type: com.alibaba.druid.pool.DruidDataSource
     druid:
       driver-class-name: com.mysql.cj.jdbc.Driver
-      url: jdbc:mysql://localhost:3306/eventmesh_dashboard_test?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true
+      url: jdbc:mysql://${DB_ADDRESS:localhost:3306}/eventmesh_dashboard_test?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true
       username: ${DB_USERNAME:root}
       password: ${DB_PASSWORD:password}