build.sh 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/bin/bash
  2. set -euxo pipefail
  3. BUILD_DEPS="bsdtar gnupg wget curl bzip2 python git ca-certificates perl-Digest-SHA"
  4. NODE_VERSION=v8.16.0
  5. #METEOR_RELEASE=1.6.0.1 - for Stacksmith, meteor-1.8 branch that could have METEOR@1.8.1-beta.8 or newer
  6. USE_EDGE=false
  7. METEOR_EDGE=1.5-beta.17
  8. NPM_VERSION=latest
  9. FIBERS_VERSION=2.0.0
  10. ARCHITECTURE=linux-x64
  11. #NODE_VERSION=v10.14.1
  12. sudo yum groupinstall -y 'Development Tools'
  13. sudo yum install -y http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
  14. sudo yum install -y git
  15. sudo useradd --user-group --system --home-dir /home/wekan wekan
  16. sudo mkdir -p /home/wekan
  17. sudo chown wekan:wekan /home/wekan/
  18. # meteor-1.8 branch that has newer Meteor that is compatible with MongoDB 4.x
  19. sudo -u wekan git clone -b meteor-1.8 https://github.com/wekan/wekan.git /home/wekan/app
  20. # OLD: Using Meteor 1.6.x version of Wekan
  21. #sudo -u wekan git clone https://github.com/wekan/wekan.git /home/wekan/app
  22. sudo yum install -y ${BUILD_DEPS}
  23. # Meteor installer doesn't work with the default tar binary, so using bsdtar while installing.
  24. # https://github.com/coreos/bugs/issues/1095#issuecomment-350574389
  25. sudo cp $(which tar) $(which tar)~
  26. sudo ln -sf $(which bsdtar) $(which tar)
  27. # Install nodejs
  28. wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz
  29. wget https://nodejs.org/dist/${NODE_VERSION}/SHASUMS256.txt.asc
  30. grep ${NODE_VERSION}-${ARCHITECTURE}.tar.gz SHASUMS256.txt.asc | shasum -a 256 -c -
  31. tar xvzf node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz
  32. rm node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz
  33. sudo mv node-${NODE_VERSION}-${ARCHITECTURE} /opt/nodejs
  34. sudo rm -f /usr/bin/node
  35. sudo rm -f /usr/bin/npm
  36. sudo ln -s /opt/nodejs/bin/node /usr/bin/node || true
  37. sudo ln -s /opt/nodejs/bin/npm /usr/bin/npm || true
  38. sudo npm install -g npm@${NPM_VERSION}
  39. sudo npm install -g node-gyp
  40. sudo npm install -g --unsafe-perm fibers@${FIBERS_VERSION}
  41. cd /home/wekan
  42. #install meteor
  43. sudo curl "https://install.meteor.com" -o /home/wekan/install_meteor.sh
  44. sudo chmod +x /home/wekan/install_meteor.sh
  45. sudo sed -i 's/VERBOSITY="--silent"/VERBOSITY="--progress-bar"/' ./install_meteor.sh
  46. echo "Starting installation of "
  47. sudo cat /home/wekan/app/.meteor/release
  48. echo " ...\n"
  49. # Check if opting for a release candidate instead of major release
  50. if [ "$USE_EDGE" = false ]; then
  51. sudo su -c '/home/wekan/install_meteor.sh' - wekan
  52. else
  53. sudo -u wekan git clone --recursive --depth 1 -b release/METEOR@${METEOR_EDGE} https://github.com/meteor/meteor.git /home/wekan/.meteor;
  54. fi;
  55. # Get additional packages
  56. sudo mkdir -p /home/wekan/app/packages
  57. sudo chown wekan:wekan --recursive /home/wekan/app
  58. cd /home/wekan/app/packages
  59. sudo -u wekan git clone --depth 1 -b master https://github.com/wekan/flow-router.git kadira-flow-router
  60. sudo -u wekan git clone --depth 1 -b master https://github.com/meteor-useraccounts/core.git meteor-useraccounts-core
  61. sudo -u wekan git clone --depth 1 -b master https://github.com/wekan/meteor-accounts-cas.git
  62. sudo -u wekan git clone --depth 1 -b master https://github.com/wekan/wekan-ldap.git
  63. sudo -u wekan git clone --depth 1 -b master https://github.com/wekan/wekan-scrollbar.git
  64. sudo -u wekan git clone --depth 1 -b master https://github.com/wekan/meteor-accounts-oidc.git
  65. sudo -u wekan mv meteor-accounts-oidc/packages/switch_accounts-oidc wekan_accounts-oidc
  66. sudo -u wekan mv meteor-accounts-oidc/packages/switch_oidc wekan_oidc
  67. sudo -u wekan rm -rf meteor-accounts-oidc
  68. sudo sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' /home/wekan/app/packages/meteor-useraccounts-core/package.js
  69. sudo -u wekan /home/wekan/.meteor/meteor -- help
  70. # Build app
  71. cd /home/wekan/app
  72. meteor=/home/wekan/.meteor/meteor
  73. sudo -u wekan ${meteor} add standard-minifier-js
  74. sudo -u wekan ${meteor} npm install
  75. sudo -u wekan ${meteor} build --directory /home/wekan/app_build
  76. sudo cp /home/wekan/app/fix-download-unicode/cfs_access-point.txt /home/wekan/app_build/bundle/programs/server/packages/cfs_access-point.js
  77. sudo chown wekan:wekan /home/wekan/app_build/bundle/programs/server/packages/cfs_access-point.js
  78. sudo rm /home/wekan/app_build/bundle/programs/server/npm/node_modules/meteor/rajit_bootstrap3-datepicker/lib/bootstrap-datepicker/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
  79. cd /home/wekan/app_build/bundle/programs/server/
  80. sudo npm install
  81. sudo chown -R wekan:wekan ./node_modules
  82. sudo mv /home/wekan/app_build/bundle /build