YunoHost-Apps / garradin_ynh

Logiciel libre de gestion associative pour YunoHost
https://garradin.eu/
GNU General Public License v3.0
7 stars 8 forks source link

Version1 #32

Closed BenoitCier closed 3 years ago

BenoitCier commented 3 years ago

Problem

Solution

PR Status

rodinux commented 3 years ago

Ok, is a good idea to update the version, unfortunately there is a trouble for me trying your code. on a local machine, I have try update garradin with success, but when I try connecting to admin page, I am redirected to SSO page. It seems always a problem with nginx.conf... or perhaps the php.fpm.conf... So first, we need resolve this mismatch...

bohwaz commented 3 years ago

Unfortunately this won't work, old release are not left on the server as it's causing people to email me because they installed an old version. Please don't link to a fixed release, use the API to find out the latest version available: https://github.com/YunoHost-Apps/garradin_ynh/issues/31

bohwaz commented 3 years ago

And I just released the 1.0.2, and I'm gonna release a new version every week or every two weeks, so it's not sustainable to have to update your package every time :+1:

You could do something that would only retain 1.0.* versions for example if you're worried about having a regression or something.

rodinux commented 3 years ago

I have similar problem https://github.com/YunoHost-Apps/garradin_ynh/pull/32#issuecomment-755444607 with last version. First we need to understand what's wrong with nginx.conf...

BenoitCier commented 3 years ago

I have reproduce the problem, it's only with subpath, i'm readind nginx documentation about rwrite rules...

BenoitCier commented 3 years ago

@bohwaz I'm not sure the problem was on nginx.conf/yunohost.
Version 0.9.8 form method="post" action="https://yunohost.local/test3/admin/install.php" Version 1.0.2 form method="post" action="/admin/install.php" Every other URL on the html file contains the subpath.

I have try to use the config.local.php to define WWW_URI whitout sucess. It's a possible to be a bug into garradin?

bohwaz commented 3 years ago

It works for me locally with a manual nginx setup, as I reported here: https://github.com/YunoHost-Apps/garradin_ynh/issues/24#issuecomment-699636299

So probably an issue between nginx and YunoHost, but correct me if I'm wrong.

bohwaz commented 3 years ago

Version 0.9.8 form method="post" action="https://yunohost.local/test3/admin/install.php" Version 1.0.2 form method="post" action="/admin/install.php"

Yes the URLs now don't include the host anymore. In config.local.php you can customize the root URI:

<?php

namespace Garradin;

const WWW_URI = '/test/garradin/www/';

You can find the working nginx setup documented at the end of this page: https://fossil.kd2.org/garradin/wiki?name=Installation+sous+Debian-Ubuntu

Multiple people have reported this setup working with nginx so far, with no need to change the config file (unless you're not using a dedicated vhost).

rodinux commented 3 years ago

Well, there is yet a script in the installation script to edit the config.local.php adding the const WWW_URI. So it should be rather an redirection error...

nginx.conf looks like this:

#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {

  alias __FINALPATH__/www/ ;

  if ($scheme = http) {
    rewrite ^ https://$server_name$request_uri? permanent;
  }

  index index.php /_route.php;
  try_files $uri $uri/ __PATH__/__PATH__/_route.php?$query_string;

  location ~ \.php$ {
        if (!-e $request_filename) {
            rewrite ^__PATH__/?(.*)$ __PATH__/_route.php?/$1 last;
            break;
        }
        fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param REMOTE_USER $remote_user;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $request_filename;
  }

  # Increase size limit
  client_max_body_size 2M;

  # Include SSOWAT user panel.
  include conf.d/yunohost_panel.conf.inc;
}h 

On local machine, I have this log on /var/log/nginx/error.log

Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:63 this line is just the end for includes VirtualHost, so I think the problem is with the nginx garradin.conf...

BenoitCier commented 3 years ago

I ask @bohwaz by mail few minute ago about something in the code of garradin. It's solve the problem for me. I wait for his answer.

BenoitCier commented 3 years ago

@bohwaz answer me so. It will be solve on 1.0.3 (next week?) it's not a yunohost problem. Just work whitout subpath for the moment.

Edit: https://github.com/BenoitCier/garradin_ynh/tree/version102/ : issue solved with Utils.php file (source app)

BenoitCier commented 3 years ago

Well, there is yet a script in the installation script to edit the config.local.php adding the const WWW_URI.

I think we can remove this script, I think garradin discover the URI automatically, I test

rodinux commented 3 years ago

@bohwaz answer me so. It will be solve on 1.0.3 (next week?) it's not a yunohost problem. Just work whitout subpath for the moment.

Edit: https://github.com/BenoitCier/garradin_ynh/tree/version102/ : issue solved with Utils.php file (source app)

Yes, this is a solution, I have test with success, thanks. I have added the line also in the update script to edit Utils.php...

rodinux commented 3 years ago

Well, there is yet a script in the installation script to edit the config.local.php adding the const WWW_URI.

I think we can remove this script, I think garradin discover the URI automatically, I test

I need already this lines after try if it match... it was also for the script change_url... Ok, after a test on local, I need to keep this line or there is a mismatch... But all is good for me with these changes ! Just is important adding this line cp -a ../conf/Utils.php /$final_path//include/lib/Garradin/Utils.php also in the script upgrade . I push the changes in the testing branch...