YunoHost-Apps / paheko_ynh

Paheko package for YunoHost
https://paheko.cloud
GNU Affero General Public License v3.0
3 stars 4 forks source link

fix upgrade script, url to match VERSION, sqlite does not have a db n… #3

Closed rodinux closed 1 year ago

rodinux commented 1 year ago

…ame, there is no password users app and no shell, the directory off the app is

Problem

Solution

PR Status

Automatic tests

Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ after creating the PR, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

rodinux commented 1 year ago

!testme

yunohost-bot commented 1 year ago

May the CI gods be with you! Test Badge

rodinux commented 1 year ago

!testme

yunohost-bot commented 1 year ago

:stuck_out_tongue_winking_eye: Test Badge

rodinux commented 1 year ago

cross_fingers: I am not sure about the test with check_process...

rodinux commented 1 year ago

!testme

yunohost-bot commented 1 year ago

:v: Test Badge

rodinux commented 1 year ago

!testme

yunohost-bot commented 1 year ago

:carousel_horse: Test Badge

rodinux commented 1 year ago

Hum... I think it is Jenkins which is wrong...

rodinux commented 1 year ago

!testme

yunohost-bot commented 1 year ago

:rocket: Test Badge

rodinux commented 1 year ago

I don't understand what's wrong... On local test Yunohost I have try install stable garradin and then yunohost app upgrade garradin__3 -u https://github.com/YunoHost-Apps/paheko_ynh/tree/testing --debug and it fails, here the logs https://paste.yunohost.org/raw/owobutahom

rodinux commented 1 year ago

Better, but the problem is now withe userdel command ! logs here yunohost log share 20230115-195532-app_upgrade-garradin__3

fflorent commented 1 year ago

This is the cause of your error:

2023-01-15 20:13:24,633: DEBUG - + yunohost app list --installed -f paheko__3
2023-01-15 20:13:24,822: WARNING - usage: yunohost {app} ...
2023-01-15 20:13:24,822: WARNING -                 [-h] [--output-as {json,plain,none}] [--debug] [--quiet]
2023-01-15 20:13:24,822: WARNING -                 [--timeout ==SUPPRESS==] [-v]
2023-01-15 20:13:24,823: WARNING - yunohost: error: unrecognized arguments: --installed paheko__3

And indeed, these are unrecognized arguments for yunohost app list.

The culprit line is in your experimental helpers: https://github.com/YunoHost-Apps/paheko_ynh/blob/0f9f95802acd75a4801259111cadae96ae8a2b6e/scripts/experimental_helper.sh#L116

I think you'd rather pick your experimental helpers from YunoHost-Apps/Experimental_helpers. What interests you is here https://github.com/YunoHost-Apps/Experimental_helpers/tree/master/ynh_handle_app_migration

rodinux commented 1 year ago

!testme

rodinux commented 1 year ago

!testme

yunohost-bot commented 1 year ago

May the CI gods be with you! Test Badge

rodinux commented 1 year ago

Test failure as the app is not in the catalog but all the tests succeed ! Do we push on master @fflorent ? I am not sure about how to edit the manifest.json also for the id an/or the name ?

rodinux commented 1 year ago

strange, the tests succeed but on my local test it failed miserably

/var/log/yunohost/categories/operation/20230124-063515-app_upgrade-garradin.log
logs: 
  - 2023-01-24 07:35:32,019: DEBUG - + local -A args_array
  - 2023-01-24 07:35:32,019: DEBUG - + local username
  - 2023-01-24 07:35:32,019: DEBUG - + ynh_handle_getopts_args garradin
  - 2023-01-24 07:35:32,019: DEBUG - + set +o xtrace
  - 2023-01-24 07:35:32,029: DEBUG - + echo '! Helper used in legacy mode !'
  - 2023-01-24 07:35:32,029: DEBUG - + set +x
  - 2023-01-24 07:35:32,031: DEBUG - + ynh_system_user_exists garradin
  - 2023-01-24 07:35:32,032: DEBUG - + local legacy_args=u
  - 2023-01-24 07:35:32,032: DEBUG - + args_array=(['u']='username=')
  - 2023-01-24 07:35:32,032: DEBUG - + local -A args_array
  - 2023-01-24 07:35:32,032: DEBUG - + local username
  - 2023-01-24 07:35:32,032: DEBUG - + ynh_handle_getopts_args garradin
  - 2023-01-24 07:35:32,032: DEBUG - + set +o xtrace
  - 2023-01-24 07:35:32,041: DEBUG - + echo '! Helper used in legacy mode !'
  - 2023-01-24 07:35:32,042: DEBUG - + set +x
  - 2023-01-24 07:35:32,044: DEBUG - + getent passwd garradin
  - 2023-01-24 07:35:32,048: DEBUG - + deluser garradin
  - 2023-01-24 07:35:32,139: DEBUG - Suppression de l'utilisateur « garradin »...
  - 2023-01-24 07:35:32,140: DEBUG - Attention ! Le groupe « garradin » ne contient plus aucun membre.
  - 2023-01-24 07:35:32,148: WARNING - userdel: user garradin is currently used by process 12522
  - 2023-01-24 07:35:32,152: WARNING - /usr/sbin/deluser : « /sbin/userdel garradin » a retourné le code d'erreur 8. Abandon.
  - 2023-01-24 07:35:32,153: DEBUG - + ynh_exit_properly
  - 2023-01-24 07:35:32,153: DEBUG - + local exit_code=1
  - 2023-01-24 07:35:32,153: DEBUG - + rm -rf /var/cache/yunohost/download/
  - 2023-01-24 07:35:32,155: DEBUG - + '[' 1 -eq 0 ']'
  - 2023-01-24 07:35:32,155: DEBUG - + trap '' EXIT
  - 2023-01-24 07:35:32,155: DEBUG - + set +o errexit
  - 2023-01-24 07:35:32,155: DEBUG - + set +o nounset
  - 2023-01-24 07:35:32,155: DEBUG - + sleep 0.5
  - 2023-01-24 07:35:32,661: DEBUG - + type -t ynh_clean_setup
  - 2023-01-24 07:35:32,661: DEBUG - + ynh_clean_setup
  - 2023-01-24 07:35:32,662: DEBUG - + ynh_restore_upgradebackup
  - 2023-01-24 07:35:32,662: DEBUG - + ynh_print_err '--message=Upgrade failed.'
  - 2023-01-24 07:35:32,663: DEBUG - + local legacy_args=m
  - 2023-01-24 07:35:32,663: DEBUG - + args_array=(['m']='message=')
  - 2023-01-24 07:35:32,664: DEBUG - + local -A args_array
  - 2023-01-24 07:35:32,664: DEBUG - + local message
  - 2023-01-24 07:35:32,665: DEBUG - + ynh_handle_getopts_args '--message=Upgrade failed.'
  - 2023-01-24 07:35:32,665: DEBUG - + set +o xtrace
  - 2023-01-24 07:35:32,706: DEBUG - + ynh_print_log '[Error] Upgrade failed.'
  - 2023-01-24 07:35:32,707: DEBUG - + echo -e '[Error] Upgrade failed.'
  - 2023-01-24 07:35:32,707: WARNING - [Error] Upgrade failed.
  - 2023-01-24 07:35:32,710: DEBUG - + local app_bck=paheko
  - 2023-01-24 07:35:32,712: DEBUG - + NO_BACKUP_UPGRADE=0
  - 2023-01-24 07:35:32,712: DEBUG - + '[' 0 -eq 0 ']'
  - 2023-01-24 07:35:32,713: DEBUG - + ynh_backup_archive_exists paheko-pre-upgrade1
  - 2023-01-24 07:35:32,714: DEBUG - + jq -e --arg archive paheko-pre-upgrade1 '.archives | index($archive)'
  - 2023-01-24 07:35:32,715: DEBUG - + yunohost backup list --output-as json --quiet
  - 2023-01-24 07:35:33,020: DEBUG - + exit 1
  - 2023-01-24 07:35:34,027: ERROR - Impossible de mettre à jour garradin : Une erreur s'est produite durant l'exécution du script de mise à niveau de l'application
metadata: 
  ended_at: 2023-01-24 07:35:34
  env: 
    BASH_XTRACEFD: 7
    NO_BACKUP_UPGRADE: 0
    YNH_APP_BASEDIR: /var/cache/yunohost/app_tmp_work_dirs/app_6fza_hh9
    YNH_APP_CURRENT_VERSION: 1.2.2~ynh1
    YNH_APP_ID: garradin
    YNH_APP_INSTANCE_NAME: garradin
    YNH_APP_INSTANCE_NUMBER: 1
    YNH_APP_MANIFEST_VERSION: 1.2.4~ynh1
    YNH_APP_UPGRADE_TYPE: UPGRADE_APP
    YNH_ARCH: amd64
    YNH_CWD: /var/cache/yunohost/app_tmp_work_dirs/app_6fza_hh9/scripts
    YNH_INTERFACE: cli
    YNH_STDRETURN: /tmp/tmp9toarwbf/stdreturn
  error: Une erreur s'est produite durant l'exécution du script de mise à niveau de l'application
  interface: cli
  operation: app_upgrade
  parent: None
  related_to: 
    - app
    - garradin
  started_at: 2023-01-24 07:35:15
  success: False
  yunohost_version: 11.0.11
metadata_path: /var/log/yunohost/categories/operation/20230124-063515-app_upgrade-garradin.yml
name: 20230124-063515-app_upgrade-garradin
rodinux commented 1 year ago

Still have problems...

https://paste.yunohost.org/raw/rucopuqemi

rodinux commented 1 year ago

If I try an upgrade, I have two folders /var/www/garradin and /var/www/paheko and if I do a yunohost app list I see the two apps, but in fact no one is in used...

fflorent commented 1 year ago

I propose to merge this PR to testing: https://github.com/YunoHost-Apps/paheko_ynh/pull/6

And then we run a !testme and I attempt a migration on my side.

rodinux commented 1 year ago

!testme

yunohost-bot commented 1 year ago

May the CI gods be with you! Test Badge

yunohost-bot commented 1 year ago

May the CI gods be with you! Test Badge

rodinux commented 1 year ago

I have done a test on local virtual machine upgrade garradin with sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/paheko_ynh/tree/testing --debug, the upgrade succeed. It is nice !!

But it is very strange if I have a lookof the apps:

yunohost app list
apps: 
  0: 
    description: Logiciel libre de gestion d'association
    domain_path: yunohost.packaging/garradin
    id: garradin
    name: Paheko
    version: 1.2.6~ynh1
  1: 
    description: Application Web personnalisée avec accès SFTP pour servir des fichiers statiques (HTML, CSS, JS) et PHP
    domain_path: wordpress.yunohost.packaging/
    id: my_webapp
    name: My Webapp
    version: 1.0~ynh12
  2: 
    description: Logiciel libre de gestion d'association
    domain_path: yunohost.packaging/garradin
    id: paheko
    name: Paheko
    version: 1.2.6~ynh1

In fact there is only a paheko installed...

 ls /var/www/
html  my_webapp  paheko

Pehaps just beacause the app iis not still in the catalog ?? or something else

Wrong, after some time, it is resolved:

yunohost app list
apps: 
  0: 
    description: Application Web personnalisée avec accès SFTP pour servir des fichiers statiques (HTML, CSS, JS) et PHP
    domain_path: wordpress.yunohost.packaging/
    id: my_webapp
    name: My Webapp
    version: 1.0~ynh12
  1: 
    description: Logiciel libre de gestion d'association
    domain_path: yunohost.packaging/garradin
    id: paheko
    name: Paheko
    version: 1.2.6~ynh1

I am happy \o/ it ready now :+1:

fflorent commented 1 year ago

Wrong, after some time, it is resolved:

Yep, a post-migration scripts is run few minutes afterwards, you have to wait before using Garradin.

Though my tests were not successful yet, I got an error with the session not owned correctly.

I had to run this command manually:

sudo find /var/lib/php/sessions/ -user garradin -delete

I attempt to reproduce on a dev environment and try the above fix.

fflorent commented 1 year ago

Please check these PRs:

After that, I think we will be good to merge testing into master :)

rodinux commented 1 year ago

Would you like to

Please check these PRs:

* [Remove sessions after migration #8](https://github.com/YunoHost-Apps/paheko_ynh/pull/8)

* [Add instructions for migration in DISCLAIMER #7](https://github.com/YunoHost-Apps/paheko_ynh/pull/7)

After that, I think we will be good to merge testing into master :)

Did I wait a review ? I can merge without waiting requirements, but it is not very clean...

fflorent commented 1 year ago

@rodinux Hmm, at least wait for the result of the CI, indeed: https://ci-apps-dev.yunohost.org/ci/job/5559

And yes, maybe a review from another person could be worth if you think so

rodinux commented 1 year ago

@rodinux Hmm, at least wait for the result of the CI, indeed: https://ci-apps-dev.yunohost.org/ci/job/5559

And yes, maybe a review from another person could be worth if you think so

well, I am quiet with the results, but "Que va piano, va sano..." or "ça ne sert à rien de courrir..." Thanks a lot for your work.

fflorent commented 1 year ago

!testme

yunohost-bot commented 1 year ago

:sunflower: Test Badge

yunohost-bot commented 1 year ago

Meow :cat2: Test Badge

rodinux commented 1 year ago

!testme

yunohost-bot commented 1 year ago

:sunflower: Test Badge

yunohost-bot commented 1 year ago

Meow :cat2: Test Badge

fflorent commented 1 year ago

!testme

Errors are due to CI unstability:

32762 SUCCESS Restoration completed

 > Validating that the app paheko can/can't be accessed with its URL...

Error: Failed to begin transaction: context deadline exceeded

 > Restore on a fresh YunoHost system...

134  ERROR Unknown local backup archive named 'Backup_test'
(Reusing existing snapshot snap_subdirinstall)
yunohost-bot commented 1 year ago

:carousel_horse: Test Badge

fflorent commented 1 year ago

@rodinux The CI seems to say eveything is fine.

The remaining problem is related to the app not being flagged as working. I created this PR https://github.com/YunoHost/apps/pull/1632, which will be merged once the testing branch will be merged.

rodinux commented 1 year ago

Ok, It is done... We can can push the PR in master ?

rodinux commented 1 year ago

!testme

yunohost-bot commented 1 year ago

Fingers crossed! Test Badge

fflorent commented 1 year ago

I mean:

So from my point of view, we can merge now (unless you want another person to review the code). Anyway, we don't need another CI job run.