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 #48 from YunoHost-Apps/1.18.2

1.19.7
This commit is contained in:
Éric Gaspar 2022-05-20 15:14:10 +02:00 committed by GitHub
commit e397ca64fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 277 additions and 297 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.19.7~ynh1
**Demo:** https://www.kimai.org/demo/
@ -30,19 +30,19 @@ Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic i
## Disclaimers / important information
* Require dedicated domain like **kimai.domain.tld**.
* This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server)
* As sqlite support ended on version 1.14, if you choosed an sqlite databse during installation, Kimai2 upgrade is blocked to version 1.13
- Require dedicated domain like **kimai.domain.tld**.
- This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server)
#### Multi-user support
LDAP is supported
HTTP auth is not supported
Defaul Kimai2 roles are:
* ROLE_USER
* ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission
* ROLE_ADMIN => Kimai2 (Admin) YunoHost permission
* ROLE_SUPER_ADMIN => Kimai2 (Super_Admin) YunoHost permission
- LDAP is supported
- HTTP auth is not supported
#### Default Kimai2 roles are:
- ROLE_USER
- ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission
- ROLE_ADMIN => Kimai2 (Admin) YunoHost permission
- ROLE_SUPER_ADMIN => Kimai2 (Super_Admin) YunoHost permission
Those roles are directly managed using YunoHost permission system. User choosen during installation is granted the ROLE_SUPER_ADMIN
## Documentation and resources

View file

@ -16,7 +16,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.19.7~ynh1
**Démo :** https://www.kimai.org/demo/
@ -26,19 +26,19 @@ Kimai v2 has nothing in common with its predecessor Kimai v1 besides the basic i
## Avertissements / informations importantes
* Require dedicated domain like **kimai.domain.tld**.
* This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server)
* As sqlite support ended on version 1.14, if you choosed an sqlite databse during installation, Kimai2 upgrade is blocked to version 1.13
- Require dedicated domain like **kimai.domain.tld**.
- This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server)
#### Multi-user support
LDAP is supported
HTTP auth is not supported
Defaul Kimai2 roles are:
* ROLE_USER
* ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission
* ROLE_ADMIN => Kimai2 (Admin) YunoHost permission
* ROLE_SUPER_ADMIN => Kimai2 (Super_Admin) YunoHost permission
- LDAP is supported
- HTTP auth is not supported
#### Default Kimai2 roles are:
- ROLE_USER
- ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission
- ROLE_ADMIN => Kimai2 (Admin) YunoHost permission
- ROLE_SUPER_ADMIN => Kimai2 (Super_Admin) YunoHost permission
Those roles are directly managed using YunoHost permission system. User choosen during installation is granted the ROLE_SUPER_ADMIN
## Documentations et ressources

View file

@ -1,9 +1,8 @@
;; Test complet mysql
;; Test complet
; Manifest
domain="domain.tld"
admin="john"
is_public=1
database="mysql"
registration=1
; Checks
pkg_linter=1
@ -13,42 +12,14 @@
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
change_url=0
;; Test complet sqlite
; Manifest
domain="domain.tld"
admin="john"
is_public=1
database="sqlite"
registration=1
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=1
setup_nourl=0
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
backup_restore=1
multi_instance=1
port_already_use=0
change_url=0
;;; Options
Email=anmol@datamol.org
Notification=change
;;; Upgrade options
; commit=22580412fae14859f661c1f9b54a3131a60c9323
name=1.9~ynh1
; commit=f26285511a167a1ed591a7fa96ae786ea89efb1e
name=1.11.1~ynh1
; commit=6b3ab38a5bf6aa48aaef23254381e8063839598b
name=Merge pull request #45 from YunoHost-Apps/testing

21
conf/.env.example Normal file
View file

