YunoHost-Apps / 13ft_ynh

13ft package for YunoHost
https://github.com/wasi-master/13ft
GNU Affero General Public License v3.0
8 stars 2 forks source link

Redirected to yunohost main page #2

Open lapineige opened 1 year ago

lapineige commented 1 year ago

When I enter any URL, I'm sent back to Yunohost main page (SSO). It's as if I was asking for the wrong webpage and then it redirects me… But it's a public app so it should not be blocking any subpage…

@wasi-master do you know what might be wrong in my Nginx config or so ?

emiliien commented 1 year ago

Same probleme here.

wasi-master commented 1 year ago

I don't really know why it's happening πŸ€”

lapineige commented 1 year ago

How can I help you to debug this ?

dotInTheWind commented 1 year ago

Hi,

Same problem here.

In the admin panel, the service "13ft" is down. Here is the error message:

janv. 26 12:43:06 systemd[1]: Started 13ft launcher service.
janv. 26 12:43:06 systemd[446]: 13ft.service: Failed to set up standard output: No such file or directory
janv. 26 12:43:06 systemd[446]: 13ft.service: Failed at step STDOUT spawning /var/www/13ft/venv/bin/python3: No such file or directory
janv. 26 12:43:08 systemd[1]: 13ft.service: Main process exited, code=exited, status=209/STDOUT
janv. 26 12:43:08 systemd[1]: 13ft.service: Failed with result 'exit-code'.
janv. 26 12:58:49 systemd[1]: Started 13ft launcher service.
janv. 26 12:58:49 systemd[11060]: 13ft.service: Failed to set up standard output: No such file or directory
janv. 26 12:58:49 systemd[11060]: 13ft.service: Failed at step STDOUT spawning /var/www/13ft/venv/bin/python3: No such file or directory
janv. 26 12:58:49 systemd[1]: 13ft.service: Main process exited, code=exited, status=209/STDOUT
janv. 26 12:58:49 systemd[1]: 13ft.service: Failed with result 'exit-code'.
lapineige commented 1 year ago

Failed at step STDOUT spawning /var/www/13ft/venv/bin/python3: No such file or directory

Uh wait what ? It should be there πŸ€”

What's the result of /var/www/13ft/venv/bin/python3 /var/www/13ft/index.py ?

Can you try to install/upgrade to this branch ? https://github.com/YunoHost-Apps/13ft_ynh/pull/6

dotInTheWind commented 1 year ago

What's the result of /var/www/13ft/venv/bin/python3 /var/www/13ft/index.py ?

Traceback (most recent call last):
  File "/var/www/13ft/index.py", line 2, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

Can you try to install/upgrade to this branch ? #6

Sorry, I'm not a github expert. What URL should I use to update from this branch?

Edit: upgrading from https://github.com/YunoHost-Apps/13ft_ynh/tree/testing makes the error message disappear. But doesn't solve the first problem as you noticed.

lapineige commented 1 year ago

Ok, so we have the same issue. The branch you tested, and that I just merged (normal upgrade will do now :).

The service is now working, but I don't know what the issue…

wasi-master commented 1 year ago

The 13ft code is very simple, I do not see any reasons that this should happen. You could try adding some print statements in between the code (in the file used for yunohost) and then see what happens.

https://github.com/wasi-master/13ft/blob/main/index.py

emiliien commented 1 year ago

i'have this logs

-- Journal begins at Sun 2022-12-04 21:17:01 CET, ends at Sun 2023-01-29 22:48:31 CET. -- janv. 24 22:55:27 systemd[1]: Started 13ft launcher service. janv. 24 22:55:27 systemd[157494]: 13ft.service: Failed to set up standard output: No such file or directory janv. 24 22:55:27 systemd[157494]: 13ft.service: Failed at step STDOUT spawning /var/www/13ft/venv/bin/python3: No such file or directory janv. 24 22:55:27 systemd[1]: 13ft.service: Main process exited, code=exited, status=209/STDOUT janv. 24 22:55:27 systemd[1]: 13ft.service: Failed with result 'exit-code'. -- Boot 9f5953ab12ce41568375fe76aaa64bc7 -- janv. 29 22:45:16 systemd[1]: Started 13ft launcher service. janv. 29 22:45:16 systemd[665195]: 13ft.service: Failed to set up standard output: No such file or directory janv. 29 22:45:16 systemd[665195]: 13ft.service: Failed at step STDOUT spawning /var/www/13ft/venv/bin/python3: No such file or directory janv. 29 22:45:16 systemd[1]: 13ft.service: Main process exited, code=exited, status=209/STDOUT janv. 29 22:45:16 systemd[1]: 13ft.service: Failed with result 'exit-code'.

lapineige commented 1 year ago

Even with the latest version ?

karolfilarski commented 1 year ago

i'have this logs

