1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kimai2_ynh.git synced 2024-09-03 19:26:26 +02:00

Merge pull request #54 from YunoHost-Apps/upgrade

Upgrade to 1.17.1~ynh2
This commit is contained in:
yalh76 2022-06-12 13:47:07 +02:00 committed by GitHub
commit 568f12d00a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 87 additions and 118 deletions

View file

@ -20,7 +20,7 @@ This is the reloaded version of the open source timetracker Kimai. Right now its
Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic ideas of time-tracking and the current development team. It is based on a lot of great frameworks. Special thanks to Symfony v4, Doctrine, AdminThemeBundle (based on AdminLTE).
**Shipped version:** 1.17.1~ynh1
**Shipped version:** 1.17.1~ynh2
**Demo:** https://www.kimai.org/demo/

View file

@ -20,7 +20,7 @@ This is the reloaded version of the open source timetracker Kimai. Right now its
Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic ideas of time-tracking and the current development team. It is based on a lot of great frameworks. Special thanks to Symfony v4, Doctrine, AdminThemeBundle (based on AdminLTE).
**Version incluse :** 1.17.1~ynh1
**Version incluse :** 1.17.1~ynh2
**Démo :** https://www.kimai.org/demo/

View file

@ -1,8 +1,8 @@
;; Test complet mysql
; Manifest
domain="domain.tld"
admin="john"
is_public=1
admin="john"
database="mysql"
registration=1
; Checks
@ -13,10 +13,8 @@
setup_private=1
setup_public=1
upgrade=1
# 1.9~ynh1
upgrade=1 from_commit=22580412fae14859f661c1f9b54a3131a60c9323
# 1.11.1~ynh1
upgrade=1 from_commit=f26285511a167a1ed591a7fa96ae786ea89efb1e
# 1.17.1~ynh1
upgrade=1 from_commit=6b3ab38a5bf6aa48aaef23254381e8063839598b
backup_restore=1
multi_instance=1
port_already_use=0
@ -24,8 +22,8 @@
;; Test complet sqlite
; Manifest
domain="domain.tld"
admin="john"
is_public=1
admin="john"
database="sqlite"
registration=1
; Checks
@ -36,10 +34,8 @@
setup_private=1
setup_public=1
upgrade=1
# 1.9~ynh1
upgrade=1 from_commit=22580412fae14859f661c1f9b54a3131a60c9323
# 1.11.1~ynh1
upgrade=1 from_commit=f26285511a167a1ed591a7fa96ae786ea89efb1e
# 1.17.1~ynh1
upgrade=1 from_commit=6b3ab38a5bf6aa48aaef23254381e8063839598b
backup_restore=1
multi_instance=1
port_already_use=0
@ -47,8 +43,3 @@
;;; Options
Email=anmol@datamol.org
Notification=change
;;; Upgrade options
; commit=22580412fae14859f661c1f9b54a3131a60c9323
name=1.9~ynh1
; commit=f26285511a167a1ed591a7fa96ae786ea89efb1e
name=1.11.1~ynh1

View file

@ -5,8 +5,8 @@
###> symfony/framework-bundle ###
APP_ENV=prod
APP_SECRET=__RANDOM_KEY__
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS=localhost,example.com
TRUSTED_PROXIES=127.0.0.1
TRUSTED_HOSTS=localhost,__DOMAIN__
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###

View file

@ -5,8 +5,8 @@
###> symfony/framework-bundle ###
APP_ENV=prod
APP_SECRET=__RANDOM_KEY__
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS=localhost,example.com
TRUSTED_PROXIES=127.0.0.1
TRUSTED_HOSTS=localhost,__DOMAIN__
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###

View file

