startup-init-conf.sh 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. export POSTGRESQL_DATABASE=${POSTGRESQL_DATABASE:-"dolphinscheduler"}
  29. #============================================================================
  30. # System
  31. #============================================================================
  32. export DOLPHINSCHEDULER_ENV_PATH=${DOLPHINSCHEDULER_ENV_PATH:-"/opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh"}
  33. export DOLPHINSCHEDULER_DATA_BASEDIR_PATH=${DOLPHINSCHEDULER_DATA_BASEDIR_PATH:-"/tmp/dolphinscheduler"}
  34. #============================================================================
  35. # Zookeeper
  36. #============================================================================
  37. export ZOOKEEPER_QUORUM=${ZOOKEEPER_QUORUM:-"127.0.0.1:2181"}
  38. #============================================================================
  39. # Master Server
  40. #============================================================================
  41. export MASTER_EXEC_THREADS=${MASTER_EXEC_THREADS:-"100"}
  42. export MASTER_EXEC_TASK_NUM=${MASTER_EXEC_TASK_NUM:-"20"}
  43. export MASTER_HEARTBEAT_INTERVAL=${MASTER_HEARTBEAT_INTERVAL:-"10"}
  44. export MASTER_TASK_COMMIT_RETRYTIMES=${MASTER_TASK_COMMIT_RETRYTIMES:-"5"}
  45. export MASTER_TASK_COMMIT_INTERVAL=${MASTER_TASK_COMMIT_INTERVAL:-"1000"}
  46. export MASTER_MAX_CPULOAD_AVG=${MASTER_MAX_CPULOAD_AVG:-"100"}
  47. export MASTER_RESERVED_MEMORY=${MASTER_RESERVED_MEMORY:-"0.1"}
  48. export MASTER_LISTEN_PORT=${MASTER_LISTEN_PORT:-"5678"}
  49. #============================================================================
  50. # Worker Server
  51. #============================================================================
  52. export WORKER_EXEC_THREADS=${WORKER_EXEC_THREADS:-"100"}
  53. export WORKER_HEARTBEAT_INTERVAL=${WORKER_HEARTBEAT_INTERVAL:-"10"}
  54. export WORKER_FETCH_TASK_NUM=${WORKER_FETCH_TASK_NUM:-"3"}
  55. export WORKER_MAX_CPULOAD_AVG=${WORKER_MAX_CPULOAD_AVG:-"100"}
  56. export WORKER_RESERVED_MEMORY=${WORKER_RESERVED_MEMORY:-"0.1"}
  57. export WORKER_LISTEN_PORT=${WORKER_LISTEN_PORT:-"1234"}
  58. export WORKER_GROUP=${WORKER_GROUP:-"default"}
  59. #============================================================================
  60. # Alert Server
  61. #============================================================================
  62. # XLS FILE
  63. export XLS_FILE_PATH=${XLS_FILE_PATH:-"/tmp/xls"}
  64. # mail
  65. export MAIL_SERVER_HOST=${MAIL_SERVER_HOST:-""}
  66. export MAIL_SERVER_PORT=${MAIL_SERVER_PORT:-""}
  67. export MAIL_SENDER=${MAIL_SENDER:-""}
  68. export MAIL_USER=${MAIL_USER:-""}
  69. export MAIL_PASSWD=${MAIL_PASSWD:-""}
  70. export MAIL_SMTP_STARTTLS_ENABLE=${MAIL_SMTP_STARTTLS_ENABLE:-"true"}
  71. export MAIL_SMTP_SSL_ENABLE=${MAIL_SMTP_SSL_ENABLE:-"false"}
  72. export MAIL_SMTP_SSL_TRUST=${MAIL_SMTP_SSL_TRUST:-""}
  73. # wechat
  74. export ENTERPRISE_WECHAT_ENABLE=${ENTERPRISE_WECHAT_ENABLE:-"false"}
  75. export ENTERPRISE_WECHAT_CORP_ID=${ENTERPRISE_WECHAT_CORP_ID:-""}
  76. export ENTERPRISE_WECHAT_SECRET=${ENTERPRISE_WECHAT_SECRET:-""}
  77. export ENTERPRISE_WECHAT_AGENT_ID=${ENTERPRISE_WECHAT_AGENT_ID:-""}
  78. export ENTERPRISE_WECHAT_USERS=${ENTERPRISE_WECHAT_USERS:-""}
  79. #============================================================================
  80. # Frontend
  81. #============================================================================
  82. export FRONTEND_API_SERVER_HOST=${FRONTEND_API_SERVER_HOST:-"127.0.0.1"}
  83. export FRONTEND_API_SERVER_PORT=${FRONTEND_API_SERVER_PORT:-"12345"}
  84. echo "generate app config"
  85. ls ${DOLPHINSCHEDULER_HOME}/conf/ | grep ".tpl" | while read line; do
  86. eval "cat << EOF
  87. $(cat ${DOLPHINSCHEDULER_HOME}/conf/${line})
  88. EOF
  89. " > ${DOLPHINSCHEDULER_HOME}/conf/${line%.*}
  90. done
  91. echo "generate nginx config"
  92. sed -i "s/FRONTEND_API_SERVER_HOST/${FRONTEND_API_SERVER_HOST}/g" /etc/nginx/conf.d/dolphinscheduler.conf
  93. sed -i "s/FRONTEND_API_SERVER_PORT/${FRONTEND_API_SERVER_PORT}/g" /etc/nginx/conf.d/dolphinscheduler.conf