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:
parent
52ec646c17
commit
3f59b7a139
5 changed files with 32 additions and 22 deletions
|
@ -2,6 +2,9 @@
|
||||||
"name": "Tiny Tiny RSS",
|
"name": "Tiny Tiny RSS",
|
||||||
"id": "ttrss",
|
"id": "ttrss",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
|
"requirements": {
|
||||||
|
"yunohost": ">> 2.3.12.1"
|
||||||
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"en": "A PHP and Ajax feed reader",
|
"en": "A PHP and Ajax feed reader",
|
||||||
"fr": "Un lecteur de flux en PHP et Ajax"
|
"fr": "Un lecteur de flux en PHP et Ajax"
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$1
|
domain=$1
|
||||||
path=$2
|
path=$2
|
||||||
|
app=${!#}
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a ttrss
|
sudo yunohost app checkurl $domain$path -a $app
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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')
|
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
|
# Use 'ttrss' as database name and user
|
||||||
db_user=ttrss
|
db_user=$app
|
||||||
|
|
||||||
# Initialize database and store mysql password for upgrade
|
# 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 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
|
# Copy files to the right place
|
||||||
final_path=/var/www/ttrss
|
final_path=/var/www/$app
|
||||||
sudo mkdir -p $final_path
|
sudo mkdir -p $final_path
|
||||||
sudo cp -r ../source/* $final_path
|
sudo cp -r ../source/* $final_path
|
||||||
sudo cp ../conf/config.php $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/yunobase/$db_user/g" $final_path/config.php
|
||||||
sudo sed -i "s,yunopath,https://$domain$path,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
|
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 mv /tmp/cronttrss /etc/cron.d/$app
|
||||||
sudo chown root /etc/cron.d/ttrss
|
sudo chown root /etc/cron.d/$app
|
||||||
sudo apt-get install php5-cli -y
|
sudo apt-get install php5-cli -y
|
||||||
|
|
||||||
#add folder
|
#add folder
|
||||||
|
@ -66,9 +67,9 @@ sudo chown -R www-data: $final_path
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# 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@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||||
sudo sed -i "s@ALIASTOCHANGE@$final_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
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
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
|
sudo yunohost app ssowatconf
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
db_user=ttrss
|
app=${!#}
|
||||||
db_name=ttrss
|
|
||||||
|
db_user=$app
|
||||||
|
db_name=$app
|
||||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
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 ;"
|
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
||||||
sudo rm -rf /var/www/ttrss
|
sudo rm -rf /var/www/$app
|
||||||
sudo rm -f /etc/nginx/conf.d/$domain.d/ttrss.conf
|
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
sudo rm -f /etc/cron.d/ttrss
|
sudo rm -f /etc/cron.d/$app
|
||||||
|
|
|
@ -64,5 +64,5 @@ sudo chown root /etc/cron.d/$app
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
|
||||||
# Set ssowat config
|
# 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
|
sudo yunohost app ssowatconf
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
domain=$(sudo yunohost app setting ttrss domain)
|
app=${!#}
|
||||||
path=$(sudo yunohost app setting ttrss path)
|
|
||||||
|
|
||||||
db_user=ttrss
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
db_pwd=$(sudo yunohost app setting ttrss mysqlpwd)
|
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 mkdir -p $final_path
|
||||||
|
|
||||||
sudo cp -a ../source/* $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
|
# 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@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||||
sudo sed -i "s@ALIASTOCHANGE@$final_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 service nginx reload
|
||||||
sudo yunohost app ssowatconf
|
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
|
# Update database schema
|
||||||
sudo su - www-data -c "$final_path/update.php --update-schema"
|
sudo su - www-data -c "$final_path/update.php --update-schema"
|
||||||
|
|
Loading…
Reference in a new issue