@ -10,6 +10,7 @@ kimai:
user:
registration: __REGISTRATION__
ldap:
activate: true
# more infos about the connection params can be found at:
# https://docs.laminas.dev/laminas-ldap/api/
connection:
@ -17,11 +18,11 @@ kimai:
# You can connect to multiple servers by setting their URLs like this:
# host: "ldap://ldap.example.local ldap://ldap2.example.local"
# host: "ldaps://ldap.example.local ldaps://ldap2.example.local"
host: 127.0.0.1
host: "ldap://127.0.0.1"
# Default port for your LDAP port server
# default: 389
#port: 389
port: 389
# Whether or not the LDAP client should use SSL encrypted transport.
# The useSsl and useStartTls options are mutually exclusive.
@ -80,20 +81,20 @@ kimai:
user:
# baseDn to query for users (mandatory setting).
baseDn: ou=users, dc=yunohost, dc=org
baseDn: "ou=users, dc=yunohost, dc=org"
# Field used to match the login username in your LDAP.
# If "bindRequiresDn: false" is set, the username is used in "bind".
# Otherwise a search is executed to find the users "dn" by finding the user
# via this attribute with his "baseDn" and the "filter" below.
# default: uid
usernameAttribute: uid
usernameAttribute: "uid"
# LDAP search base filter to find the user / the users DN.
# Do NOT include the rule (&(usernameAttribute=%s)), it will be appended
# automatically. The result of the search filter must return 1 result only.
# default: empty (results in (&(uid=%s)) with default usernameAttribute)
filter: (&(objectClass=inetOrgPerson))
filter: "(&(objectClass=inetOrgPerson))"
# LDAP search base filter to find the user attributes.
# This is used for a slightly different query than the one above, which is
@ -109,12 +110,12 @@ kimai:
attributes:
# The following 2 rules are automatically prepended and can be overwritten.
# Username is set to the value of the configured "usernameAttribute" field
- { ldap_attr: "usernameAttribute", user_method: setUsername }
- { ldap_attr: "uid", user_method: setUsername }
# Only applied if you don't configure a mapping for setEmail()
- { ldap_attr: mail, user_method: setEmail }
- { ldap_attr: "mail", user_method: setEmail }
# An example which will set the display name in Kimai from the
# value of the "common name" field in your LDAP
- { ldap_attr: cn, user_method: setAlias }
- { ldap_attr: "cn", user_method: setAlias }
# You can comment the following section, if you don't want to manage
# user roles in Kimai via LDAP groups. If you want to use the group
@ -123,7 +124,7 @@ kimai:
role:
# baseDn to query for groups, MUST be set to activate the "group import"
# default: empty (deactivated)
baseDn: ou=permission, dc=yunohost, dc=org
baseDn: "ou=permission, dc=yunohost, dc=org"
# Filter to query user groups, all results will be matched against
# the configured "groups" mapping below.
@ -132,24 +133,24 @@ kimai:
# The following example rule will be expanded to (for user "foo"):
# (&(&(objectClass=groupOfNames))(member=foo))
# default: empty
filter: (&(objectClass=posixGroup)(cn=__APP__*))
filter: "(&(objectClass=posixGroup)(cn=__APP__*))"
# The following field is taken from the LDAP user entry and its
# value is used in the filter above as "valueOfUsernameAttribute".
# The attribute must be given in lowercase!
# The example below uses "posix group style memberUid".
# default: dn
usernameAttribute: dn
usernameAttribute: "dn"
# Field that holds the group name, which will be used to map the
# LDAP groups with Kimai roles (see groups mapping below).
# default: cn
nameAttribute: cn
nameAttribute: "cn"
# Field that holds the users dn in your LDAP group definition.
# Value of this configuration is used in the filter (see above).
# default: member
userDnAttribute: inheritPermission
userDnAttribute: "inheritPermission"
# Convert LDAP group name (nameAttribute) to Kimai role
# You will very likely have to define mappings, unless your groups

View file

