From 4c2857b6e88b380ad7923b97b3db4c1eb33e4e75 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Sun, 4 Nov 2018 18:32:08 +0200 Subject: Add build scripts. --- releases/virtualbox/README.txt | 6 ++ releases/virtualbox/etc-rc.local.txt | 20 +++++ releases/virtualbox/ipaddress.sh | 2 + releases/virtualbox/node-allow-port-80.sh | 1 + releases/virtualbox/old-rebuild-wekan.sh | 42 ++++++++++ releases/virtualbox/rebuild-wekan.sh | 127 ++++++++++++++++++++++++++++++ releases/virtualbox/start-wekan.sh | 72 +++++++++++++++++ releases/virtualbox/stop-wekan.sh | 1 + 8 files changed, 271 insertions(+) create mode 100644 releases/virtualbox/README.txt create mode 100644 releases/virtualbox/etc-rc.local.txt create mode 100755 releases/virtualbox/ipaddress.sh create mode 100755 releases/virtualbox/node-allow-port-80.sh create mode 100755 releases/virtualbox/old-rebuild-wekan.sh create mode 100755 releases/virtualbox/rebuild-wekan.sh create mode 100755 releases/virtualbox/start-wekan.sh create mode 100755 releases/virtualbox/stop-wekan.sh (limited to 'releases/virtualbox') diff --git a/releases/virtualbox/README.txt b/releases/virtualbox/README.txt new file mode 100644 index 00000000..04beeba8 --- /dev/null +++ b/releases/virtualbox/README.txt @@ -0,0 +1,6 @@ +Wekan +----- +- NOTE: VirtualBox script use Wekan stable (master+devel branch). Edge scripts are at wekan-maintainer/releases/ directory. +- Wekan is started at boot at /etc/rc.local +- scripts are at ~/repos +- this README.txt is at VirtualBox Ubuntu desktop diff --git a/releases/virtualbox/etc-rc.local.txt b/releases/virtualbox/etc-rc.local.txt new file mode 100644 index 00000000..7c951a8c --- /dev/null +++ b/releases/virtualbox/etc-rc.local.txt @@ -0,0 +1,20 @@ +#!/bin/sh -e +# +# rc.local +# +# This script is executed at the end of each multiuser runlevel. +# Make sure that the script will "exit 0" on success or any other +# value on error. +# +# In order to enable or disable this script just change the execution +# bits. +# +# By default this script does nothing. + +# node-allow-port-80.sh +sudo setcap cap_net_bind_service=+ep /usr/local/bin/node + +# Start Wekan at boot at Ubuntu 14.04 +sudo -H -u wekan bash -c '/home/wekan/repos/wekan/releases/virtualbox/start-wekan.sh' + +exit 0 diff --git a/releases/virtualbox/ipaddress.sh b/releases/virtualbox/ipaddress.sh new file mode 100755 index 00000000..0d79d43d --- /dev/null +++ b/releases/virtualbox/ipaddress.sh @@ -0,0 +1,2 @@ +# ifdata -pa eth0 +ip address diff --git a/releases/virtualbox/node-allow-port-80.sh b/releases/virtualbox/node-allow-port-80.sh new file mode 100755 index 00000000..4f1861b6 --- /dev/null +++ b/releases/virtualbox/node-allow-port-80.sh @@ -0,0 +1 @@ +sudo setcap cap_net_bind_service=+ep /usr/local/bin/node diff --git a/releases/virtualbox/old-rebuild-wekan.sh b/releases/virtualbox/old-rebuild-wekan.sh new file mode 100755 index 00000000..a3941d55 --- /dev/null +++ b/releases/virtualbox/old-rebuild-wekan.sh @@ -0,0 +1,42 @@ +## Most of these are uncommented, because they are already installed. +#sudo rm -rf /usr/local/lib/node_modules +#sudo rm -rf ~/.npm +#sudo apt install build-essential c++ capnproto npm git curl +#sudo npm -g install n +#sudo n 4.8.6 +#sudo npm -g install npm@4.6.1 +#sudo npm -g install node-gyp +#sudo npm -g install node-pre-gyp +#sudo npm -g install fibers@1.0.15 +sudo rm -rf wekan +git clone https://github.com/wekan/wekan +cd ~/repos +#curl https://install.meteor.com -o ./install_meteor.sh +#sed -i "s|RELEASE=.*|RELEASE=${METEOR_RELEASE}\"\"|g" ./install_meteor.sh +#echo "Starting meteor ${METEOR_RELEASE} installation... \n" +#chown wekan:wekan ./install_meteor.sh +#sh ./install_meteor.sh +mkdir -p ~/repos/wekan/packages +cd ~/repos/wekan/packages +rm -rf kadira-flow-router +rm -rf meteor-useraccounts-core +git clone https://github.com/wekan/flow-router.git kadira-flow-router +git clone https://github.com/meteor-useraccounts/core.git meteor-useraccounts-core +sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js +cd ~/repos/wekan + +rm -rf node_modules +npm install +rm -rf .build +meteor build .build --directory +cp -f fix-download-unicode/cfs_access-point.txt .build/bundle/programs/server/packages/cfs_access-point.js +sed -i "s|build\/Release\/bson|browser_build\/bson|g" ~/repos/wekan/.build/bundle/programs/server/npm/node_modules/meteor/cfs_gridfs/node_modules/mongodb/node_modules/bson/ext/index.js +cd ~/repos/wekan/.build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt +rm -rf node_modules/bcrypt +meteor npm install --save bcrypt +cd ~/repos/wekan/.build/bundle/programs/server +rm -rf node_modules +npm install +meteor npm install --save bcrypt +cd ~/repos +echo Done. diff --git a/releases/virtualbox/rebuild-wekan.sh b/releases/virtualbox/rebuild-wekan.sh new file mode 100755 index 00000000..e7d55107 --- /dev/null +++ b/releases/virtualbox/rebuild-wekan.sh @@ -0,0 +1,127 @@ +#!/bin/bash + +echo "Note: If you use other locale than en_US.UTF-8 , you need to additionally install en_US.UTF-8" +echo " with 'sudo dpkg-reconfigure locales' , so that MongoDB works correctly." +echo " You can still use any other locale as your main locale." + +X64NODE="https://releases.wekan.team/node-v8.11.3-linux-x64.tar.gz" + +function pause(){ + read -p "$*" +} + +echo +PS3='Please enter your choice: ' +options=("Install Wekan dependencies" "Build Wekan" "Quit") +select opt in "${options[@]}" +do + case $opt in + "Install Wekan dependencies") + + if [[ "$OSTYPE" == "linux-gnu" ]]; then + echo "Linux"; + + if [ "$(grep -Ei 'buntu|mint' /etc/*release)" ]; then + sudo apt install -y build-essential git curl wget + sudo apt -y install nodejs npm + sudo npm -g install n + sudo n 8.11.3 + fi + + if [ "$(grep -Ei 'debian' /etc/*release)" ]; then + sudo apt install -y build-essential git curl wget + echo "Debian, or Debian on Windows Subsystem for Linux" + curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - + sudo apt install -y nodejs + fi + + # TODO: Add Sandstorm for version of Node.js install + #MACHINE_TYPE=`uname -m` + #if [ ${MACHINE_TYPE} == 'x86_64' ]; then + # # 64-bit stuff here + # wget ${X64NODE} + # sudo tar -C /usr/local --strip-components 1 -xzf ${X64NODE} + #elif [ ${MACHINE_TYPE} == '32bit' ]; then + # echo "TODO: 32-bit Linux install here" + # exit + #fi + elif [[ "$OSTYPE" == "darwin"* ]]; then + echo "macOS"; + pause '1) Install XCode 2) Install Node 8.x from https://nodejs.org/en/ 3) Press [Enter] key to continue.' + elif [[ "$OSTYPE" == "cygwin" ]]; then + # POSIX compatibility layer and Linux environment emulation for Windows + echo "TODO: Add Cygwin"; + exit; + elif [[ "$OSTYPE" == "msys" ]]; then + # Lightweight shell and GNU utilities compiled for Windows (part of MinGW) + echo "TODO: Add msys on Windows"; + exit; + elif [[ "$OSTYPE" == "win32" ]]; then + # I'm not sure this can happen. + echo "TODO: Add Windows"; + exit; + elif [[ "$OSTYPE" == "freebsd"* ]]; then + echo "TODO: Add FreeBSD"; + exit; + else + echo "Unknown" + echo ${OSTYPE} + exit; + fi + + ## Latest npm with Meteor 1.6 + sudo npm -g install npm + sudo npm -g install node-gyp + # Latest fibers for Meteor 1.6 + sudo npm -g install fibers@2.0.0 + # Install Meteor, if it's not yet installed + curl https://install.meteor.com | bash + mkdir ~/repos + cd ~/repos + git clone https://github.com/wekan/wekan.git + cd wekan + git checkout devel + break + ;; + "Build Wekan") + echo "Building Wekan." + cd ~/repos/wekan + mkdir -p ~/repos/wekan/packages + cd ~/repos/wekan/packages + git clone https://github.com/wekan/flow-router.git kadira-flow-router + git clone https://github.com/meteor-useraccounts/core.git meteor-useraccounts-core + + if [[ "$OSTYPE" == "darwin"* ]]; then + echo "sed at macOS"; + sed -i '' 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js + else + echo "sed at ${OSTYPE}" + sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js + fi + + cd ~/repos/wekan + rm -rf node_modules + meteor npm install + rm -rf .build + meteor build .build --directory + cp -f fix-download-unicode/cfs_access-point.txt .build/bundle/programs/server/packages/cfs_access-point.js + #Removed binary version of bcrypt because of security vulnerability that is not fixed yet. + #https://github.com/wekan/wekan/commit/4b2010213907c61b0e0482ab55abb06f6a668eac + #https://github.com/wekan/wekan/commit/7eeabf14be3c63fae2226e561ef8a0c1390c8d3c + #cd ~/repos/wekan/.build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt + #rm -rf node_modules/bcrypt + #meteor npm install bcrypt + cd ~/repos/wekan/.build/bundle/programs/server + rm -rf node_modules + meteor npm install + #meteor npm install bcrypt + cd ~/repos + echo Done. + break + ;; + "Quit") + break + ;; + *) echo invalid option;; + esac +done diff --git a/releases/virtualbox/start-wekan.sh b/releases/virtualbox/start-wekan.sh new file mode 100755 index 00000000..67f52dc0 --- /dev/null +++ b/releases/virtualbox/start-wekan.sh @@ -0,0 +1,72 @@ +# If you want to restart even on crash, uncomment while and done lines. + +#while true; do + cd ~/repos/wekan/.build/bundle + export MONGO_URL='mongodb://127.0.0.1:27017/admin' + # ROOT_URL EXAMPLES FOR WEBSERVERS: https://github.com/wekan/wekan/wiki/Settings + # Production: https://example.com/wekan + # Local: http://localhost:3000 + #export ipaddress=$(ifdata -pa eth0) + export ROOT_URL='http://localhost' + #--------------------------------------------- + # Working email IS NOT REQUIRED to use Wekan. + # https://github.com/wekan/wekan/wiki/Adding-users + # https://github.com/wekan/wekan/wiki/Troubleshooting-Mail + # https://github.com/wekan/wekan-mongodb/blob/master/docker-compose.yml + export MAIL_URL='smtp://user:pass@mailserver.example.com:25/' + export MAIL_FROM='Wekan Support ' + # This is local port where Wekan Node.js runs, same as below on Caddyfile settings. + export PORT=80 + #--------------------------------------------- + # Wekan Export Board works when WITH_API='true'. + # If you disable Wekan API, Export Board does not work. + export WITH_API='true' + #--------------------------------------------- + ## Optional: Integration with Matomo https://matomo.org that is installed to your server + ## The address of the server where Matomo is hosted: + # export MATOMO_ADDRESS='https://example.com/matomo' + export MATOMO_ADDRESS='' + ## The value of the site ID given in Matomo server for Wekan + # export MATOMO_SITE_ID='123456789' + export MATOMO_SITE_ID='' + ## The option do not track which enables users to not be tracked by matomo" + # export MATOMO_DO_NOT_TRACK='false' + export MATOMO_DO_NOT_TRACK='true' + ## The option that allows matomo to retrieve the username: + # export MATOMO_WITH_USERNAME='true' + export MATOMO_WITH_USERNAME='false' + # Enable browser policy and allow one trusted URL that can have iframe that has Wekan embedded inside. + # Setting this to false is not recommended, it also disables all other browser policy protections + # and allows all iframing etc. See wekan/server/policy.js + # Default value: true + export BROWSER_POLICY_ENABLED=true + # When browser policy is enabled, HTML code at this Trusted URL can have iframe that embeds Wekan inside. + # Example: export TRUSTED_URL=http://example.com + export TRUSTED_URL='' + # What to send to Outgoing Webhook, or leave out. Example, that includes all that are default: cardId,listId,oldListId,boardId,comment,user,card,commentId . + # Example: export WEBHOOKS_ATTRIBUTES=cardId,listId,oldListId,boardId,comment,user,card,commentId + export WEBHOOKS_ATTRIBUTES='' + #--------------------------------------------- + # OAuth2 docs: https://github.com/wekan/wekan/wiki/OAuth2 + # OAuth2 Client ID, for example from Rocket.Chat. Example: abcde12345 + # example: export OAUTH2_CLIENT_ID=abcde12345 + export OAUTH2_CLIENT_ID='' + # OAuth2 Secret, for example from Rocket.Chat: Example: 54321abcde + # example: export OAUTH2_SECRET=54321abcde + export OAUTH2_SECRET='' + # OAuth2 Server URL, for example Rocket.Chat. Example: https://chat.example.com + # example: export OAUTH2_SERVER_URL=https://chat.example.com + export OAUTH2_SERVER_URL='' + # OAuth2 Authorization Endpoint. Example: /oauth/authorize + # example: export OAUTH2_AUTH_ENDPOINT=/oauth/authorize + export OAUTH2_AUTH_ENDPOINT='' + # OAuth2 Userinfo Endpoint. Example: /oauth/userinfo + # example: export OAUTH2_USERINFO_ENDPOINT=/oauth/userinfo + export OAUTH2_USERINFO_ENDPOINT='' + # OAuth2 Token Endpoint. Example: /oauth/token + # example: export OAUTH2_TOKEN_ENDPOINT=/oauth/token + export OAUTH2_TOKEN_ENDPOINT='' + #--------------------------------------------- + node main.js & >> ~/repos/wekan.log + cd ~/repos +#done diff --git a/releases/virtualbox/stop-wekan.sh b/releases/virtualbox/stop-wekan.sh new file mode 100755 index 00000000..a7adf03b --- /dev/null +++ b/releases/virtualbox/stop-wekan.sh @@ -0,0 +1 @@ +pkill -f "node main.js" -- cgit v1.2.3-1-g7c22