1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/firefly-iii_ynh.git synced 2024-09-03 18:36:13 +02:00

Upgrade to 5.0.5

This commit is contained in:
root 2020-02-22 01:28:06 +01:00
parent ba6f806986
commit 0ec9acf071
7 changed files with 115 additions and 30 deletions

View file

@ -19,6 +19,9 @@ location ^~ __PATH__ {
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
include conf.d/yunohost_panel.conf.inc;
}
location @firefly {

View file

@ -30,7 +30,7 @@ group = __USER__
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php7.2-fpm-__NAMETOCHANGE__.sock
listen = /var/run/php7.3-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: 128 (-1 on FreeBSD and OpenBSD)

View file

@ -34,6 +34,16 @@
},
"example": "example.com"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Firefly III",
"fr": "Choisissez un chemin pour Firefly III"
},
"example": "/example",
"default": "/firefly"
},
{
"name": "admin",
"type": "user",

View file

@ -5,7 +5,8 @@
#=================================================
# dependencies used by the app
pkg_dependencies="php7.2 php7.2-zip php7.2-fpm php7.2-mysql php7.2-xml php7.2-intl php7.2-mbstring php7.2-gd php7.2-curl php7.2-bcmath php7.2-opcache php7.2-ldap"
phpversion="7.3"
pkg_dependencies="php${phpversion}-zip php${phpversion}-fpm php${phpversion}-mysql php${phpversion}-xml php${phpversion}-intl php${phpversion}-mbstring php${phpversion}-gd php${phpversion}-curl php${phpversion}-bcmath php${phpversion}-opcache php${phpversion}-ldap"
# ============= FUTURE YUNOHOST HELPER =============
# Delete a file checksum from the app settings

View file

@ -7,6 +7,9 @@
#=================================================
source _common.sh
source ynh_add_extra_apt_repos__3
source ynh_install_php__3
source ynh_composer
source /usr/share/yunohost/helpers
#=================================================
@ -21,7 +24,7 @@ ynh_abort_if_errors
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
random_key=$(ynh_string_random 32)
@ -44,8 +47,8 @@ app=$YNH_APP_INSTANCE_NAME
ynh_script_progression --message="Validating installation parameters..." --time --weight=1
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"
#mkdir $final_path
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
@ -64,10 +67,9 @@ ynh_app_setting_set --app=$app --key=random_key --value=$random_key
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --time --weight=1
# ynh_install_php7
ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Installing dependencies..." --time --weight=1
ynh_install_php --phpversion="$phpversion" --package="$pkg_dependencies"
#=================================================
# CREATE A MYSQL DATABASE
@ -105,18 +107,22 @@ ynh_script_progression --message="Configuring system user..." --time --weight=1
ynh_system_user_create --username=$app
#=================================================
# PHP-FPM 7.2 CONFIGURATION
# PHP-FPM 7.3 CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring php-fpm..." --time --weight=1
# Create a dedicated php-fpm7.1 config
# ynh_add_fpm7.2_config
ynh_add_fpm_config --phpversion=7.2
#ynh_add_fpm7.2_config
ynh_add_fpm_config --phpversion="$phpversion"
#=================================================
# SPECIFIC SETUP
#=================================================
# Install via composer
ynh_install_composer --phpversion="$phpversion"
# create a user
email=$(ynh_user_get_info $admin 'mail')
@ -133,23 +139,26 @@ ynh_replace_string "yunobase" "$db_name" "$final_path/.env"
ynh_replace_string "yunomail" "$email" "$final_path/.env"
ynh_replace_string "yunodomain" "$domain" "$final_path/.env"
init_composer $final_path $app
( cd $final_path && sudo /usr/bin/php7.2 artisan config:clear )
#init_composer $final_path $app
db_name=$(ynh_sanitize_dbid $app)
cd $final_path && php$phpversion artisan migrate:refresh --seed
cd $final_path && php$phpversion artisan firefly-iii:upgrade-database
cd $final_path && php$phpversion artisan passport:install
#( cd $final_path && sudo /usr/bin/php7.3 artisan config:clear )
# setup application config
(
cd $final_path && sudo /usr/bin/php7.2 artisan -q :refresh --seed --force
cd $final_path && sudo /usr/bin/php7.2 artisan passport:install --force
)
#(
#cd $final_path && sudo /usr/bin/php7.3 artisan -q :refresh --seed --force
#cd $final_path && sudo /usr/bin/php7.3 artisan passport:install --force
#)
#=================================================
# SETUP APPLICATION PERMISSIONS
#=================================================
# Set right permissions
chown -R $app: $final_path
chown -R $app:$app $final_path
chmod -R 775 ${final_path}/storage
#=================================================
# STORE THE CHECKSUM OF THE CONFIG FILE
@ -202,27 +211,17 @@ ynh_use_logrotate
### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script
### - As well as the section "ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
yunohost service add $app --log "/var/log/$app/$app.log"
#yunohost service add $app --log "/var/log/$app/$app.log"
# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added
#yunohost service add $app --description "$app daemon for XXX" --log "/var/log/$app/$app.log"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
# systemctl reload php7.2-fpm
# systemctl reload nginx
ynh_systemd_action --service_name=php7.2-fpm --action=reload
ynh_systemd_action --service_name=php7.3-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
# Set default php to php5 or php7.0
# if [ "$(lsb_release --codename --short)" == "jessie" ]; then
# update-alternatives --set php /usr/bin/php5
# else
# update-alternatives --set php /usr/bin/php7.0
# fi
#=================================================
# END OF SCRIPT

View file

@ -76,6 +76,14 @@ ynh_script_progression --message="Removing php-fpm configuration..." --time --we
ynh_remove_fpm_config
# ynh_remove_fpm7.2_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --time --weight=1
# Remove metapackage and its dependencies
ynh_remove_php "$phpversion"
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================

64
scripts/ynh_composer~ Normal file
View file

@ -0,0 +1,64 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
# Package dependencies
pkg_dependencies="php-cli php-common php-intl php-json php-mcrypt php-pear php-auth-sasl php-mail-mime php-patchwork-utf8 php-net-smtp php-net-socket php-net-ldap2 php-net-ldap3 php-zip php-gd php-mbstring php-curl"
# Plugins version
contextmenu_version=2.3
automatic_addressbook_version=v0.4.3
carddav_version=3.0.3
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
# Execute a command with Composer
#
# usage: ynh_composer_exec --phpversion=phpversion [--workdir=$final_path] --commands="commands"
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -c, --commands - Commands to execute.
ynh_composer_exec () {
# Declare an array to define the options of this helper.
local legacy_args=vwc
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
local phpversion
local workdir
local commands
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}"
COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \
-d "$workdir" --quiet --no-interaction
}
# Install and initialize Composer in the given directory
#
# usage: ynh_install_composer --phpversion=phpversion [--workdir=$final_path]
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
ynh_install_composer () {
# Declare an array to define the options of this helper.
local legacy_args=vw
declare -Ar args_array=( [v]=phpversion= [w]=workdir= )
local phpversion
local workdir
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}"
curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --quiet --install-dir="$workdir" \
|| ynh_die "Unable to install Composer."
# update dependencies to create composer.lock
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev" \
|| ynh_die "Unable to update core dependencies with Composer."
}