diff --git a/check_process b/check_process index d952d61..fec9a17 100644 --- a/check_process +++ b/check_process @@ -12,7 +12,7 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=231c5e281e9cafabd35d4a6ef3c27fec6f3c470f + upgrade=1 from_commit=5ee628f58c4f9ea6b6fd48d843453c47ed3d34e4 backup_restore=1 multi_instance=1 change_url=0 diff --git a/conf/.env b/conf/.env index 56e541f..23d51b3 100644 --- a/conf/.env +++ b/conf/.env @@ -212,10 +212,10 @@ ADLDAP_AUTO_CONNECT=true # LDAP connection settings # You can set the following variables from a file by appending them with _FILE: # ADLDAP_CONTROLLERS, ADLDAP_PORT, ADLDAP_BASEDN -ADLDAP_CONTROLLERS= +ADLDAP_CONTROLLERS=127.0.0.1 ADLDAP_PORT=389 ADLDAP_TIMEOUT=5 -ADLDAP_BASEDN="" +ADLDAP_BASEDN="dc=yunohost,dc=org" ADLDAP_FOLLOW_REFFERALS=false # SSL/TLS settings @@ -233,15 +233,15 @@ ADLDAP_ADMIN_USERNAME= ADLDAP_ADMIN_PASSWORD= # You can set the following variables from a file by appending them with _FILE: -ADLDAP_ACCOUNT_PREFIX= -ADLDAP_ACCOUNT_SUFFIX= +ADLDAP_ACCOUNT_PREFIX="uid=" +ADLDAP_ACCOUNT_SUFFIX=",dc=yunohost,dc=org" # LDAP authentication settings. ADLDAP_PASSWORD_SYNC=false ADLDAP_LOGIN_FALLBACK=false -ADLDAP_DISCOVER_FIELD=distinguishedname -ADLDAP_AUTH_FIELD=distinguishedname +ADLDAP_DISCOVER_FIELD="uid" +ADLDAP_AUTH_FIELD="uid" # field to sync as local username. # You can set the following variable from a file by appending it with _FILE: diff --git a/doc/screenshots/budget.png b/doc/screenshots/budget.png new file mode 100644 index 0000000..2e93ee2 Binary files /dev/null and b/doc/screenshots/budget.png differ diff --git a/scripts/_common.sh b/scripts/_common.sh index 663a68b..cfd7a85 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,6 +5,10 @@ #================================================= # dependencies used by the app + +latest_tag=$(curl -s https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest | grep 'tag_name' | cut -d\" -f4) +tag="5.5.11" + pkg_dependencies="redis-server" YNH_PHP_VERSION="7.4" @@ -14,6 +18,9 @@ YNH_COMPOSER_VERSION="2.0.13" extra_php_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-ldap" +# Composer version +YNH_COMPOSER_VERSION="2.0.13" + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/change_url b/scripts/change_url index 8d7bfa9..8aef9cb 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,7 +28,6 @@ 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) - phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= diff --git a/scripts/install b/scripts/install index 8ee20c4..8078c47 100755 --- a/scripts/install +++ b/scripts/install @@ -26,7 +26,7 @@ admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC random_key=$(ynh_string_random --length=32) email=$(ynh_user_get_info --username=$admin --key=mail) - +update=1 app=$YNH_APP_INSTANCE_NAME #================================================= @@ -49,6 +49,7 @@ 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=random_key --value=$random_key +ynh_app_setting_set --app=$app --key=update --value=$update #================================================= # INSTALL DEPENDENCIES @@ -75,14 +76,26 @@ 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 +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." +ynh_script_progression --message="Cloning Firefly-iii..." 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" + +git clone -b $tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index ae34e38..fad730b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,6 +24,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) random_key=$(ynh_app_setting_get --app=$app --key=random_key) email=$(ynh_user_get_info --username=$admin --key=mail) +update=$(ynh_app_setting_get --app=$app --key=update) #================================================= # CHECK VERSION @@ -78,6 +79,14 @@ 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" +#================================================= +# 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" + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -86,30 +95,56 @@ ynh_system_user_create --username=$app --home_dir="$final_path" if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." + if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; + then + pushd "$final_path" + if [ $update -eq 1 ] + then + git fetch origin tag $latest_tag --no-tags + git checkout $latest_tag + else + git fetch origin tag $tag --no-tags + git checkout $tag + fi + ynh_secure_remove bootstrap/cache/* + ynh_secure_remove vendor/ + popd + else + ynh_script_progression --message="Upgrading source files..." + # Create a temporary directory + tmpdir="$(mktemp -d)" - # Create a temporary directory - tmpdir="$(mktemp -d)" - - # Backup the config file in the temp dir + # Backup the config file in the temp dir mkdir -p "$tmpdir/storage/upload" mkdir -p "$tmpdir/storage/export" mkdir -p "$final_path/storage/upload/" mkdir -p "$final_path/storage/export/" - cp -a "$final_path/storage/upload/" "$tmpdir/storage/upload/" + cp -aT "$final_path/storage/upload" "$tmpdir/storage/upload/$" cp -a "$final_path/.env" "$tmpdir/.env" - cp -a "$final_path/storage/export/" "$tmpdir/storage/export/" + cp -aT "$final_path/storage/export" "$tmpdir/storage/export/" ynh_secure_remove --file="$final_path" # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + if [ $update -eq 1 ] + then + + git clone -b $latest_tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path - # Restore the config file - cp -a "$tmpdir/storage/upload/" "$final_path/storage/upload/" - cp -a "$tmpdir/storage/export/" "$final_path/storage/export/" + else + git clone -b $tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path + + fi + + ynh_secure_remove bootstrap/cache/* + # Restore the config file and data + mkdir -p "$final_path/storage/upload/" + mkdir -p "$final_path/storage/export/" + cp -aT "$tmpdir/storage/upload" "$final_path/storage/upload" + cp -aT "$tmpdir/storage/export" "$final_path/storage/export" cp -a "$tmpdir/.env" "$final_path/.env" # Remove temporary directory ynh_secure_remove --file="$tmpdir" + fi fi chmod 750 "$final_path" @@ -149,7 +184,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="Updating PHP dependencies..." chown -R $app $final_path - ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" #================================================= @@ -158,6 +192,7 @@ ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$f ynh_script_progression --message="Modifying a config file..." ynh_add_config --template="../conf/.env" --destination="$final_path/.env" + chmod 400 "$final_path/.env" chown $app "$final_path/.env"