startup-init-conf.sh 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/bin/bash
  2. #
  3. # Licensed to the Apache Software Foundation (ASF) under one or more
  4. # contributor license agreements. See the NOTICE file distributed with
  5. # this work for additional information regarding copyright ownership.
  6. # The ASF licenses this file to You under the Apache License, Version 2.0
  7. # (the "License"); you may not use this file except in compliance with
  8. # the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. set -e
  19. echo "init env variables"
  20. # Define parameters default value.
  21. #============================================================================
  22. # Database Source
  23. #============================================================================
  24. export POSTGRESQL_HOST=${POSTGRESQL_HOST:-"127.0.0.1"}
  25. export POSTGRESQL_PORT=${POSTGRESQL_PORT:-"5432"}
  26. export POSTGRESQL_USERNAME=${POSTGRESQL_USERNAME:-"root"}
  27. export POSTGRESQL_PASSWORD=${POSTGRESQL_PASSWORD:-"root"}
  28. #============================================================================
  29. # System
  30. #============================================================================
  31. export DOLPHINSCHEDULER_ENV_PATH=${DOLPHINSCHEDULER_ENV_PATH:-"/opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh"}
  32. #============================================================================
  33. # Zookeeper
  34. #============================================================================
  35. export TASK_QUEUE=${TASK_QUEUE:-"zookeeper"}
  36. export ZOOKEEPER_QUORUM=${ZOOKEEPER_QUORUM:-"127.0.0.1:2181"}
  37. #============================================================================
  38. # Master Server
  39. #============================================================================
  40. export MASTER_EXEC_THREADS=${MASTER_EXEC_THREADS:-"100"}
  41. export MASTER_EXEC_TASK_NUM=${MASTER_EXEC_TASK_NUM:-"20"}
  42. export MASTER_HEARTBEAT_INTERVAL=${MASTER_HEARTBEAT_INTERVAL:-"10"}
  43. export MASTER_TASK_COMMIT_RETRYTIMES=${MASTER_TASK_COMMIT_RETRYTIMES:-"5"}
  44. export MASTER_TASK_COMMIT_INTERVAL=${MASTER_TASK_COMMIT_INTERVAL:-"1000"}
  45. export MASTER_MAX_CPULOAD_AVG=${MASTER_MAX_CPULOAD_AVG:-"100"}
  46. export MASTER_RESERVED_MEMORY=${MASTER_RESERVED_MEMORY:-"0.1"}
  47. #============================================================================
  48. # Worker Server
  49. #============================================================================
  50. export WORKER_EXEC_THREADS=${WORKER_EXEC_THREADS:-"100"}
  51. export WORKER_HEARTBEAT_INTERVAL=${WORKER_HEARTBEAT_INTERVAL:-"10"}
  52. export WORKER_FETCH_TASK_NUM=${WORKER_FETCH_TASK_NUM:-"3"}
  53. export WORKER_MAX_CPULOAD_AVG=${WORKER_MAX_CPULOAD_AVG:-"100"}
  54. export WORKER_RESERVED_MEMORY=${WORKER_RESERVED_MEMORY:-"0.1"}
  55. #============================================================================
  56. # Alert Server
  57. #============================================================================
  58. # XLS FILE
  59. export XLS_FILE_PATH=${XLS_FILE_PATH:-"/tmp/xls"}
  60. # mail
  61. export MAIL_SERVER_HOST=${MAIL_SERVER_HOST:-""}
  62. export MAIL_SERVER_PORT=${MAIL_SERVER_PORT:-""}
  63. export MAIL_SENDER=${MAIL_SENDER:-""}
  64. export MAIL_USER=${MAIL_USER:-""}
  65. export MAIL_PASSWD=${MAIL_PASSWD:-""}
  66. export MAIL_SMTP_STARTTLS_ENABLE=${MAIL_SMTP_STARTTLS_ENABLE:-"true"}
  67. export MAIL_SMTP_SSL_ENABLE=${MAIL_SMTP_SSL_ENABLE:-"false"}
  68. export MAIL_SMTP_SSL_TRUST=${MAIL_SMTP_SSL_TRUST:-""}
  69. # wechat
  70. export ENTERPRISE_WECHAT_ENABLE=${ENTERPRISE_WECHAT_ENABLE:-"false"}
  71. export ENTERPRISE_WECHAT_CORP_ID=${ENTERPRISE_WECHAT_CORP_ID:-""}
  72. export ENTERPRISE_WECHAT_SECRET=${ENTERPRISE_WECHAT_SECRET:-""}
  73. export ENTERPRISE_WECHAT_AGENT_ID=${ENTERPRISE_WECHAT_AGENT_ID:-""}
  74. export ENTERPRISE_WECHAT_USERS=${ENTERPRISE_WECHAT_USERS:-""}
  75. #============================================================================
  76. # Frontend
  77. #============================================================================
  78. export FRONTEND_API_SERVER_HOST=${FRONTEND_API_SERVER_HOST:-"127.0.0.1"}
  79. export FRONTEND_API_SERVER_PORT=${FRONTEND_API_SERVER_PORT:-"12345"}
  80. echo "generate app config"
  81. ls ${DOLPHINSCHEDULER_HOME}/conf/ | grep ".tpl" | while read line; do
  82. eval "cat << EOF
  83. $(cat ${DOLPHINSCHEDULER_HOME}/conf/${line})
  84. EOF
  85. " > ${DOLPHINSCHEDULER_HOME}/conf/${line%.*}
  86. done
  87. echo "generate nginx config"
  88. sed -i "s/FRONTEND_API_SERVER_HOST/${FRONTEND_API_SERVER_HOST}/g" /etc/nginx/conf.d/dolphinscheduler.conf
  89. sed -i "s/FRONTEND_API_SERVER_PORT/${FRONTEND_API_SERVER_PORT}/g" /etc/nginx/conf.d/dolphinscheduler.conf