@ -0,0 +1,21 @@
# Configure your database connection and set the correct server version:
# for MySQL "serverVersion=5.7" and for MariaDB "serverVersion=mariadb-10.5.8"
DATABASE_URL=mysql://__DB_USER__:__DB_PWD__@127.0.0.1:3306/__DB_NAME__?charset=utf8&serverVersion=mariadb-10.5.12
# 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=
# do not change, unless you are developing for Kimai
APP_ENV=prod
# should be changed to a unique character sequence
APP_SECRET=__RANDOM_KEY__
# unlikely, that you need to change this one
CORS_ALLOW_ORIGIN=^https?://localhost(:[0-9]+)?$
# Running behind reverse proxies? Use those:
TRUSTED_PROXIES=127.0.0.1
TRUSTED_HOSTS=localhost,__DOMAIN__

View file

@ -1,36 +0,0 @@
# This file is a "template" of which env vars need to be defined for your application
# Copy this file to .env file for development, create environment variables when deploying to production
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
###> 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
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a MySQL database, use: "mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=10.2.12&charset=utf8"
# For a MariaDB database, use: "mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=mariadb-10.2.12"
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data/kimai.sqlite"
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
DATABASE_URL=mysql://__DB_USER__:__DB_PWD__@127.0.0.1:3306/__DB_NAME__
# DATABASE_URL=sqlite:///%kernel.project_dir%/var/data/kimai.sqlite
###< doctrine/doctrine-bundle ###
###> nelmio/cors-bundle ###
CORS_ALLOW_ORIGIN=^https?://localhost(:[0-9]+)?$
###< nelmio/cors-bundle ###
### Email configuration
# SMTP: smtp://localhost:25?encryption=&auth_mode=
# Google: gmail://username:password@default
# Amazon: ses://ACCESS_KEY:SECRET_KEY@default?region=eu-west-1
# Mailchimp: mandrill://KEY@default
# Mailgun: mailgun://KEY:DOMAIN@default
# Postmark: postmark://ID@default
# Sendgrid: sendgrid://KEY@default
# Disable emails: null://null
MAILER_URL=smtp://localhost:25?encryption=&auth_mode=
MAILER_FROM=admin@__DOMAIN__

View file

@ -1,36 +0,0 @@
# This file is a "template" of which env vars need to be defined for your application
# Copy this file to .env file for development, create environment variables when deploying to production
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
###> 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
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a MySQL database, use: "mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=10.2.12&charset=utf8"
# For a MariaDB database, use: "mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=mariadb-10.2.12"
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data/kimai.sqlite"
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
# DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name
DATABASE_URL=sqlite:///%kernel.project_dir%/var/data/kimai.sqlite
###< doctrine/doctrine-bundle ###
###> nelmio/cors-bundle ###
CORS_ALLOW_ORIGIN=^https?://localhost(:[0-9]+)?$
###< nelmio/cors-bundle ###
### Email configuration
# SMTP: smtp://localhost:25?encryption=&auth_mode=
# Google: gmail://username:password@default
# Amazon: ses://ACCESS_KEY:SECRET_KEY@default?region=eu-west-1
# Mailchimp: mandrill://KEY@default
# Mailgun: mailgun://KEY:DOMAIN@default
# Postmark: postmark://ID@default
# Sendgrid: sendgrid://KEY@default
# Disable emails: null://null
MAILER_URL=smtp://localhost:25?encryption=&auth_mode=
MAILER_FROM=admin@__DOMAIN__

7
conf/app.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.19.7.tar.gz
SOURCE_SUM=592122e74cae046a9e4dc89fbd7bf31464afe0c5f3edd82927c3921dac23223d
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

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

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.17.1.tar.gz
SOURCE_SUM=ceff0573591d2e5c70a679301caabe626d8545af5e987443c8155f633babcd0e
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,17 +1,14 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
root __FINALPATH__/public/ ;
location __PATH__/ {
location / {
# Path to source
# alias __FINALPATH__/public/ ;
alias __FINALPATH__/public/;
index index.php;
index index.html index.php;
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
#client_max_body_size 50M;
try_files $uri $uri/ /index.php$is_args$args;
try_files $uri $uri/ /index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/kevinpapst/kimai2/archive/1.13.tar.gz
SOURCE_SUM=caab9910a85b16772af678ee8519a8030cd8496aa94ce0a0027fffa6a91f3fef
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

15
config_panel.toml Normal file
View file

@ -0,0 +1,15 @@
version = "1.0"
[main]
name = "Kimai2 configuration"
[main.config]
name = "Configuration Options"
[main.config.registration]
ask = "Enable registration"
type = "boolean"
yes = "true"
no = "false"
help = "Allow Kimai2 account creation"
bind = "registration:__FINALPATH__/config/packages/local.yaml"

View file

@ -1,14 +1,14 @@
* Require dedicated domain like **kimai.domain.tld**.
* This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server)
* As sqlite support ended on version 1.14, if you choosed an sqlite databse during installation, Kimai2 upgrade is blocked to version 1.13
- Require dedicated domain like **kimai.domain.tld**.
- This app is multi-instance (you can have more then one Kimai instance running on a YunoHost server)
#### Multi-user support
LDAP is supported
HTTP auth is not supported
Defaul Kimai2 roles are:
* ROLE_USER
* ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission
* ROLE_ADMIN => Kimai2 (Admin) YunoHost permission
* ROLE_SUPER_ADMIN => Kimai2 (Super_Admin) YunoHost permission
- LDAP is supported
- HTTP auth is not supported
#### Default Kimai2 roles are:
- ROLE_USER
- ROLE_TEAMLEAD => Kimai2 (Teamlead) YunoHost permission
- ROLE_ADMIN => Kimai2 (Admin) YunoHost permission
- ROLE_SUPER_ADMIN => Kimai2 (Super_Admin) YunoHost permission
Those roles are directly managed using YunoHost permission system. User choosen during installation is granted the ROLE_SUPER_ADMIN

View file

@ -3,12 +3,12 @@
"id": "kimai2",
"packaging_format": 1,
"description": {
"en": "A multi-user application for time-tracking with support for mobile devices",
"fr": "Une application web de suivi du temps, multi-utilisateurs, et compatible avec les appareils mobiles",
"de": "Eine web-basierte Mehrbenutzer-Zeiterfassung mit Rechnungsdruck mit Unterstützung für mobile Endgeräte",
"en": "Multi-user application for time-tracking with support for mobile devices",
"fr": "Application web de suivi du temps, multi-utilisateurs, et compatible avec les appareils mobiles",
"de": "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.19.7~ynh1",
"url": "https://www.kimai.org",
"upstream": {
"license": "MIT",
@ -29,7 +29,7 @@
"multi_instance": true,
"services": [
"nginx",
"php7.3-fpm",
"php8.0-fpm",
"mysql"
],
"arguments": {
@ -57,8 +57,8 @@
"name": "registration",
"type": "boolean",
"ask": {
"en": "Are new users allowed to register ?",
"fr": "Est-ce que de nouveaux utilisateurs peuvent s'y inscrire ?",
"en": "Are new users allowed to register?",
"fr": "Les nouveaux utilisateurs sont-ils autorisés à s'inscrire ?",
"de": "Sollen sich neue Benutzer selber registrieren können ?",
"cs": "Mohou se noví uživatelé registrovat?"
},

View file

@ -4,14 +4,11 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies=""
YNH_PHP_VERSION="8.0"
YNH_PHP_VERSION="7.3"
YNH_COMPOSER_VERSION="2.3.3"
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"
pkg_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl 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"
#=================================================
# PERSONAL HELPERS

View file

@ -31,7 +31,6 @@ 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)
database=$(ynh_app_setting_get --app=$app --key=database)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -59,11 +58,9 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
if [ "$database" = "mysql" ]; then
ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
fi
ynh_mysql_dump_db --database="$db_name" > db.sql
#=================================================
# END OF SCRIPT

111
scripts/change_url Normal file
View file

@ -0,0 +1,111 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path="/"
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
#=================================================
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app"

View file

@ -28,8 +28,8 @@ path_url="/"
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
registration=$YNH_APP_ARG_REGISTRATION
database="mysql"
random_key=$(ynh_string_random 32)
random_key=$(ynh_string_random --length=32)
phpversion=$YNH_PHP_VERSION
app=$YNH_APP_INSTANCE_NAME
@ -53,7 +53,6 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=registration --value=$registration
ynh_app_setting_set --app=$app --key=database --value=$database
ynh_app_setting_set --app=$app --key=random_key --value=$random_key
#=================================================
@ -78,12 +77,10 @@ ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
ynh_script_progression --message="Creating a MySQL database..."
if [ "$database" = "mysql" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
fi
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -92,7 +89,7 @@ ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id="$database"
ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
@ -114,7 +111,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Configuring PHP-FPM..."
# 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)
#=================================================
@ -138,8 +135,7 @@ setfacl -R -m g:"www-data":rwX -m u:$app:rwX "$final_path/var/"
#=================================================
ynh_script_progression --message="Adding a configuration file..."
if [ $registration -eq 1 ]
then
if [ $registration -eq 1 ]; then
registration="true"
else
registration="false"
@ -151,7 +147,7 @@ chmod 400 "$final_path/config/packages/local.yaml"
chown $app:$app "$final_path/config/packages/local.yaml"
# Configure environement
ynh_add_config --template="../conf/.env.$database" --destination="$final_path/.env"
ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env"
chmod 400 "$final_path/.env"
chown $app:$app "$final_path/.env"
@ -161,14 +157,10 @@ chown $app:$app "$final_path/.env"
#=================================================
ynh_script_progression --message="Installing Kimai2..."
update-alternatives --set php /usr/bin/php$phpversion
pushd "$final_path"
ynh_exec_as $app php$phpversion bin/console kimai:install -n
popd
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -183,8 +175,6 @@ ynh_permission_create --permission="super_admin" --allowed "$admin"
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi

View file

@ -20,20 +20,16 @@ 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)
database=$(ynh_app_setting_get --app=$app --key=database)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Removing the MySQL database..."
if [ "$database" = "mysql" ]; then
ynh_script_progression --message="Removing the MySQL database..."
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
fi
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR

View file

@ -33,7 +33,6 @@ 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)
database=$(ynh_app_setting_get --app=$app --key=database)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -73,18 +72,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,16 +82,26 @@ 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..."
# 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
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..."
if [ "$database" = "mysql" ]; then
ynh_script_progression --message="Restoring the MySQL database..."
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
fi
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# GENERIC FINALIZATION

View file

@ -23,14 +23,14 @@ 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
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
registration=$(ynh_app_setting_get --app=$app --key=registration)
database=$(ynh_app_setting_get --app=$app --key=database)
random_key=$(ynh_app_setting_get --app=$app --key=random_key)
phpversion=$YNH_PHP_VERSION
registration=$(ynh_app_setting_get --app=$app --key=registration)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
@ -61,6 +61,11 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
if [ -z "$registration" ]; then
registration_enabled="false"
ynh_app_setting_set --app=$app --key=registration --value=$registration
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
@ -96,35 +101,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" --keep="$final_path/var/invoices $final_path/var/data $final_path/.env"
fi
chmod 750 "$final_path"
@ -154,8 +132,23 @@ 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"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
ynh_add_fpm_config
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
if [ $registration -eq 1 ]; then
registration="true"
else
registration="false"
fi
ynh_add_config --template="../conf/local.yaml" --destination="$final_path/config/packages/local.yaml"
chmod 400 "$final_path/config/packages/local.yaml"
chown $app:$app "$final_path/config/packages/local.yaml"
#=================================================
# SPECIFIC UPGRADE
@ -173,42 +166,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/"
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
if [ $registration -eq 1 ]
then
registration="true"
else
registration="false"
fi
ynh_add_config --template="../conf/local.yaml" --destination="$final_path/config/packages/local.yaml"
chmod 400 "$final_path/config/packages/local.yaml"
chown $app:$app "$final_path/config/packages/local.yaml"
# Configure environement
ynh_add_config --template="../conf/.env.$database" --destination="$final_path/.env"
chmod 400 "$final_path/.env"
chown $app:$app "$final_path/.env"
#=================================================
# INSTALL KIMAI2
#=================================================
ynh_script_progression --message="Installing Kimai2..."
update-alternatives --set php /usr/bin/php$phpversion
pushd "$final_path"
ynh_exec_as $app php$phpversion bin/console kimai:update -n
popd
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
#=================================================
# GENERIC FINALIZATION
#=================================================