Last active
September 20, 2018 00:12
-
-
Save 68040/301978b88493967c65de789c00111f72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## | |
## Usage: ./install_wekan.sh SMTP-password | |
## | |
## Draft | |
## Install Wekan (v0.63) on Uberspace 6 by Noodle / Chris | |
## | |
## Sources: | |
## https://github.com/wekan/wekan/wiki/Install-and-Update#manual-installation-steps | |
## https://wiki.uberspace.de/database:mongodb | |
## https://wiki.uberspace.de/development:nodejs | |
## https://wiki.uberspace.de/system:daemontools | |
## https://github.com/wekan/wekan/issues/907 | |
SMTP_PASS="$1" | |
## Set SMTP password manually | |
# SMTP_PASS="xxxxxxxxxx" | |
## Set Wekan Release URL | |
WEKAN_RELEASE_URL=https://github.com/wekan/wekan/releases/download/v0.63/wekan-0.63.tar.gz | |
# Tested versions 0.10.1, 0.18, 0.32, 0.63 | |
# https://github.com/wekan/wekan/releases/download/v0.63/wekan-0.63.tar.gz | |
# https://github.com/wekan/wekan/releases/download/v0.32/wekan-0.32.tar.gz | |
# https://github.com/wekan/wekan/releases/download/v0.18/wekan-0.18.tar.gz | |
# https://github.com/wekan/wekan/releases/download/v0.10.1/wekan-0.10.1.tar.gz | |
##################### | |
### Setup Node.js ### | |
##################### | |
cat <<__EOF__ > ~/.npmrc | |
prefix = $HOME | |
umask = 077 | |
__EOF__ | |
echo 'export PATH=/package/host/localhost/nodejs-4/bin:$PATH' >> ~/.bash_profile | |
source ~/.bash_profile | |
##################### | |
### Setup MongoDB ### | |
##################### | |
test -d ~/service || uberspace-setup-svscan | |
TEMPMDB="$(uberspace-setup-mongodb)" | |
MONGO_USER="${USER}_mongoadmin" | |
MONGO_PORT="$(echo ${TEMPMDB} | egrep -o 'm#:\s[0-9]{5}\sUs' | cut -d' ' -f 2)" | |
MONGO_PASS="$(echo ${TEMPMDB} | egrep -o 'rd:\s.+\sTo\sconn' | cut -d' ' -f 2)" | |
echo -e "MONGO_USER: ${MONGO_USER} \nMONGO_PORT: ${MONGO_PORT} \nMONGO_PASS: ${MONGO_PASS}" | |
############################ | |
### Setup Websocket Port ### | |
############################ | |
export FREE_PORT="$(uberspace-add-port --protocol tcp --firewall | egrep -o '[0-9]{5}')" | |
echo "FREE_PORT: ${FREE_PORT}" | |
################### | |
### Setup Wekan ### | |
################### | |
## Issue #907 - Port must be speccified in root url, when Version > 0.10.1 | |
MONGO_URL="mongodb://${MONGO_USER}:${MONGO_PASS}@127.0.0.1:${MONGO_PORT}/wekan?authSource=admin" | |
ROOT_URL="http://${USER}.${HOSTNAME}:${FREE_PORT}/" | |
MAIL_URL="smtp://${USER}:${SMTP_PASS}@${HOSTNAME}:587/" | |
MAIL_FROM="${USER}@${HOSTNAME}" | |
PORT="${FREE_PORT}" | |
echo -e "MONGO_URL: ${MONGO_URL} \nPORT: ${PORT} \nROOT_URL: ${ROOT_URL} \nMAIL_URL ${MAIL_URL} \nMAIL_FROM: ${MAIL_FROM}" | |
##################### | |
### Install Wekan ### | |
##################### | |
mkdir ~/wekan && cd ~/wekan | |
curl -OL ${WEKAN_RELEASE_URL} && tar xzf wekan-*.tar.gz && rm wekan-*.tar.gz | |
cd ~/wekan/bundle/programs/server && npm install | |
cd ~ | |
##################### | |
### Setup Service ### | |
##################### | |
cat <<__EOF__ > ~/etc/wekan-setup | |
#!/bin/bash | |
export MONGO_URL=${MONGO_URL} | |
export ROOT_URL=${ROOT_URL} | |
export MAIL_URL=${MAIL_URL} | |
export MAIL_FROM=${MAIL_FROM} | |
export PORT=${PORT} | |
__EOF__ | |
cat <<__EOF__ > ~/etc/wekan-start | |
#!/bin/bash | |
source ~/etc/wekan-setup | |
exec node ~/wekan/bundle/main.js | |
__EOF__ | |
chmod 700 ~/etc/wekan-setup | |
chmod a+x ~/etc/wekan-start | |
## Init & Start as servcie | |
uberspace-setup-service wekan ~/etc/wekan-start | |
## Setup & Start in bg for debugging | |
# source ~/etc/wekan-setup && node ~/wekan/bundle/main.js & | |
##################### | |
### Finish ### | |
##################### | |
echo -e "\n Login: ${ROOT_URL} \n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment