[Aide/Help] Finalisation de l’évolution de l’app My_webapp / Finalizing the evolution of My_webapp

todo

Todo List / à faire :

  • Re-integrate PHP 7.4 (Y/N)?
  • theme source Yunohost Modern Like (Post #15)
Corrigé / Corrected ( thx )

Fix and update

Nettoyage / Cleaning

  • Duplication du code de génération de password dans install & update /
    Duplication of password generation code on install & update ( :folded_hands: @jarod5001)
  • Utilisation des ynh_add_config a la place de ynh_replace_string /
    Use of ynh_add_config instead of ynh_replace_string ( :folded_hands: @jarod5001)
  • Unifications des variables key=generated_password and key=password/
    Unification of the key=generated_password and key=password variables ( :folded_hands: @jarod5001)

French

Bonjour à tous,

Je travaille actuellement sur l’évolution de l’app My_webapp et j’ai déjà bien avancé sur la refonte. Le plus gros est fait :

  • Choix du mode d’installation (via CLI et via le panel d’admin).
  • Ajout de tests automatisés selon le mode choisi.
  • Suppression du support PHP 7.4 (deprecated).
  • Passage de la variable /site/.
  • Utilisation de PHP 8.4 par défaut.
  • SFTP activé par défaut.
  • Si aucun mot de passe SFTP n’est défini → génération aléatoire + affichage en post-install et dans les sources (html, php) + création d’un fichier texte d’informations générales à la racine.
  • Les scripts d’upgrade ont été mis à jour.
  • La documentation .md a également été revue.

Techniquement, l’installation fonctionne bien et tout s’exécute correctement.


Mon problème actuel

Le seul blocage majeur que je rencontre concerne la configuration Nginx.
J’ai tenté de générer les fichiers de conf de plusieurs façons, mais je n’arrive pas à obtenir un résultat correct.
Je suppose qu’il y a une subtilité propre à YunoHost ou à Nginx que je ne saisis pas (je viens plutôt du monde Apache :sweat_smile:).


Pour contribuer / examiner le code

Le dépôt de travail (non-fork, uniquement pour le développement) est disponible ici :

https://github.com/NemStudio18/my_webapp_ynh


Ma demande

Je sollicite donc l’aide de la communauté pour finaliser ce point et rendre l’app My_webapp plus moderne et pleinement fonctionnelle.
Toutes les contributions (explications, exemples de conf, bonnes pratiques spécifiques à YunoHost) seront les bienvenues. :folded_hands:

:heart: Merci d’avance ! Merci pour YunoHost :heart:


English

Hi everyone,

I’m currently working on updating My_webapp, and most of the work is already done:

  • Install mode selection (CLI + panel)
  • Automated tests for each mode
  • Dropped PHP 7.4 support
  • Variable /site/
  • Default PHP version set to 8.4
  • SFTP enabled by default
  • If no SFTP password is set → generate random one, display in post-install, add in sources (html, php) and create an installation info file at root
  • Upgrade scripts updated
  • Documentation .md updated

Installation works fine technically.


The current issue

My only real blocker is the Nginx configuration.
I’ve tried several approaches, but can’t get it right.
I probably miss some Yunohost-specific or Nginx-specific detail (I come from an Apache background :sweat_smile:).


Code

Work repo (not a fork, just for dev):

https://github.com/NemStudio18/my_webapp_ynh


Request

I’d love some help from the community to fix the Nginx part and make My_webapp more modern and fully functional.
Any tips, examples or best practices are welcome :folded_hands:

:heart: Thanks in advance! Thank for YunoHost :heart:

5 Likes

Voir issue et PR:

Je prend note la correction du script remove pour éviter de faire une suppression de PHP si my_webapp a été installé sans PHP.

To do list

J’en profite , si vous souhaitez d’autres améliorations proposez ici. Il faut que ce soit simple a mettre en place et n’alourdisse pas l’App.

Hi,

Thank you for this. I am currently using My_webapp for hosting my pictures with MinigalNano GitHub - sebsauvage/MinigalNano

I am using PHP 7.4 because, (if I remember well) with the other PHP versions I had problems with MinigalNano…

1 Like

Hi,

Finally a reply :D!!!

I was starting to think no one would show up, even though this app still feels like a must-have :wink:

I’ll re-integrate PHP 7.4 for now, but sooner or later, we should really think about moving apps to PHP 8.x instead of running versions that are on their way out.

Thanks a lot for your precious feedback :slight_smile:

1 Like

Thanks!

  1. I am not sure to understand why having duplicate :

and

  1. Why key=generated_password and key=password

and

  1. And why using ynh_replace_string

When you already have ynh_add_config

  1. This useless since these vars are mandatory

I didn’t go through other scripts than install.

You may ask the dev to upgrade the app to a more recent php version. It’s a bad idea to stick to a a tech that reached EOL ( PHP 7.4 reached EOL and no longer received security updates as of November 28, 2022.)

3 Likes

I will :slight_smile:

1 Like

By the way, I checked the repo you mentioned — it looks kinda dead :sweat_smile: (last update was 9 years ago, and they’re still talking about PHP 5.x, not even 7…). Wouldn’t there be a better alternative to migrate your app to? :thinking:

1 Like

Hey,

Sorry if I’m a bit messy with the replies :sweat_smile:

Everything you mentioned is actually just leftover from my tests — it’s my first time working with a YunoHost package, and I admit I jumped into a pretty big one ^^’.

I tried several approaches before getting an installation to pass without any blocking errors, which already felt like a huge achievement :grinning_face_with_smiling_eyes:.

I ran into a lot of issues with variable declarations, replacing some values, etc., and those leftover bits were just temporary solutions that helped me along the way, but I forgot to clean them up afterwards.

I’ve now pushed a fix that addresses everything you pointed out.

So, should I re-integrate PHP 7.4, or keep it as-is for a bit longer?

Thanks a lot for reading through this — it really helps me understand and get a better handle on YunoHost packaging!

2 Likes

Hi,

Thanks for your help on this package. :heart_eyes:

Important : Create a PR

In general, to get help and get review, it’s more easy if you do a Pull Request onto the original repo.

Here we can’t add comments and suggest change easily (the way @jarod5001 did is ok but it’s more energy to do it…).

(If you need help to create a PR, i guess we could make an audio / visio with share screen to help you on this…)

About install mode

:red_question_mark: We need more info on use case. We think it’s related to nginx conf and we agreed with you that nginx conf should be more adaptative to be able to host several kinds of apps.
May be a way to customize the nginx conf ?

About PHP version

:white_check_mark: Set the default PHP version to 8.4 seems a good idea

:wrench: About 7.4, I guess we could try to trigger a warning in YunoHost diagnosis if an app use a php version which reached EOL… However, i think we should keep php7.4, some people could run code on local network without so many risk…

Variable /site/

:white_check_mark: Good idea

Default PHP version set to 8.4

:white_check_mark: Good idea

SFTP by default

:white_check_mark: Good idea

New presentation page

:wrench: We agree with you that the page was too much simple (only html). However, the page we tried on your repo are not finished and we think this page could use a yunohost theme instead of a totally new style.
The ergonomy first, so the important info should be reachable quickly too.
May be we should make a mockup of this ?
May be you need help on this ?

Ideas from the contributors meeting

  • May be we should split this package in 2. One for static web app, and one for PHP/DB app ?
  • We have discuss the way this kind of app is displayed in Web administration, cause my_webapp_ynh, redirect_ynh and custom_backup_ynh are very special.
  • A killer feature could be to bind the install_dir to a git repo. Like github.io and gitlab.io

I hope my message help you and don’t discourage you. I regularly push contributions which need to be redone partially or totally after peer reviewed…

4 Likes

I haven’t found a similar app. It’s a perfect app for my pictures, simple to use and nice.

Did you try Lychee? It’s evolving nicely

1 Like

@ljf
Hi, and thanks a lot for taking the time to reply (I guess my post came at a bad time with the release of the latest YunoHost version ^^).

Actually, there’s already a PR, but I think it would be better to close it so I can make a clean one linked to the repo I mentioned in my first message.

Big thanks to @jarod5001 as well for taking the time to give such detailed feedback!

To be honest, I got myself a bit lost between my different local repos and had trouble pushing to GitHub.
The only workaround I found was to create a non-fork repo and work from there (it actually made testing easier through both the web panel and CLI).
Back then I didn’t know how to properly test a branch (I’ve since found a better way: syncing a local repo on my YunoHost instance with the branch, so I can test changes on the fly).

I’ll spend some time today to clean things up. If you prefer to close the current PR on the official repo, feel free to do so.


The idea is to keep it working as it currently does: at installation, there are 3 modes. The first one, Static, is the original behavior of my_webapp.

For the other two modes, the main constraint is about redirect and rewrite rules:

  • Front (serves /www/index.php): all requests go through this front controller.
    For example, a route like mydomain.tld/admin/ shouldn’t try to list the directory or show its own index.php (since it might not exist), but should redirect everything to index.php, which handles routing.

Static files, however, should still be served if they exist (CSS files must remain accessible).

  • Public: exactly the same behavior, but serves /www/public/index.php.

For further customization, I think we can rely on the existing my_webapp.d/*.conf system.


Regarding the PHP version: I’ll re-add 7.4 support and display a warning before installation about its EOL status. If installed with 7.4, the message will also appear after installation and in the admin panel.


As for the new presentation page, I knew it wouldn’t make everyone happy.

I’m fine with creating a new mockup based on the YunoHost theme.


Wow, I’m really happy it was discussed during the meeting! :slight_smile:

  • Splitting into two apps → I’m not sure if it’s really necessary, since it’s mostly a matter of Nginx configuration.
  • For this point, I don’t really have an opinion yet.
  • Binding to a Git repo sounds amazing, but I have no idea how to achieve that… I think you guys have much more experience on this, so I’ll leave it to the dev team :wink:

On the contrary, it’s super helpful and really gives me the motivation to improve! My desire to contribute is even stronger now.

thx !

It’s different. I like the simplicity of MinigalNano :slight_smile:

Hi, I got mixed up with the “replies” – I’m not very familiar with Discourse, so I replied to your message under another response.

Just wanted to give you an update and ask for validation for something that would look more like this after installation:

(modified after being installed on my YunoHost instance)

I would not show the port, since it’s the same as the ssh port and we generally change it to make it harder for attackers, so why help them?
And about the sftp and db details, it would be better to send them by email to the admin.
Something that may be helpful is to add a basic file manager with authentication restricted to admins.

We discuss it with @orhtej2 and @Aleks, we think we should remove all credentials from this page and unnecessary info. Those info are already displayed in Webadmin doc (doc are templatable). This page was created before the admin documentation feature…

May be something very light, like :

This website is under maintenance.

Where can i find SFTP or database credentials ?

I completely agree with that. Even though it’s just a simple informative page, if we happen to forget to delete it after installation, it could become problematic (even though no password is provided there).

At most, it should either send an email to the person who installs the app, or, failing that, keep a txt file (as I currently do in the version) but protected by nginx or placed outside the /www root.

To be honest, I just reused the information that already existed in the original HTML. Passwords are never provided on the server side, but I completely agree with the principle!

I believe My_webdav exists, but I don’t know how it works or what it looks like.
Rather than making my_webapp heavier, I think we should update my_webdav so that we can choose the source we want before installation.
In my opinion, that would be the cleanest solution, and we should add a section in the README (ADMIN or INSTALL) explaining that webdav can be used and linked to the my_webapp folder.
What do you think? (This way, each app remains independent.)


I updated the index.php page after installation (only on my server, not yet on GitHub) in order to validate.

Same address as before.

test post install << In light mod
test post install dark << Also available in dark mod

That’s off topic, but you can try upgrading php version of this app following this guide

1 Like

Thank you, I will have a look at it.