rebuild-wekan.sh 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. #!/bin/bash
  2. echo "Recommended for development: Ubuntu 22.04 amd64 Jammy Jellyfish daily iso, directly to SSD disk or dual boot, not VM. Works fast."
  3. echo "Note: If you use other locale than en_US.UTF-8 , you need to additionally install en_US.UTF-8"
  4. echo " with 'sudo dpkg-reconfigure locales' , so that MongoDB works correctly."
  5. echo " You can still use any other locale as your main locale."
  6. #Below script installs newest node 8.x for Debian/Ubuntu/Mint.
  7. function pause(){
  8. read -p "$*"
  9. }
  10. echo
  11. PS3='Please enter your choice: '
  12. options=("Install Wekan dependencies" "Build Wekan" "Run Meteor for dev on http://localhost:4000" "Run Meteor for dev on http://localhost:4000 with bundle visualizer" "Run Meteor for dev on http://CURRENT-IP-ADDRESS:4000" "Run Meteor for dev on http://CUSTOM-IP-ADDRESS:PORT" "Quit")
  13. select opt in "${options[@]}"
  14. do
  15. case $opt in
  16. "Install Wekan dependencies")
  17. if [[ "$OSTYPE" == "linux-gnu" ]]; then
  18. echo "Linux";
  19. # Debian, Ubuntu, Mint
  20. sudo apt install -y build-essential gcc g++ make git curl wget p7zip-full zip unzip unp npm p7zip-full
  21. #curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
  22. #sudo apt-get install -y nodejs
  23. #sudo apt-get install -y npm
  24. # Volta Node and NPM install manager, made with Rust https://volta.sh
  25. # Volta uses home directory also with "npm -g install", no sudo needed.
  26. # Volta install script is broken, so using n.
  27. #curl https://get.volta.sh | bash
  28. #export VOLTA_HOME="$HOME/.volta"
  29. #export PATH="$VOLTA_HOME/bin:$PATH"
  30. #volta install node@14
  31. # npm nodejs
  32. #curl -0 -L https://npmjs.org/install.sh | sudo sh
  33. #sudo chown -R $(id -u):$(id -g) $HOME/.npm
  34. sudo npm -g install n
  35. sudo n 14.21.3
  36. sudo npm -g install npm
  37. #sudo npm -g install npm
  38. ## Latest npm with Meteor 2.2
  39. sudo npm -g uninstall node-pre-gyp
  40. sudo npm -g install @mapbox/node-pre-gyp
  41. # Latest fibers for Meteor 2.2
  42. #sudo mkdir -p /usr/local/lib/node_modules/fibers/.node-gyp
  43. #sudo npm -g install fibers
  44. # Install Meteor, if it's not yet installed
  45. sudo npm -g install meteor --unsafe-perm
  46. #sudo chown -R $(id -u):$(id -g) $HOME/.npm $HOME/.meteor
  47. elif [[ "$OSTYPE" == "darwin"* ]]; then
  48. echo "macOS";
  49. pause '1) Install XCode 2) Install Node 14.x from https://nodejs.org/en/ 3) Press [Enter] key to continue.'
  50. elif [[ "$OSTYPE" == "cygwin" ]]; then
  51. # POSIX compatibility layer and Linux environment emulation for Windows
  52. echo "TODO: Add Cygwin";
  53. exit;
  54. elif [[ "$OSTYPE" == "msys" ]]; then
  55. # Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
  56. echo "TODO: Add msys on Windows";
  57. exit;
  58. elif [[ "$OSTYPE" == "win32" ]]; then
  59. # I'm not sure this can happen.
  60. echo "TODO: Add Windows";
  61. exit;
  62. elif [[ "$OSTYPE" == "freebsd"* ]]; then
  63. echo "TODO: Add FreeBSD";
  64. exit;
  65. else
  66. echo "Unknown"
  67. echo ${OSTYPE}
  68. exit;
  69. fi
  70. break
  71. ;;
  72. "Build Wekan")
  73. echo "Building Wekan."
  74. #if [[ "$OSTYPE" == "darwin"* ]]; then
  75. # echo "sed at macOS";
  76. # sed -i '' 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  77. #else
  78. # echo "sed at ${OSTYPE}"
  79. # sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  80. #fi
  81. #cd ..
  82. #sudo chown -R $(id -u):$(id -g) $HOME/.npm $HOME/.meteor
  83. rm -rf .build/bundle node_modules .meteor/local .build
  84. meteor npm install
  85. meteor build .build --directory
  86. rm -rf .build/bundle/programs/web.browser.legacy
  87. (cd .build/bundle/programs/server && rm -rf node_modules && chmod u+w *.json && meteor npm install)
  88. (cd .build/bundle/programs/server/node_modules/fibers && node build.js)
  89. (cd .build/bundle/programs/server/npm/node_modules/meteor/accounts-password && meteor npm remove bcrypt && meteor npm install bcrypt)
  90. # Cleanup
  91. cd .build/bundle
  92. find . -type d -name '*-garbage*' | xargs rm -rf
  93. find . -name '*phantom*' | xargs rm -rf
  94. find . -name '.*.swp' | xargs rm -f
  95. find . -name '*.swp' | xargs rm -f
  96. cd ../..
  97. # Add fibers multi arch
  98. #cd .build/bundle/programs/server/node_modules/fibers/bin
  99. #curl https://releases.wekan.team/fibers-multi.7z -o fibers-multi.7z
  100. #7z x fibers-multi.7z
  101. #rm fibers-multi.7z
  102. #cd ../../../../../../..
  103. echo Done.
  104. break
  105. ;;
  106. "Run Meteor for dev on http://localhost:4000")
  107. #WRITABLE_PATH=.. NODE_OPTIONS="--max_old_space_size=4096 --trace-warnings" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://localhost:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000
  108. WRITABLE_PATH=.. NODE_OPTIONS="--trace-warnings" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://localhost:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000
  109. break
  110. ;;
  111. "Run Meteor for dev on http://localhost:4000 with bundle visualizer")
  112. #WRITABLE_PATH=.. NODE_OPTIONS="--max_old_space_size=4096 --trace-warnings" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://localhost:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000 --extra-packages bundle-visualizer --production
  113. WRITABLE_PATH=.. NODE_OPTIONS="--trace-warnings" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://localhost:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000 --extra-packages bundle-visualizer --production
  114. break
  115. ;;
  116. "Run Meteor for dev on http://CURRENT-IP-ADDRESS:4000")
  117. if [[ "$OSTYPE" == "darwin"* ]]; then
  118. IPADDRESS=$(ifconfig | grep broadcast | grep 'inet ' | cut -d: -f2 | awk '{ print $2}' | cut -d '/' -f 1)
  119. else
  120. IPADDRESS=$(ip a | grep 'noprefixroute' | grep 'inet ' | cut -d: -f2 | awk '{ print $2}' | cut -d '/' -f 1)
  121. fi
  122. echo "Your IP address is $IPADDRESS"
  123. #WRITABLE_PATH=.. NODE_OPTIONS="--max_old_space_size=4096 --trace-warnings" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000
  124. WRITABLE_PATH=.. NODE_OPTIONS="--trace-warnings" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000
  125. break
  126. ;;
  127. "Run Meteor for dev on http://CUSTOM-IP-ADDRESS:PORT")
  128. ip address
  129. echo "From above list, what is your IP address?"
  130. read IPADDRESS
  131. echo "On what port you would like to run Wekan?"
  132. read PORT
  133. echo "ROOT_URL=http://$IPADDRESS:$PORT"
  134. #WRITABLE_PATH=.. NODE_OPTIONS="--max_old_space_size=4096 --trace-warnings" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:$PORT meteor run --exclude-archs web.browser.legacy,web.cordova --port $PORT
  135. WRITABLE_PATH=.. NODE_OPTIONS="--trace-warnings" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:$PORT meteor run --exclude-archs web.browser.legacy,web.cordova --port $PORT
  136. break
  137. ;;
  138. "Quit")
  139. break
  140. ;;
  141. *) echo invalid option;;
  142. esac
  143. done