mirror of
https://github.com/YunoHost-Apps/wekan_ynh.git
synced 2024-09-03 20:36:09 +02:00
Fix and adding mongodb and service conf
This commit is contained in:
parent
03e1eb65d2
commit
5332579c7e
2 changed files with 43 additions and 19 deletions
16
conf/systemd.conf
Normal file
16
conf/systemd.conf
Normal file
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=Wekan Server
|
||||
Wants=mongodb.service
|
||||
After=network.target mongodb.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=WEKAN_INSTALL_PATH
|
||||
ExecStart=WEKAN_NODEJS_PATH main.js
|
||||
Environment=MONGO_URL=mongodb://127.0.0.1:27017/WEKAN_DB_NAME
|
||||
Environment=ROOT_URL=https://WEKAN_DOMAIN/WEKAN_PATH/ PORT=WEKAN_PORT
|
||||
User=wekan
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -26,9 +26,6 @@ sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
|
|||
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||
|
||||
|
||||
|
||||
INSTALL_USER=admin
|
||||
|
||||
# Install nvm
|
||||
export NVM_DIR="/opt/nvm"
|
||||
sudo curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | sudo NVM_DIR=$NVM_DIR bash
|
||||
|
@ -56,13 +53,14 @@ then
|
|||
sudo swapon $tmp_swap_file
|
||||
fi
|
||||
|
||||
|
||||
# Install meteor
|
||||
METEOR_INSTALL_DIR="/opt/meteor"
|
||||
METEOR_BIN="/usr/local/bin/meteor"
|
||||
NODE_BIN=`sudo su -c ". $NVM_DIR/nvm.sh && nvm use 0.10 >/dev/null && which node"`
|
||||
#sudo rm -rf $METEOR_INSTALL_DIR
|
||||
#sudo cp -r ../sources/meteor $METEOR_INSTALL_DIR
|
||||
#sudo git clone --recursive https://github.com/meteor/meteor.git $METEOR_INSTALL_DIR -b release-1.3.5
|
||||
#NODE_BIN=`sudo su -c ". $NVM_DIR/nvm.sh && nvm use 0.10 >/dev/null && which node"`
|
||||
#sudo mkdir -p /opt/meteor/dev_bundle/bin/
|
||||
#sudo ln -s $NODE_BIN /opt/meteor/dev_bundle/bin/node
|
||||
|
||||
|
@ -88,27 +86,30 @@ sudo su -c ". $NVM_DIR/nvm.sh && nvm use 0.10 && npm install"
|
|||
#sudo su admin -c ". $NVM_DIR/nvm.sh && nvm use 0.10 && meteor build .build --directory"
|
||||
|
||||
# Disable swapfile
|
||||
if [[ -v "$tmp_swap_file" ]];
|
||||
if [[ -v "$(echo $tmp_swap_file)" ]];
|
||||
then
|
||||
sudo swapoff $tmp_swap_file
|
||||
sudo rm -f $tmp_swap_file
|
||||
fi
|
||||
|
||||
# Configure stuff ?
|
||||
export MONGO_URL="mongodb://127.0.0.1:27017/wekan"
|
||||
export ROOT_URL="https://${domain}"
|
||||
export MAIL_URL="smtp://root@localhost/"
|
||||
export PORT=8081
|
||||
|
||||
# Launch ?
|
||||
cd ../../
|
||||
node main.js
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Install mongodb
|
||||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
|
||||
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y mongodb-org=3.2.11 mongodb-org-server=3.2.11 mongodb-org-shell=3.2.11 mongodb-org-mongos=3.2.11 mongodb-org-tools=3.2.11
|
||||
sudo systemctl start mongod
|
||||
sudo systemctl enable mongod
|
||||
|
||||
# Install systemd conf
|
||||
systemd_conf=../conf/systemd.conf
|
||||
sed -i "s@WEKAN_INSTALL_PATH@/var/www/wekan/.build/bundle@g" $systemd_conf
|
||||
sed -i "s@WEKAN_NODEJS_PATH@$NODE_BIN@g" $systemd_conf
|
||||
sed -i "s@WEKAN_DOMAIN@$domain@g" $systemd_conf
|
||||
sed -i "s@WEKAN_PATH@$path_url@g" $systemd_conf
|
||||
|
||||
sed -i "s@WEKAN_DB_NAME@wekan@g" $systemd_conf
|
||||
sed -i "s@WEKAN_PORT@8081@g" $systemd_conf
|
||||
cp $systemd_conf /etc/systemd/system/wekan@.service
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
nginx_conf=../conf/nginx.conf
|
||||
|
@ -124,3 +125,10 @@ fi
|
|||
|
||||
# Reload services
|
||||
sudo service nginx reload
|
||||
|
||||
# Start service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl start wekan@admin
|
||||
sudo systemctl enable wekan@admin
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue