1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ttrss_ynh.git synced 2024-10-01 13:34:46 +02:00

[enh] Multi-instance compliant with >> 2.3.12.1

This commit is contained in:
opi 2016-05-04 14:53:55 +02:00
parent 52ec646c17
commit 3f59b7a139
5 changed files with 32 additions and 22 deletions

View file

@ -2,6 +2,9 @@
"name": "Tiny Tiny RSS",
"id": "ttrss",
"packaging_format": 1,
"requirements": {
"yunohost": ">> 2.3.12.1"
},
"description": {
"en": "A PHP and Ajax feed reader",
"fr": "Un lecteur de flux en PHP et Ajax"

View file

@ -3,9 +3,10 @@
# Retrieve arguments
domain=$1
path=$2
app=${!#}
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a ttrss
sudo yunohost app checkurl $domain$path -a $app
if [[ ! $? -eq 0 ]]; then
exit 1
fi
@ -15,14 +16,14 @@ deskey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' |
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
# Use 'ttrss' as database name and user
db_user=ttrss
db_user=$app
# Initialize database and store mysql password for upgrade
sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../source/schema/TTRSS_schema_mysql.sql)
sudo yunohost app setting ttrss mysqlpwd -v $db_pwd
sudo yunohost app setting $app mysqlpwd -v $db_pwd
# Copy files to the right place
final_path=/var/www/ttrss
final_path=/var/www/$app
sudo mkdir -p $final_path
sudo cp -r ../source/* $final_path
sudo cp ../conf/config.php $final_path/
@ -37,8 +38,8 @@ sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config.php
sudo sed -i "s/yunobase/$db_user/g" $final_path/config.php
sudo sed -i "s,yunopath,https://$domain$path,g" $final_path/config.php
echo "*/30 * * * * www-data cd $final_path && /usr/bin/php $final_path/update.php --feeds >/dev/null 2>&1" > /tmp/cronttrss
sudo mv /tmp/cronttrss /etc/cron.d/ttrss
sudo chown root /etc/cron.d/ttrss
sudo mv /tmp/cronttrss /etc/cron.d/$app
sudo chown root /etc/cron.d/$app
sudo apt-get install php5-cli -y
#add folder
@ -66,9 +67,9 @@ sudo chown -R www-data: $final_path
# Modify Nginx configuration file and copy it to Nginx conf directory
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/ttrss.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app setting ttrss skipped_uris -v "/public.php,/api"
sudo yunohost app setting $app skipped_uris -v "/public.php,/api"
sudo yunohost app ssowatconf

View file

@ -1,11 +1,14 @@
#!/bin/bash
set -e
db_user=ttrss
db_name=ttrss
app=${!#}
db_user=$app
db_name=$app
root_pwd=$(sudo cat /etc/yunohost/mysql)
domain=$(sudo yunohost app setting ttrss domain)
domain=$(sudo yunohost app setting $app domain)
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
sudo rm -rf /var/www/ttrss
sudo rm -f /etc/nginx/conf.d/$domain.d/ttrss.conf
sudo rm -f /etc/cron.d/ttrss
sudo rm -rf /var/www/$app
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
sudo rm -f /etc/cron.d/$app

View file

@ -64,5 +64,5 @@ sudo chown root /etc/cron.d/$app
sudo service nginx reload
# Set ssowat config
sudo yunohost app setting ttrss skipped_uris -v "/public.php,/api"
sudo yunohost app setting $app skipped_uris -v "/public.php,/api"
sudo yunohost app ssowatconf

View file

@ -1,12 +1,15 @@
#!/bin/bash
set -e
domain=$(sudo yunohost app setting ttrss domain)
path=$(sudo yunohost app setting ttrss path)
app=${!#}
db_user=ttrss
db_pwd=$(sudo yunohost app setting ttrss mysqlpwd)
domain=$(sudo yunohost app setting $app domain)
path=$(sudo yunohost app setting $app path)
final_path=/var/www/ttrss
db_user=$app
db_pwd=$(sudo yunohost app setting $app mysqlpwd)
final_path=/var/www/$app
sudo mkdir -p $final_path
sudo cp -a ../source/* $final_path
@ -26,11 +29,11 @@ sudo chown -R www-data: $final_path
# Modify Nginx configuration file and copy it to Nginx conf directory
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/ttrss.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
sudo service nginx reload
sudo yunohost app ssowatconf
sudo yunohost app setting ttrss skipped_uris -v "/public.php,/api"
sudo yunohost app setting $app skipped_uris -v "/public.php,/api"
# Update database schema
sudo su - www-data -c "$final_path/update.php --update-schema"