1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kimai2_ynh.git synced 2024-09-03 19:26:26 +02:00
This commit is contained in:
ericgaspar 2022-03-12 18:21:33 +01:00
parent 0e07ef5755
commit 3b337cb56b
No known key found for this signature in database
GPG key ID: 574F281483054D44
8 changed files with 63 additions and 5 deletions

View file

@ -4,7 +4,6 @@ DATABASE_URL=mysql://__DB_USER__:__DB_PWD__@127.0.0.1:3306/__DB_NAME__?charset=u
# Email will be sent with this address as sender
MAILER_FROM=admin@__DOMAIN__
# Email connection (disabled by default) more info at https://www.kimai.org/documentation/emails.html
MAILER_URL=smtp://localhost:25?encryption=&auth_mode=

View file

@ -7,6 +7,7 @@ security:
secured_area:
kimai_ldap: ~
kimai:
data_dir: "__DATADIR__"
user:
registration: __REGISTRATION__
ldap:

View file

@ -3,10 +3,10 @@
#### Multi-user support
LDAP is supported
HTTP auth is not supported
- LDAP is supported
- HTTP auth is not supported
Defaul Kimai2 roles are:
#### Defaul Kimai2 roles are:
* ROLE_USER
* ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission
* ROLE_ADMIN => Kimai2 (Admin) YunoHost permission

View file

@ -31,6 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -43,6 +44,12 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$datadir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================

View file

@ -114,6 +114,20 @@ ynh_script_progression --message="Configuring PHP-FPM..."
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..."
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#=================================================
# SPECIFIC SETUP
#=================================================

View file

@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# STANDARD REMOVE
@ -39,6 +40,17 @@ ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..."
ynh_secure_remove --file="$datadir"
fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================

View file

@ -33,6 +33,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -72,6 +73,19 @@ 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 DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..."
ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p $datadir
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
@ -80,7 +94,7 @@ 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
# Recreate a dedicated PHP-FPM config
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)

View file

@ -25,6 +25,7 @@ db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
random_key=$(ynh_app_setting_get --app=$app --key=random_key)
phpversion=$YNH_PHP_VERSION
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
registration=$(ynh_app_setting_get --app=$app --key=registration)
@ -66,6 +67,16 @@ if [ -z "$registration" ]; then
ynh_app_setting_set --app=$app --key=registration --value=$registration
fi
# If public_path doesn't exist, create it
if [ -z "$datadir" ]; then
datadir=/home/yunohost.app/$app
mkdir -p $datadir
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all