entrypoint.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/sh
  2. isArgPassed() {
  3. arg="$1"
  4. argWithEqualSign="$1="
  5. shift
  6. while [ $# -gt 0 ]; do
  7. passedArg="$1"
  8. shift
  9. case $passedArg in
  10. $arg)
  11. return 0
  12. ;;
  13. $argWithEqualSign*)
  14. return 0
  15. ;;
  16. esac
  17. done
  18. return 1
  19. }
  20. case "$1" in
  21. 'master')
  22. ARGS="-mdir=/data -volumePreallocate -volumeSizeLimitMB=1024"
  23. shift
  24. exec /usr/bin/weed -logtostderr=true master $ARGS $@
  25. ;;
  26. 'volume')
  27. ARGS="-dir=/data -max=0"
  28. if isArgPassed "-max" "$@"; then
  29. ARGS="-dir=/data"
  30. fi
  31. shift
  32. exec /usr/bin/weed -logtostderr=true volume $ARGS $@
  33. ;;
  34. 'server')
  35. ARGS="-dir=/data -volume.max=0 -master.volumePreallocate -master.volumeSizeLimitMB=1024"
  36. if isArgPassed "-volume.max" "$@"; then
  37. ARGS="-dir=/data -master.volumePreallocate -master.volumeSizeLimitMB=1024"
  38. fi
  39. shift
  40. exec /usr/bin/weed -logtostderr=true server $ARGS $@
  41. ;;
  42. 'filer')
  43. ARGS=""
  44. shift
  45. exec /usr/bin/weed -logtostderr=true filer $ARGS $@
  46. ;;
  47. 's3')
  48. ARGS="-domainName=$S3_DOMAIN_NAME -key.file=$S3_KEY_FILE -cert.file=$S3_CERT_FILE"
  49. shift
  50. exec /usr/bin/weed -logtostderr=true s3 $ARGS $@
  51. ;;
  52. *)
  53. exec /usr/bin/weed $@
  54. ;;
  55. esac