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

Fix upgrade, cleanup and option to select an admin

This commit is contained in:
Florent 2024-03-03 12:42:45 +01:00 committed by Florent F
parent a35f70aa15
commit 1521553b5b
6 changed files with 38 additions and 9 deletions

View file

@ -1,6 +1,9 @@
Now login to Joplin
- Url: https://__DOMAIN____PATH__
- Email: admin@localhost
- Password: __ADMIN_PASS__
Then you may change the default email and password at this page: https://joplin.local/admin/users
- Url: https://**DOMAIN\_\_**PATH\_\_
- Email: **ADMIN_MAIL**
- Password: **ADMIN_PASS**
Then you may change the default password at this page: https://**DOMAIN\_\_**PATH\_\_/admin/users
Then download one of these Joplin apps and configure the synchronisation with your server: https://joplinapp.org/help/install/

View file

@ -38,6 +38,9 @@ ram.runtime = "50M"
type = "group"
default = "visitors"
[install.admin]
type = "user"
[resources]
[resources.sources]

View file

@ -34,7 +34,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP THE MYSQL DATABASE
# BACKUP THE PostgreSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the PostgreSQL database..."

View file

@ -10,7 +10,12 @@ source _common.sh
source /usr/share/yunohost/helpers
admin_pass=$(ynh_string_random --length=24)
admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
admin_name=$(ynh_user_get_info --username=$admin --key="fullname")
# Store these values even if we don't need them, so they are printed in the post-install message
ynh_app_setting_set --app=$app --key=admin_pass --value=$admin_pass
ynh_app_setting_set --app=$app --key=admin_mail --value=$admin_mail
#=================================================
# INSTALL DEPENDENCIES
@ -60,7 +65,7 @@ chown $app:$app "$install_dir/.env"
#=================================================
# INSTALL JOPLIN
#=================================================
ynh_script_progression --message="Installing $app..." --weight=10
ynh_script_progression --message="Building $app..." --weight=10
pushd $install_dir
ynh_use_nodejs
@ -87,8 +92,11 @@ ynh_script_progression --message="Changing default admin password..." --weight=1
hashed_pwd=$(bcrypt_password "$admin_pass")
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" <<< \
"UPDATE users SET password='$hashed_pwd' WHERE email='admin@localhost'"
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" <<< "
UPDATE users
SET password='$hashed_pwd', email='$admin_mail', full_name='$admin_name'
WHERE email='admin@localhost'
"
#=================================================
# END OF SCRIPT

View file

@ -20,7 +20,7 @@ ynh_restore_file --origin_path="$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# RESTORE THE MYSQL DATABASE
# RESTORE THE PostgreSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1

View file

@ -42,6 +42,21 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=5
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# BUILD
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Building $app..." --weight=10
pushd $install_dir
ynh_use_nodejs
sudo -u $app env $ynh_node_load_PATH BUILD_SEQUENCIAL=1 yarn install --inline-builds
# sudo -u $app env $ynh_node_load_PATH yarn cache clean
# ynh_secure_remove .yarn/berry
popd
fi
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================