mirror of
https://github.com/YunoHost-Apps/freshrss_ynh.git
synced 2024-09-03 18:36:33 +02:00
Apply example_ynh
This commit is contained in:
parent
d69ade0585
commit
06f42c0923
11 changed files with 213 additions and 283 deletions
98
README.md
98
README.md
|
@ -1,69 +1,61 @@
|
||||||
# FreshRSS package for YunoHost
|
# FreshRSS package for YunoHost
|
||||||
|
|
||||||
|
[![Integration level](https://dash.yunohost.org/integration/freshrss.svg)](https://dash.yunohost.org/appci/app/freshrss)
|
||||||
|
[![Install FreshRSS with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=freshrss)
|
||||||
|
|
||||||
|
> *This package allow you to install FreshRSS quickly and simply on a YunoHost server.
|
||||||
|
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
An efficient but powerful RSS aggregator with a nice and mobile-friendly design, as well as extension and themes support.
|
An efficient but powerful RSS aggregator with a nice and mobile-friendly design, as well as extension and themes support.
|
||||||
|
|
||||||
* [FreshRSS website](http://freshrss.org)
|
**Shipped version:** 1.14.1
|
||||||
* [YunoHost website](https://yunohost.org)
|
|
||||||
|
|
||||||
## INSTALL
|
## Screenshots
|
||||||
|
|
||||||
[![Install FreshRSS with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=freshrss)
|
|
||||||
|
|
||||||
![](https://freshrss.org/images/screenshot.png)
|
![](https://freshrss.org/images/screenshot.png)
|
||||||
|
|
||||||
|
## Demo
|
||||||
|
|
||||||
or command line :
|
* [Official demo](https://demo.freshrss.org)
|
||||||
|
|
||||||
`yunohost app install https://github.com/YunoHost-Apps/freshrss_ynh`
|
## Configuration
|
||||||
|
|
||||||
## UPGRADE
|
|
||||||
`yunohost app upgrade freshrss -u https://github.com/YunoHost-Apps/freshrss_ynh`
|
|
||||||
|
|
||||||
# :warning: WARNING :warning:
|
|
||||||
upgrade for stretch has now dedicated php-fpm pool. To make upgrade works :
|
|
||||||
Check if domain is already sets :
|
|
||||||
`yunohost app setting freshrss domain`
|
|
||||||
if this command does't return anything :
|
|
||||||
`yunohost app setting freshrss domain -v yourdomain.tld`
|
|
||||||
|
|
||||||
if you have multiple instances :
|
|
||||||
|
|
||||||
`yunohost app setting freshrss__instancenumber domain -v yourdomain.tld`
|
|
||||||
|
|
||||||
Changelog:
|
|
||||||
|
|
||||||
* 2019-04-07 :
|
|
||||||
* Upgrade to 1.14.1
|
|
||||||
* 2019-03-31 :
|
|
||||||
* Upgrade to 1.14.0
|
|
||||||
* 2019-01-29 :
|
|
||||||
* Upgrade to 1.13.1
|
|
||||||
* Remove ynh_abort_if_errors to comply with linter
|
|
||||||
* Change licence to comply with linter
|
|
||||||
* 2019-01-04 :
|
|
||||||
* Fix user add access hook
|
|
||||||
* Upgrade to 1.13.0
|
|
||||||
* Open /api url instead of /api/greader.php
|
|
||||||
* 2018-10-28 :
|
|
||||||
* Update to FreshRSS 1.12.0
|
|
||||||
* 2018-09-23 :
|
|
||||||
* Update to FreshRSS 1.11.2
|
|
||||||
* Fix install on domain root path
|
|
||||||
* 2018-07-07 :
|
|
||||||
* Update to FreshRSS 1.11.1
|
|
||||||
* Remove deprecated helpers
|
|
||||||
* php-fpm dedicated pool
|
|
||||||
* 2018-06-03 : Update to FreshRSS 1.11.0
|
|
||||||
* 2018-02-04 : Update to FreshRSS 1.10.1
|
|
||||||
* 2017-12-27 : Update to FreshRSS 1.9.0
|
|
||||||
* 2017-12-03 : Update to FreshRSS 1.8.0
|
|
||||||
* 2017-06-03 : Update to FreshRSS 1.7.0
|
|
||||||
* 2017-03-13 : Update to FreshRSS 1.6.3
|
|
||||||
* 2017-03-13 : Complete package refactoring
|
|
||||||
* 2017-01-22 : Update to FreshRSS 1.6.2
|
|
||||||
|
|
||||||
API (mini) How To :
|
API (mini) How To :
|
||||||
* Into your user profile : Settings > profil
|
* Into your user profile : Settings > profil
|
||||||
* Setup an API password
|
* Setup an API password
|
||||||
* Check the API is working : https://exemple.tld/rss/api/greader.php
|
* Check the API is working : https://exemple.tld/rss/api/greader.php
|
||||||
* Setup your client with : username : ynh user, password : the password you just setup, url https://exemple.tld/rss/api/greader.php
|
* Setup your client with : username : ynh user, password : the password you just setup, url https://exemple.tld/rss/api/greader.php
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
* Official documentation: https://freshrss.github.io/FreshRSS/
|
||||||
|
|
||||||
|
#### Supported architectures
|
||||||
|
|
||||||
|
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/freshrss%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/freshrss/)
|
||||||
|
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/freshrss%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/freshrss/)
|
||||||
|
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/freshrss%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/freshrss/)
|
||||||
|
|
||||||
|
## Links
|
||||||
|
|
||||||
|
* Report a bug: https://github.com/YunoHost-Apps/freshrss_ynh/issues
|
||||||
|
* App website: https://freshrss.org/
|
||||||
|
* Upstream app repository: https://github.com/FreshRSS/FreshRSS
|
||||||
|
* YunoHost website: https://yunohost.org/
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Developers info
|
||||||
|
----------------
|
||||||
|
|
||||||
|
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
|
||||||
|
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/freshrss_ynh/tree/testing).
|
||||||
|
|
||||||
|
To try the testing branch, please proceed like that.
|
||||||
|
```
|
||||||
|
sudo yunohost app install https://github.com/YunoHost-Apps/freshrss_ynh/tree/testing --debug
|
||||||
|
or
|
||||||
|
sudo yunohost app upgrade freshrss -u https://github.com/YunoHost-Apps/freshrss_ynh/tree/testing --debug
|
||||||
|
```
|
||||||
|
|
|
@ -12,28 +12,17 @@
|
||||||
setup_nourl=0
|
setup_nourl=0
|
||||||
setup_private=0
|
setup_private=0
|
||||||
setup_public=0
|
setup_public=0
|
||||||
|
upgrade=1
|
||||||
upgrade=1 from_commit=b89554865459520d7d90a5a666f09f6987f41de6
|
upgrade=1 from_commit=b89554865459520d7d90a5a666f09f6987f41de6
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
wrong_user=1
|
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
|
||||||
wrong_path=1
|
# incorrect_path=1
|
||||||
incorrect_path=1
|
|
||||||
corrupt_source=0
|
|
||||||
fail_download_source=0
|
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
final_path_already_use=1
|
|
||||||
change_url=1
|
change_url=1
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
|
||||||
Level 2=auto
|
Level 5=auto
|
||||||
Level 3=auto
|
|
||||||
Level 4=1
|
|
||||||
Level 5=1
|
|
||||||
Level 6=auto
|
|
||||||
Level 7=auto
|
|
||||||
Level 8=0
|
|
||||||
Level 9=0
|
|
||||||
Level 10=0
|
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=b89554865459520d7d90a5a666f09f6987f41de6
|
; commit=b89554865459520d7d90a5a666f09f6987f41de6
|
||||||
name=Tue Jan 29 21:28:14 2019 +0100 update README
|
name=Tue Jan 29 21:28:14 2019 +0100 update README
|
||||||
|
|
|
@ -4,18 +4,21 @@ location __PATH__/ {
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### Example PHP configuration (remove it if not used)
|
||||||
index index.html index.php;
|
index index.html index.php;
|
||||||
try_files $uri $uri/ /index.php?$args;
|
try_files $uri $uri/ /index.php?$args;
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||||
|
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
}
|
}
|
||||||
|
### End of PHP configuration part
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "FreshRSS",
|
"name": "FreshRSS",
|
||||||
"id": "freshrss",
|
"id": "freshrss",
|
||||||
"version": "1.14.1",
|
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "FreshRSS is a selfhostable RSS reader",
|
"en": "FreshRSS is a selfhostable RSS reader",
|
||||||
"fr": "FreshRSS est un agrégateur de flux RSS à auto-héberger"
|
"fr": "FreshRSS est un agrégateur de flux RSS à auto-héberger"
|
||||||
},
|
},
|
||||||
|
"version": "1.14.1~ynh1",
|
||||||
"url": "http://freshrss.org/",
|
"url": "http://freshrss.org/",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
"email": "plopoyop@gmail.com"
|
"email": "plopoyop@gmail.com"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.0.0"
|
"yunohost": ">= 3.5"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a domain for FreshRSS",
|
"en": "Choose a domain name for FreshRSS",
|
||||||
"fr": "Choisissez un domaine pour FreshRSS"
|
"fr": "Choisissez un nom de domaine pour FreshRSS"
|
||||||
},
|
},
|
||||||
"example": "domain.org"
|
"example": "domain.org"
|
||||||
},
|
},
|
||||||
|
@ -48,8 +48,8 @@
|
||||||
"type": "user",
|
"type": "user",
|
||||||
"optional": false,
|
"optional": false,
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose the default user",
|
"en": "Choose an admin user",
|
||||||
"fr": "Choisissez l'utilisateur par defaut"
|
"fr": "Choisissez l’administrateur"
|
||||||
},
|
},
|
||||||
"example": "homer"
|
"example": "homer"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,17 +1,8 @@
|
||||||
#
|
#!/bin/bash
|
||||||
# Common variables
|
|
||||||
#
|
|
||||||
APPNAME="freshrss"
|
|
||||||
# FreshRSS version
|
|
||||||
VERSION="1.14.1"
|
|
||||||
|
|
||||||
# FreshRSS complete tarball checksum
|
#=================================================
|
||||||
FRESHRSS_SOURCE_SHA256="fd5ce6906021282e12cd6346844d21b82b70ac12d08834079a46b8722bfb0cce"
|
# COMMON VARIABLES
|
||||||
|
#=================================================
|
||||||
# Remote URL to fetch FreshRSS source tarball
|
|
||||||
FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/${VERSION}.tar.gz"
|
|
||||||
|
|
||||||
PKGDIR=$(cd ../; pwd)
|
|
||||||
|
|
||||||
if [ "$(lsb_release --codename --short)" == "jessie" ]; then
|
if [ "$(lsb_release --codename --short)" == "jessie" ]; then
|
||||||
pkg_dependencies="php5-gd"
|
pkg_dependencies="php5-gd"
|
||||||
|
@ -19,25 +10,14 @@ else
|
||||||
pkg_dependencies="php-gd php-zip php-dom php-mbstring"
|
pkg_dependencies="php-gd php-zip php-dom php-mbstring"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#=================================================
|
||||||
# Common helpers
|
# PERSONAL HELPERS
|
||||||
#
|
#=================================================
|
||||||
# Download and extract FreshRSS sources to the given directory
|
|
||||||
# usage: extract_freshrss DESTDIR
|
|
||||||
extract_freshrss() {
|
|
||||||
local DESTDIR=$1
|
|
||||||
|
|
||||||
# retrieve and extract FreshRSS tarball
|
#=================================================
|
||||||
rc_tarball="${DESTDIR}/freshrss.tar.gz"
|
# EXPERIMENTAL HELPERS
|
||||||
wget -q -O "$rc_tarball" "$FRESHRSS_SOURCE_URL" \
|
#=================================================
|
||||||
|| ynh_die "Unable to download FreshRSS tarball"
|
|
||||||
echo "$FRESHRSS_SOURCE_SHA256 $rc_tarball" | sha256sum -c >/dev/null \
|
|
||||||
|| ynh_die "Invalid checksum of downloaded tarball"
|
|
||||||
tar xf "$rc_tarball" -C "$DESTDIR" --strip-components 1 \
|
|
||||||
|| ynh_die "Unable to extract FreshRss tarball"
|
|
||||||
sudo rm "$rc_tarball"
|
|
||||||
}
|
|
||||||
|
|
||||||
install_freshrss_dependencies() {
|
#=================================================
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
# FUTURE OFFICIAL HELPERS
|
||||||
}
|
#=================================================
|
||||||
|
|
|
@ -19,43 +19,43 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading installation settings..."
|
ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backing up the main app directory..."
|
ynh_print_info --message="Backing up the main app directory..."
|
||||||
|
|
||||||
ynh_backup "$final_path"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backing up nginx web server configuration..."
|
ynh_print_info --message="Backing up nginx web server configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backing up php-fpm configuration..."
|
ynh_print_info --message="Backing up php-fpm configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
|
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backing up the MySQL database..."
|
ynh_print_info --message="Backing up the MySQL database..."
|
||||||
|
|
||||||
ynh_mysql_dump_db "$db_name" > db.sql
|
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
|
@ -63,10 +63,10 @@ ynh_mysql_dump_db "$db_name" > db.sql
|
||||||
# BACKUP A CRON FILE
|
# BACKUP A CRON FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "/etc/cron.d/$app"
|
ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -25,7 +25,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading installation settings..."
|
ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
@ -77,7 +77,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF FILE
|
# MODIFY URL IN NGINX CONF FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Updating nginx web server configuration..."
|
ynh_print_info --message="Updating nginx web server configuration..."
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
if [ $change_path -eq 1 ]
|
if [ $change_path -eq 1 ]
|
||||||
then
|
then
|
||||||
# Make a backup of the original nginx config file if modified
|
# Make a backup of the original nginx config file if modified
|
||||||
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||||
domain="$old_domain"
|
domain="$old_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
|
@ -95,10 +95,10 @@ fi
|
||||||
# Change the domain for nginx
|
# Change the domain for nginx
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_delete_file_checksum "$nginx_conf_path"
|
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
# Store file checksum for the new config file location
|
# Store file checksum for the new config file location
|
||||||
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -115,11 +115,11 @@ $final_path/cli/reconfigure.php --auth_type http_auth --environment production -
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading nginx web server..."
|
ynh_print_info --message="Reloading nginx web server..."
|
||||||
sudo systemctl reload nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Change of URL completed for $app"
|
ynh_print_info --message="Change of URL completed for $app"
|
||||||
|
|
116
scripts/install
116
scripts/install
|
@ -19,48 +19,34 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
language=$YNH_APP_ARG_LANGUAGE
|
language=$YNH_APP_ARG_LANGUAGE
|
||||||
|
|
||||||
### If it's a multi-instance app, meaning it can be installed several times independently
|
|
||||||
### The id of the app as stated in the manifest is available as $YNH_APP_ID
|
|
||||||
### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
|
|
||||||
### The app instance name is available as $YNH_APP_INSTANCE_NAME
|
|
||||||
### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
|
|
||||||
### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
|
|
||||||
### - ynhexample__{N} for the subsequent installations, with N=3,4, ...
|
|
||||||
### The app instance name is probably what interests you most, since this is
|
|
||||||
### guaranteed to be unique. This is a good unique identifier to define installation path,
|
|
||||||
### db names, ...
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Validating installation parameters..."
|
ynh_print_info --message="Validating installation parameters..."
|
||||||
|
|
||||||
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
|
||||||
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
# Normalize the url path syntax
|
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Storing installation settings..."
|
ynh_print_info --message="Storing installation settings..."
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
ynh_app_setting_set $app admin $admin
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
ynh_app_setting_set $app language $language
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -69,52 +55,37 @@ ynh_app_setting_set $app language $language
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Installing dependencies..."
|
ynh_print_info --message="Installing dependencies..."
|
||||||
|
|
||||||
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
|
||||||
### Those deb packages will be installed as dependencies of this package.
|
|
||||||
### If you're not using this helper:
|
|
||||||
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
|
||||||
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
|
||||||
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Creating a MySQL database..."
|
ynh_print_info --message="Creating a MySQL database..."
|
||||||
|
|
||||||
### Use these lines if you need a database for the application.
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
|
db_user=$db_name
|
||||||
### The password will be stored as 'mysqlpwd' into the app settings,
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
### and will be available as $db_pwd
|
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
### If you're not using these lines:
|
|
||||||
### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script
|
|
||||||
### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script
|
|
||||||
### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script
|
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid $app)
|
|
||||||
ynh_app_setting_set $app db_name $db_name
|
|
||||||
ynh_mysql_setup_db $db_name $db_name
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Setting up source files..."
|
ynh_print_info --message="Setting up source files..."
|
||||||
|
|
||||||
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
||||||
### downloaded from an upstream source, like a git repository.
|
### downloaded from an upstream source, like a git repository.
|
||||||
### `ynh_setup_source` use the file conf/app.src
|
### `ynh_setup_source` use the file conf/app.src
|
||||||
|
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source "$final_path"
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Configuring nginx web server..."
|
ynh_print_info --message="Configuring nginx web server..."
|
||||||
|
|
||||||
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
||||||
|
|
||||||
|
@ -124,26 +95,15 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Configuring system user..."
|
ynh_print_info --message="Configuring system user..."
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Configuring php-fpm..."
|
ynh_print_info --message="Configuring php-fpm..."
|
||||||
|
|
||||||
### `ynh_add_fpm_config` is used to set up a PHP config.
|
|
||||||
### You can remove it if your app doesn't use PHP.
|
|
||||||
### `ynh_add_fpm_config` will use the files conf/php-fpm.conf and conf/php-fpm.ini
|
|
||||||
### If you're not using these lines:
|
|
||||||
### - You can remove these files in conf/.
|
|
||||||
### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script
|
|
||||||
### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script
|
|
||||||
### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script
|
|
||||||
### With the reload at the end of the script.
|
|
||||||
### - And the section "PHP-FPM CONFIGURATION" in the upgrade script
|
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
@ -151,11 +111,14 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "FreshRSS setup script..."
|
# SETUPING FRESHRSS
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="FreshRSS setup script..."
|
||||||
|
|
||||||
$final_path/cli/do-install.php --default_user $admin --auth_type http_auth --environment production --base_url https://$domain$path_url --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_name --db-password $db_pwd --db-base $db_name
|
$final_path/cli/do-install.php --default_user $admin --auth_type http_auth --environment production --base_url https://$domain$path_url --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_name --db-password $db_pwd --db-base $db_name
|
||||||
|
|
||||||
# Add users
|
# Add users
|
||||||
ynh_print_info "Creating users..."
|
ynh_print_info --message="Creating users..."
|
||||||
for myuser in $(ynh_user_list)
|
for myuser in $(ynh_user_list)
|
||||||
do
|
do
|
||||||
user_token=$(ynh_string_random)
|
user_token=$(ynh_string_random)
|
||||||
|
@ -163,12 +126,13 @@ do
|
||||||
done
|
done
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CRON SETUP
|
# SETUP A CRON
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Setting up cron..."
|
ynh_print_info --message="Setting up cron..."
|
||||||
|
|
||||||
cron_path="/etc/cron.d/$app"
|
cron_path="/etc/cron.d/$app"
|
||||||
ynh_replace_string "__FINALPATH__" $final_path ../conf/freshrss.cron
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string=$final_path --target_file="../conf/freshrss.cron"
|
||||||
ynh_replace_string "__APP__" $app ../conf/freshrss.cron
|
ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file="../conf/freshrss.cron"
|
||||||
cp ../conf/freshrss.cron "$cron_path"
|
cp ../conf/freshrss.cron "$cron_path"
|
||||||
chmod 644 "$cron_path"
|
chmod 644 "$cron_path"
|
||||||
|
|
||||||
|
@ -181,10 +145,6 @@ chmod 644 "$cron_path"
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
### For security reason, any app should set the permissions to root: before anything else.
|
|
||||||
### Then, if write authorization is needed, any access should be given only to directories
|
|
||||||
### that really need such authorization.
|
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chown -R root: $final_path
|
chown -R root: $final_path
|
||||||
chown -R $app: $final_path/data/
|
chown -R $app: $final_path/data/
|
||||||
|
@ -194,21 +154,21 @@ chown -R $app: $final_path/extensions/
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Configuring SSOwat..."
|
ynh_print_info --message="Configuring SSOwat..."
|
||||||
|
|
||||||
#skip api directory
|
#skip api directory
|
||||||
ynh_app_setting_set "$app" unprotected_regex "^\/api\/.*|\/scripts\/api.js$"
|
ynh_app_setting_set --app="$app" --key=unprotected_regex --value="^\/api\/.*|\/scripts\/api.js$"
|
||||||
ynh_app_setting_delete "$app" unprotected_uris
|
ynh_app_setting_delete --app="$app" --key=unprotected_uris
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading nginx web server..."
|
ynh_print_info --message="Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Installation of $app completed"
|
ynh_print_info --message="Installation of $app completed"
|
||||||
|
|
|
@ -12,14 +12,14 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading installation settings..."
|
ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -28,15 +28,15 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE MYSQL DATABASE
|
# REMOVE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing the MySQL database"
|
ynh_print_info --message="Removing the MySQL database..."
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_mysql_remove_db $db_user $db_name
|
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing dependencies"
|
ynh_print_info --message="Removing dependencies..."
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
@ -44,15 +44,15 @@ ynh_remove_app_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing app main directory"
|
ynh_print_info --message="Removing app main directory..."
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove "$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing nginx web server configuration"
|
ynh_print_info --message="Removing nginx web server configuration..."
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
@ -60,7 +60,7 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE PHP-FPM CONFIGURATION
|
# REMOVE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing php-fpm configuration"
|
ynh_print_info --message="Removing php-fpm configuration..."
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated php-fpm config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
@ -79,13 +79,13 @@ ynh_secure_remove "/etc/cron.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing the dedicated system user"
|
ynh_print_info --message="Removing the dedicated system user..."
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete $app
|
ynh_system_user_delete --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Removal of $app completed"
|
ynh_print_info --message="Removal of $app completed"
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -18,48 +19,49 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading settings..."
|
ynh_print_info --message="Loading settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
db_user=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Validating restoration parameters..."
|
ynh_print_info --message="Validating restoration parameters..."
|
||||||
|
|
||||||
ynh_webpath_available $domain $path_url \
|
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die "There is already a directory: $final_path "
|
|| ynh_die --message="There is already a directory: $final_path "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Restoring nginx configuration..."
|
ynh_print_info --message="Restoring nginx configuration..."
|
||||||
|
|
||||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Restoring the app main directory..."
|
ynh_print_info --message="Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file "$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Recreating the dedicated system user..."
|
ynh_print_info --message="Recreating the dedicated system user..."
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE USER RIGHTS
|
# RESTORE USER RIGHTS
|
||||||
|
@ -74,14 +76,14 @@ chown -R $app: $final_path/extensions/
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reinstalling dependencies..."
|
ynh_print_info --message="Reinstalling dependencies..."
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
@ -89,31 +91,30 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Restoring the MySQL database..."
|
ynh_print_info --message="Restoring the MySQL database..."
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
ynh_mysql_setup_db $db_name $db_name $db_pwd
|
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE CRON FILE
|
# RESTORE THE CRON FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "/etc/cron.d/$app"
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading nginx web server and php-fpm..."
|
ynh_print_info --message="Reloading nginx web server and php-fpm..."
|
||||||
|
|
||||||
systemctl reload php7.0-fpm
|
ynh_systemd_action --service_name=php7.0-fpm --action=reload
|
||||||
systemctl reload nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Restoration completed for $app"
|
ynh_print_info --message="Restoration completed for $app"
|
||||||
|
|
|
@ -12,49 +12,54 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading installation settings..."
|
ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
admin=$(ynh_app_setting_get $app admin)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
language=$(ynh_app_setting_get $app language)
|
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK VERSION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Ensuring downward compatibility..."
|
ynh_print_info --message="Ensuring downward compatibility..."
|
||||||
|
|
||||||
# If db_name doesn't exist, create it
|
# If db_name doesn't exist, create it
|
||||||
if [ -z $db_name ]; then
|
if [ -z "$db_name" ]; then
|
||||||
db_name=$(ynh_sanitize_dbid $app)
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
ynh_app_setting_set $app db_name $db_name
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z $admin ]; then
|
if [ -z "$admin" ]; then
|
||||||
admin=$(ynh_app_setting_get $app admin_user)
|
admin=$(ynh_app_setting_get --app=$app --key=admin_user)
|
||||||
if [ -z $admin ]; then
|
if [ -z $admin ]; then
|
||||||
ynh_die --message="no admin user found"
|
ynh_die --message="no admin user found"
|
||||||
fi;
|
fi;
|
||||||
ynh_app_setting_delete $app admin_user
|
ynh_app_setting_delete --app=$app --key=admin_user
|
||||||
ynh_app_setting_set $app admin $admin
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If final_path doesn't exist, create it
|
# If final_path doesn't exist, create it
|
||||||
if [ -z $final_path ]; then
|
if [ -z "$final_path" ]; then
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backing up the app before upgrading (may take a while)..."
|
ynh_print_info --message="Backing up the app before upgrading (may take a while)..."
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -65,20 +70,19 @@ ynh_clean_setup () {
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE PATH
|
# CHECK THE PATH
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Normalize the URL path syntax
|
# Normalize the URL path syntax
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading source files..."
|
ynh_print_info --message="Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
# into tmp dir
|
# into tmp dir
|
||||||
|
@ -88,7 +92,7 @@ ynh_setup_source "$tmp_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading nginx web server configuration..."
|
ynh_print_info --message="Upgrading nginx web server configuration..."
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -96,14 +100,14 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading dependencies..."
|
ynh_print_info --message="Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Making sure dedicated system user exists..."
|
ynh_print_info --message="Making sure dedicated system user exists..."
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
@ -111,7 +115,7 @@ ynh_system_user_create $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading php-fpm configuration..."
|
ynh_print_info --message="Upgrading php-fpm configuration..."
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
@ -144,7 +148,7 @@ ynh_replace_string "APPNAMETOCHANGE" $app ../hooks/post_user_delete
|
||||||
#=================================================
|
#=================================================
|
||||||
# CRON SETUP
|
# CRON SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Setting up cron..."
|
ynh_print_info --message="Setting up cron..."
|
||||||
cron_path="/etc/cron.d/$app"
|
cron_path="/etc/cron.d/$app"
|
||||||
ynh_replace_string "__FINALPATH__" $final_path ../conf/freshrss.cron
|
ynh_replace_string "__FINALPATH__" $final_path ../conf/freshrss.cron
|
||||||
ynh_replace_string "__APP__" $app ../conf/freshrss.cron
|
ynh_replace_string "__APP__" $app ../conf/freshrss.cron
|
||||||
|
@ -165,22 +169,23 @@ chown -R $app: $final_path/extensions/
|
||||||
|
|
||||||
# reconfigure application with latest parameters
|
# reconfigure application with latest parameters
|
||||||
$final_path/cli/reconfigure.php --default_user $admin --auth_type http_auth --environment production --base_url https://$domain$path_url --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_name --db-password $db_pwd --db-base $db_name
|
$final_path/cli/reconfigure.php --default_user $admin --auth_type http_auth --environment production --base_url https://$domain$path_url --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_name --db-password $db_pwd --db-base $db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading SSOwat configuration..."
|
ynh_print_info --message="Upgrading SSOwat configuration..."
|
||||||
|
|
||||||
ynh_app_setting_set "$app" unprotected_regex "^\/api\/.*|\/scripts\/api.js$"
|
ynh_app_setting_set --app="$app" --key=unprotected_regex --value="^\/api\/.*|\/scripts\/api.js$"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading nginx web server..."
|
ynh_print_info --message="Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Upgrade of $app completed"
|
ynh_print_info --message="Upgrade of $app completed"
|
||||||
|
|
Loading…
Reference in a new issue