rebuild-wekan.sh 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. export $(cat .env)
  7. export OAUTH2_REQUEST_PERMISSIONS="openid profile email wekan_scope"
  8. #Below script installs newest node 8.x for Debian/Ubuntu/Mint.
  9. function pause(){
  10. read -p "$*"
  11. }
  12. echo
  13. PS3='Please enter your choice: '
  14. options=("Install Wekan dependencies" "Build Wekan" "Run Meteor for dev on http://localhost:4000" "Run Meteor for dev on http://CURRENT-IP-ADDRESS:4000" "Run Meteor for dev on http://CUSTOM-IP-ADDRESS:PORT" "Quit")
  15. select opt in "${options[@]}"
  16. do
  17. case $opt in
  18. "Install Wekan dependencies")
  19. if [[ "$OSTYPE" == "linux-gnu" ]]; then
  20. echo "Linux";
  21. # Debian, Ubuntu, Mint
  22. sudo apt-get install -y build-essential gcc g++ make git curl wget p7zip-full zip unzip unp npm
  23. #curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
  24. #sudo apt-get install -y nodejs
  25. #sudo apt-get install -y npm
  26. # Volta Node and NPM install manager, made with Rust https://volta.sh
  27. # Volta uses home directory also with "npm -g install", no sudo needed.
  28. # Volta install script is broken, so using n.
  29. #curl https://get.volta.sh | bash
  30. #export VOLTA_HOME="$HOME/.volta"
  31. #export PATH="$VOLTA_HOME/bin:$PATH"
  32. #volta install node@14
  33. # npm nodejs
  34. #curl -0 -L https://npmjs.org/install.sh | sudo sh
  35. #sudo chown -R $(id -u):$(id -g) $HOME/.npm
  36. sudo npm -g install n
  37. sudo n 14.20.0
  38. #sudo npm -g install npm
  39. ## Latest npm with Meteor 2.2
  40. sudo npm -g install node-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 install -g 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 node_modules .meteor/local .build
  84. chmod u+w *.json
  85. meteor npm install
  86. meteor build .build --directory
  87. rm -rf .build/bundle/programs/web.browser.legacy
  88. (cd .build/bundle/programs/server && rm -rf node_modules && chmod u+w *.json && meteor npm install)
  89. (cd .build/bundle/programs/server/node_modules/fibers && node build.js)
  90. # Cleanup
  91. find . -type d -name '*-garbage*' | xargs rm -rf
  92. find . -name '*phantom*' | xargs rm -rf
  93. find . -name '.*.swp' | xargs rm -f
  94. find . -name '*.swp' | xargs rm -f
  95. # Add fibers multi arch
  96. #cd .build/bundle/programs/server/node_modules/fibers/bin
  97. #curl https://releases.wekan.team/fibers-multi.7z -o fibers-multi.7z
  98. #7z x fibers-multi.7z
  99. #rm fibers-multi.7z
  100. #cd ../../../../../../..
  101. echo Done.
  102. break
  103. ;;
  104. "Run Meteor for dev on http://localhost:4000")
  105. 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
  106. break
  107. ;;
  108. "Run Meteor for dev on http://CURRENT-IP-ADDRESS:4000")
  109. if [[ "$OSTYPE" == "darwin"* ]]; then
  110. IPADDRESS=$(ifconfig | grep broadcast | grep 'inet ' | cut -d: -f2 | awk '{ print $2}' | cut -d '/' -f 1)
  111. else
  112. IPADDRESS=$(ip a | grep 'noprefixroute' | grep 'inet ' | cut -d: -f2 | awk '{ print $2}' | cut -d '/' -f 1)
  113. fi
  114. echo "Your IP address is $IPADDRESS"
  115. 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
  116. break
  117. ;;
  118. "Run Meteor for dev on http://CUSTOM-IP-ADDRESS:PORT")
  119. ip address
  120. echo "From above list, what is your IP address?"
  121. read IPADDRESS
  122. echo "On what port you would like to run Wekan?"
  123. read PORT
  124. echo "ROOT_URL=http://$IPADDRESS:$PORT"
  125. 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
  126. break
  127. ;;
  128. "Quit")
  129. break
  130. ;;
  131. *) echo invalid option;;
  132. esac
  133. done