-- Journal begins at Sun 2022-12-04 21:17:01 CET, ends at Sun 2023-01-29 22:48:31 CET. --
janv. 24 22:55:27 systemd[1]: Started 13ft launcher service. 
janv. 24 22:55:27 systemd [157494]: 13ft.service: Failed to set up standard output: No such file or directory
janv. 24 22:55:27 systemd [157494]: 13ft.service: Failed at step STDOUT spawning /var/www/13ft/venv/bin/python3: No such file or directory
janv. 24 22:55:27 systemd[1]: 13ft.service: Main process exited, code=exited, status=209/STDOUT
janv. 24 22:55:27 systemd[1]: 13ft.service: Failed with result 'exit-code'. -- Boot 9f5953ab12ce41568375fe76aaa64bc7 -- 
janv. 29 22:45:16 systemd [1]: Started 13ft launcher service.
janv. 29 22:45:16 systemd[665195]: 13ft.service: Failed to set up standard output: No such file or directory
janv. 29 22:45:16 systemd[665195]: 13ft.service: Failed at step STDOUT spawning /var/www/13ft/venv/bin/python3: No such file or directory 
janv. 29 22:45:16 systemd [1]: 13ft.service: Main process exited, code=exited, status=209/STDOUT
janv. 29 22:45:16 systemd[1]: 13ft.service: Failed with result 'exit-code'.`

Same here in main and testing branch

lapineige commented 1 year ago

Can you check if /var/www/13ft/venv/bin/python3 exists ?

And if yes, can you run /var/www/13ft/venv/bin/python3 /var/www/13ft/index.py and share the result here ?

irrweg commented 1 year ago

Can you check if /var/www/13ft/venv/bin/python3 exists ?

And if yes, can you run /var/www/13ft/venv/bin/python3 /var/www/13ft/index.py and share the result here ?

xxx@xxx:~$ sudo /var/www/13ft/venv/bin/python3 /var/www/13ft/index.py
 * Serving Flask app 'index'
 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 135-782-041
xxx@xxx:~$ sudo tree /var/www/13ft/venv/bin/
/var/www/13ft/venv/bin/
β”œβ”€β”€ activate
β”œβ”€β”€ activate.csh
β”œβ”€β”€ activate.fish
β”œβ”€β”€ Activate.ps1
β”œβ”€β”€ easy_install
β”œβ”€β”€ easy_install-3.9
β”œβ”€β”€ flask
β”œβ”€β”€ normalizer
β”œβ”€β”€ pip
β”œβ”€β”€ pip3
β”œβ”€β”€ pip3.9
β”œβ”€β”€ python -> python3
β”œβ”€β”€ python3 -> /usr/bin/python3
└── python3.9 -> python3
lapineige commented 1 year ago

I don't understand the issue, the file is here, the service can start, but it failed πŸ€”

irrweg commented 1 year ago

maybe it helps using files from python instead linking to it in the folder.

lapineige commented 1 year ago

I don't understand your point. You mean file from the system python installation ? We use a virtual environment to avoid messing up with other packages.

BrunoSpy commented 1 year ago

Hello,

I managed to successfully launch the service by creating /var/log/13ft/ which didn't existed

systemctl status 13ft ● 13ft.service - 13ft launcher service Loaded: loaded (/etc/systemd/system/13ft.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2023-05-23 12:15:42 CEST; 41s ago Main PID: 62963 (python3) Tasks: 3 (limit: 8691) Memory: 41.6M CPU: 523ms CGroup: /system.slice/13ft.service β”œβ”€62963 /var/www/13ft/venv/bin/python3 /var/www/13ft/index.py └─62965 /var/www/13ft/venv/bin/python3 /var/www/13ft/index.py

Now the service is ok but still every request is redirected to the SSO.

Nothing in the logs :

/var/log/13ft# tail -f 13ft.log

dgraziotin commented 1 year ago

Hi, sorry, not hugely familiar with Yunohost.

But this file: https://github.com/YunoHost-Apps/13ft_ynh/blob/master/conf/nginx.conf

Results into /etc/nginx/conf.d/yourdomain.conf.d/13ft.conf

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

  # Path to source
  alias /var/www/13ft/;

  # Include SSOWAT user panel.
  include conf.d/yunohost_panel.conf.inc;
}
ls /var/www/13ft
index.html  index.py  LICENSE  portable.py  README.md  requirements.txt  screenshots  venv

Shouldn't there be a reverse proxy to http://127.0.0.1:5000 or something, instead?

dgraziotin commented 1 year ago

Yes, this quick edit:

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

  # Path to source
  #alias /var/www/13ft/;
  # static files
  proxy_pass http://localhost:5000;
  proxy_set_header Host $http_host;
  more_set_headers "X-Frame-Options: ALLOWALL";
  # Include SSOWAT user panel.
  include conf.d/yunohost_panel.conf.inc;
}

Makes it work again :-) it still requires @BrunoSpy part.

lapineige commented 1 year ago

Thank a lot !

lapineige commented 1 year ago

It fails :(

Service is running but the issue is still there.

lapineige commented 1 year ago

WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.

@wasi-master any idea ? :sweat_smile:

dgraziotin commented 1 year ago

It fails :(

Service is running but the issue is still there.

it’s working fine here. Please note that mine is a quick fix. It will work when serving at the root of a (sub)domain, but not in a sub-folder, for example.

lapineige commented 1 year ago

Oh that's the thing ! I use a subfolder. What should it be in that case ?

wasi-master commented 1 year ago

WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.

@wasi-master any idea ? πŸ˜…

@lapineige that means the app is online. I didn't use a production grade server because I thought people would not deploy it online and just self host. Now I guess I need to use one.

lapineige commented 1 year ago

I thought people would not deploy it online and just self host.

What do you mean ? Self-host on their personal computer and not in a separated server (even at home) ?

wasi-master commented 1 year ago

I thought people would not deploy it online and just self host.

What do you mean ? Self-host on their personal computer and not in a separated server (even at home) ?

I guess the warning doesn’t matter. The development server is not designed to be particularly efficient, stable, or secure. But if someone is using it at home. I guess they can just use the development server.

lapineige commented 11 months ago

I don't get what's the issue :

May 26 17:24:28 systemd[4514]: 13ft.service: Failed to set up standard output: No such file or directory
May 26 17:24:28 systemd[4514]: 13ft.service: Failed at step STDOUT spawning /var/www/13ft/venv/bin/python3: No such file or directory