@ -3,9 +3,6 @@ root __FINALPATH__/public/ ;
location __PATH__/ {
# Path to source
# alias __FINALPATH__/public/ ;
index index.php;
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file

View file

@ -8,7 +8,7 @@
"de": "Eine web-basierte Mehrbenutzer-Zeiterfassung mit Rechnungsdruck mit Unterstützung für mobile Endgeräte",
"cs": "Víceuživatelská webová aplikace pro sledování času s podporou mobilních zařízení"
},
"version": "1.17.1~ynh1",
"version": "1.17.1~ynh2",
"url": "https://www.kimai.org",
"upstream": {
"license": "MIT",
@ -38,10 +38,6 @@
"name": "domain",
"type": "domain"
},
{
"name": "admin",
"type": "user"
},
{
"name": "is_public",
"type": "boolean",
@ -53,6 +49,10 @@
},
"default": false
},
{
"name": "admin",
"type": "user"
},
{
"name": "registration",
"type": "boolean",

View file

@ -5,14 +5,10 @@
#=================================================
# dependencies used by the app
pkg_dependencies=""
YNH_PHP_VERSION="7.3"
pkg_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-pdo php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-xsl php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-sqlite3"
YNH_COMPOSER_VERSION="2.0.4"
extra_php_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-pdo php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-xsl php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-sqlite3"
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -25,11 +25,11 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
registration=$YNH_APP_ARG_REGISTRATION
database="mysql"
random_key=$(ynh_string_random 32)
random_key=$(ynh_string_random --length=32)
app=$YNH_APP_INSTANCE_NAME
@ -71,7 +71,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE A MYSQL DATABASE
@ -100,6 +100,15 @@ chown -R $app:www-data "$final_path"
setfacl -dR -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/"
setfacl -R -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -108,15 +117,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC SETUP
#=================================================

View file

@ -45,13 +45,6 @@ test ! -d $final_path \
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
@ -73,18 +66,6 @@ chown -R $app:www-data "$final_path"
setfacl -dR -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/"
setfacl -R -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC RESTORATION
#=================================================
@ -95,6 +76,20 @@ ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================

View file

@ -34,6 +34,17 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
if [ "$database" == "sqlite" ]
then
ynh_script_progression --message="Sqlite is not more supported by Kimai2..."
ynh_script_progression --message="Kimai2 will be upgrade to last available version : 1.13"
if ynh_compare_current_package_version --comparison ge --version 1.17.1~ynh1
then
ynh_script_progression --message="Kimai2 sqlite version is already to the last available version, no upgrade will be made"
ynh_die "" 0
fi
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -80,13 +91,18 @@ if ! ynh_permission_exists --permission="super_admin"; then
ynh_permission_create --permission="super_admin" --allowed="$admin"
fi
if [ -z "$registration" ]; then
registration_enabled="false"
ynh_app_setting_set --app=$app --key=registration --value=$registration
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -96,35 +112,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
# Create a temporary directory and backup config
tmpdir="$(mktemp -d)"
if [ -f $final_path/config/packages/local.yaml ]; then
cp -af "$final_path/config/packages/local.yaml" "$tmpdir/."
fi
if [ -d $final_path/var/invoices ]; then
cp -af "$final_path/var/invoices" "$tmpdir/."
fi
if [ -d $final_path/var/data ]; then
cp -af "$final_path/var/data" "$tmpdir/."
fi
ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id="$database"
# Restore config
if [ -f $tmpdir/local.yaml ]; then
cp -af "$tmpdir/local.yaml" "$final_path/config/packages/."
fi
if [ -d $tmpdir/invoices ]; then
cp -af "$tmpdir/invoices" "$final_path/var/."
fi
if [ -d $tmpdir/data ]; then
cp -af "$tmpdir/data" "$final_path/var/."
fi
ynh_secure_remove --file="$tmpdir"
ynh_setup_source --dest_dir="$final_path" --source_id="$database" --keep="config/packages/local.yaml var/invoices/ var/data/"
fi
chmod 750 "$final_path"
@ -133,14 +122,6 @@ chown -R $app:www-data "$final_path"
setfacl -dR -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/"
setfacl -R -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@ -154,9 +135,17 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================