|
@@ -41,6 +41,22 @@ REDIS_PASSWORD="${ZQ_REDIS_PASSWORD:-zq_local_redis_2026}"
|
|
|
RABBIT_USER="${ZQ_RABBIT_USER:-space}"
|
|
RABBIT_USER="${ZQ_RABBIT_USER:-space}"
|
|
|
RABBIT_PASSWORD="${ZQ_RABBIT_PASSWORD:-zq_local_mq_2026}"
|
|
RABBIT_PASSWORD="${ZQ_RABBIT_PASSWORD:-zq_local_mq_2026}"
|
|
|
|
|
|
|
|
|
|
+if [[ "${ZQ_REMOTE_DB_MODE:-0}" == "1" ]]; then
|
|
|
|
|
+ DB_HOST="${ZQ_DB_HOST:-10.0.42.6}"
|
|
|
|
|
+ DB_PORT="${ZQ_DB_PORT:-3306}"
|
|
|
|
|
+ CORE_DB_NAME="${ZQ_CORE_DB_NAME:-sp_gzhx_core_test}"
|
|
|
|
|
+ APPS_DB_NAME="${ZQ_APPS_DB_NAME:-sp_gzhx_apps_test}"
|
|
|
|
|
+ DB_USER="${ZQ_DB_USER:-root}"
|
|
|
|
|
+ DB_PASSWORD="${ZQ_DB_PASSWORD:?启用 ZQ_REMOTE_DB_MODE=1 时必须设置 ZQ_DB_PASSWORD}"
|
|
|
|
|
+else
|
|
|
|
|
+ DB_HOST="${ZQ_DB_HOST:-127.0.0.1}"
|
|
|
|
|
+ DB_PORT="${ZQ_DB_PORT:-${MYSQL_PORT}}"
|
|
|
|
|
+ CORE_DB_NAME="${ZQ_CORE_DB_NAME:-spacecorev1}"
|
|
|
|
|
+ APPS_DB_NAME="${ZQ_APPS_DB_NAME:-spaceappsv1}"
|
|
|
|
|
+ DB_USER="${ZQ_DB_USER:-${APP_DB_USER}}"
|
|
|
|
|
+ DB_PASSWORD="${ZQ_DB_PASSWORD:-${APP_DB_PASSWORD}}"
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
REDIS_DIR="${RUNTIME_DIR}/redis"
|
|
REDIS_DIR="${RUNTIME_DIR}/redis"
|
|
|
REDIS_DATA_DIR="${REDIS_DIR}/data"
|
|
REDIS_DATA_DIR="${REDIS_DIR}/data"
|
|
|
REDIS_LOG_DIR="${REDIS_DIR}/logs"
|
|
REDIS_LOG_DIR="${REDIS_DIR}/logs"
|
|
@@ -120,9 +136,11 @@ is_running_pid() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
check_tools() {
|
|
check_tools() {
|
|
|
- [[ -x "$(mysql_bin mysqld)" ]] || fail "没有找到可用的 MySQL 5.7:${MYSQL_HOME}"
|
|
|
|
|
- [[ -x "$(mysql_bin mysql)" ]] || fail "没有找到 MySQL 客户端:${MYSQL_HOME}"
|
|
|
|
|
- [[ -f "${DUMP_FILE}" ]] || fail "没有找到数据库备份:${DUMP_FILE}"
|
|
|
|
|
|
|
+ if [[ "${ZQ_REMOTE_DB_MODE:-0}" != "1" ]]; then
|
|
|
|
|
+ [[ -x "$(mysql_bin mysqld)" ]] || fail "没有找到可用的 MySQL 5.7:${MYSQL_HOME}"
|
|
|
|
|
+ [[ -x "$(mysql_bin mysql)" ]] || fail "没有找到 MySQL 客户端:${MYSQL_HOME}"
|
|
|
|
|
+ [[ -f "${DUMP_FILE}" ]] || fail "没有找到数据库备份:${DUMP_FILE}"
|
|
|
|
|
+ fi
|
|
|
|
|
|
|
|
if [[ -x "${JAVA_HOME_CANDIDATE}/bin/java" ]]; then
|
|
if [[ -x "${JAVA_HOME_CANDIDATE}/bin/java" ]]; then
|
|
|
export JAVA_HOME="${JAVA_HOME_CANDIDATE}"
|
|
export JAVA_HOME="${JAVA_HOME_CANDIDATE}"
|
|
@@ -3017,9 +3035,9 @@ prepare_webapp() {
|
|
|
|
|
|
|
|
cat > "${WEBAPP_DIR}/WEB-INF/config/druid/base.jdbc.properties" <<EOF
|
|
cat > "${WEBAPP_DIR}/WEB-INF/config/druid/base.jdbc.properties" <<EOF
|
|
|
driver_class=com.mysql.jdbc.Driver
|
|
driver_class=com.mysql.jdbc.Driver
|
|
|
-url=jdbc:mysql://127.0.0.1:${MYSQL_PORT}/spacecorev1?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
|
|
|
|
-username=${APP_DB_USER}
|
|
|
|
|
-password=${APP_DB_PASSWORD}
|
|
|
|
|
|
|
+url=jdbc:mysql://${DB_HOST}:${DB_PORT}/${CORE_DB_NAME}?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
|
|
|
|
+username=${DB_USER}
|
|
|
|
|
+password=${DB_PASSWORD}
|
|
|
initialSize=3
|
|
initialSize=3
|
|
|
maxActive=50
|
|
maxActive=50
|
|
|
maxWait=3000
|
|
maxWait=3000
|
|
@@ -3032,9 +3050,9 @@ EOF
|
|
|
|
|
|
|
|
cat > "${WEBAPP_DIR}/WEB-INF/config/druid/apps.jdbc.properties" <<EOF
|
|
cat > "${WEBAPP_DIR}/WEB-INF/config/druid/apps.jdbc.properties" <<EOF
|
|
|
driver_class=com.mysql.jdbc.Driver
|
|
driver_class=com.mysql.jdbc.Driver
|
|
|
-url=jdbc:mysql://127.0.0.1:${MYSQL_PORT}/spaceappsv1?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
|
|
|
|
-username=${APP_DB_USER}
|
|
|
|
|
-password=${APP_DB_PASSWORD}
|
|
|
|
|
|
|
+url=jdbc:mysql://${DB_HOST}:${DB_PORT}/${APPS_DB_NAME}?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
|
|
|
|
+username=${DB_USER}
|
|
|
|
|
+password=${DB_PASSWORD}
|
|
|
initialSize=3
|
|
initialSize=3
|
|
|
maxActive=50
|
|
maxActive=50
|
|
|
maxWait=3000
|
|
maxWait=3000
|
|
@@ -3045,12 +3063,12 @@ testWhileIdle=true
|
|
|
timeBetweenEvictionRunsMillis=28000
|
|
timeBetweenEvictionRunsMillis=28000
|
|
|
EOF
|
|
EOF
|
|
|
|
|
|
|
|
- local jbpm_url="jdbc:mysql://127.0.0.1:${MYSQL_PORT}/spaceappsv1?characterEncoding=utf-8&useSSL=false"
|
|
|
|
|
|
|
+ local jbpm_url="jdbc:mysql://${DB_HOST}:${DB_PORT}/${APPS_DB_NAME}?characterEncoding=utf-8&useSSL=false"
|
|
|
for cfg in \
|
|
for cfg in \
|
|
|
"${WEBAPP_DIR}/WEB-INF/config/app/bpm/cfg/jbpm.hibernate.cfg.xml" \
|
|
"${WEBAPP_DIR}/WEB-INF/config/app/bpm/cfg/jbpm.hibernate.cfg.xml" \
|
|
|
"${WEBAPP_DIR}/WEB-INF/classes/jbpm.hibernate.cfg.xml"; do
|
|
"${WEBAPP_DIR}/WEB-INF/classes/jbpm.hibernate.cfg.xml"; do
|
|
|
if [[ -f "${cfg}" ]]; then
|
|
if [[ -f "${cfg}" ]]; then
|
|
|
- LC_ALL=C LANG=C LC_CTYPE=C JBPM_URL="${jbpm_url}" DB_USER="${APP_DB_USER}" DB_PASS="${APP_DB_PASSWORD}" \
|
|
|
|
|
|
|
+ LC_ALL=C LANG=C LC_CTYPE=C JBPM_URL="${jbpm_url}" DB_USER="${DB_USER}" DB_PASS="${DB_PASSWORD}" \
|
|
|
perl -0pi -e 's#<property name="hibernate.connection.url">.*?</property>#<property name="hibernate.connection.url">$ENV{JBPM_URL}</property>#s; s#<property name="hibernate.connection.username">.*?</property>#<property name="hibernate.connection.username">$ENV{DB_USER}</property>#s; s#<property name="hibernate.connection.password">.*?</property>#<property name="hibernate.connection.password"><![CDATA[$ENV{DB_PASS}]]></property>#s;' "${cfg}"
|
|
perl -0pi -e 's#<property name="hibernate.connection.url">.*?</property>#<property name="hibernate.connection.url">$ENV{JBPM_URL}</property>#s; s#<property name="hibernate.connection.username">.*?</property>#<property name="hibernate.connection.username">$ENV{DB_USER}</property>#s; s#<property name="hibernate.connection.password">.*?</property>#<property name="hibernate.connection.password"><![CDATA[$ENV{DB_PASS}]]></property>#s;' "${cfg}"
|
|
|
fi
|
|
fi
|
|
|
done
|
|
done
|
|
@@ -3219,35 +3237,39 @@ main() {
|
|
|
compile_local_guest_services
|
|
compile_local_guest_services
|
|
|
compile_local_secure_pdf_services
|
|
compile_local_secure_pdf_services
|
|
|
ensure_tomcat
|
|
ensure_tomcat
|
|
|
- init_mysql_if_needed
|
|
|
|
|
- start_mysql
|
|
|
|
|
- ensure_database_imported
|
|
|
|
|
- ensure_zq_local_personnel_schema
|
|
|
|
|
- ensure_zq_local_admin_credentials
|
|
|
|
|
- ensure_zq_local_article_direct_release_flow
|
|
|
|
|
- ensure_zq_local_personnel_audit_flow
|
|
|
|
|
- ensure_zq_local_flow_data_integrity
|
|
|
|
|
- ensure_zq_local_workbench_components
|
|
|
|
|
- ensure_zq_local_sys_flow_components
|
|
|
|
|
- ensure_zq_local_sys_unit_components
|
|
|
|
|
- ensure_zq_local_website_template
|
|
|
|
|
- ensure_zq_local_ffkj_portal_templates
|
|
|
|
|
- ensure_zq_local_ffkj_screen_template
|
|
|
|
|
- ensure_zq_local_ffkj_screen_study_pages
|
|
|
|
|
- ensure_zq_local_ffkj_screen_final_nav
|
|
|
|
|
- ensure_zq_local_ffkj_screen_red_template
|
|
|
|
|
- ensure_zq_local_ffkj_screen_top_custom_links
|
|
|
|
|
- ensure_zq_local_ffkj_college_blue_template
|
|
|
|
|
- ensure_zq_local_ffkj_college_blue_top_links
|
|
|
|
|
- ensure_zq_local_ffkj_college_blue_footer_links
|
|
|
|
|
- ensure_zq_local_ffkj_college_red_template
|
|
|
|
|
- ensure_zq_local_ffkj_edu_college_site
|
|
|
|
|
- ensure_zq_local_ffkj_vehicle_college_site
|
|
|
|
|
- ensure_zq_local_demo_content
|
|
|
|
|
- ensure_zq_local_website_components
|
|
|
|
|
- ensure_zq_local_ffkj_portal_components
|
|
|
|
|
- ensure_zq_local_demo_content_files
|
|
|
|
|
- ensure_zq_local_content_file_references
|
|
|
|
|
|
|
+ if [[ "${ZQ_REMOTE_DB_MODE:-0}" == "1" ]]; then
|
|
|
|
|
+ log "已启用远端测试库模式:${DB_HOST}:${DB_PORT}/${CORE_DB_NAME} 与 ${APPS_DB_NAME}"
|
|
|
|
|
+ else
|
|
|
|
|
+ init_mysql_if_needed
|
|
|
|
|
+ start_mysql
|
|
|
|
|
+ ensure_database_imported
|
|
|
|
|
+ ensure_zq_local_personnel_schema
|
|
|
|
|
+ ensure_zq_local_admin_credentials
|
|
|
|
|
+ ensure_zq_local_article_direct_release_flow
|
|
|
|
|
+ ensure_zq_local_personnel_audit_flow
|
|
|
|
|
+ ensure_zq_local_flow_data_integrity
|
|
|
|
|
+ ensure_zq_local_workbench_components
|
|
|
|
|
+ ensure_zq_local_sys_flow_components
|
|
|
|
|
+ ensure_zq_local_sys_unit_components
|
|
|
|
|
+ ensure_zq_local_website_template
|
|
|
|
|
+ ensure_zq_local_ffkj_portal_templates
|
|
|
|
|
+ ensure_zq_local_ffkj_screen_template
|
|
|
|
|
+ ensure_zq_local_ffkj_screen_study_pages
|
|
|
|
|
+ ensure_zq_local_ffkj_screen_final_nav
|
|
|
|
|
+ ensure_zq_local_ffkj_screen_red_template
|
|
|
|
|
+ ensure_zq_local_ffkj_screen_top_custom_links
|
|
|
|
|
+ ensure_zq_local_ffkj_college_blue_template
|
|
|
|
|
+ ensure_zq_local_ffkj_college_blue_top_links
|
|
|
|
|
+ ensure_zq_local_ffkj_college_blue_footer_links
|
|
|
|
|
+ ensure_zq_local_ffkj_college_red_template
|
|
|
|
|
+ ensure_zq_local_ffkj_edu_college_site
|
|
|
|
|
+ ensure_zq_local_ffkj_vehicle_college_site
|
|
|
|
|
+ ensure_zq_local_demo_content
|
|
|
|
|
+ ensure_zq_local_website_components
|
|
|
|
|
+ ensure_zq_local_ffkj_portal_components
|
|
|
|
|
+ ensure_zq_local_demo_content_files
|
|
|
|
|
+ ensure_zq_local_content_file_references
|
|
|
|
|
+ fi
|
|
|
start_redis
|
|
start_redis
|
|
|
clear_redis_cache
|
|
clear_redis_cache
|
|
|
prepare_webapp
|
|
prepare_webapp
|