Need help getting something in a package (Fail2Ban errors)

I need some help getting a Go application working on YunoHost.

I’ve got some of it working but I keep getting Fail2Ban errors when trying to install it.
The app’s github is here: GitHub - ld3z/nonbiri_ynh: Nonbiri, is a self-hosted back-end and front-end for MangaDex packaged for YunoHost
Which is based off: GitHub - rs1703/nonbiri: Nonbiri is a self-hosted back-end and front-end for MangaDex.

Any help on this, I would be very appreciative, thank you!!!

First you need to create a testing branch and work on it. Then create a merge request and comment !testme so we will have some feedback from the CI. It could be usefull to help you !

So, I’ve created the testing branch and merged them, but it seems that the !testme is a YunoHost-Apps exclusive thing. How do I add it to that and get it working?

Yes indeed. You can transfer your repo to our organization so that our bot can access it. I’ll invite you to the org.

Thank you! :pray:t2:

So when installing the application I get the Fail2Ban error that I got on my Virtualbox testing. I have been checking the YunoHost app helper and I think I know how to fix it but I’m not sure.

Here’s the log from the YunoHost app bot:

75012 INFO [################+...] > Configuring Fail2Ban... [00h00m,01s]
92625 WARNING Job for fail2ban.service failed.
92625 WARNING See "systemctl status fail2ban.service" and "journalctl -xe" for details.
92692 WARNING [Error] May 04 14:53:32 systemd[1]: Starting Fail2Ban Service...
92693 WARNING May 04 14:53:32 systemd[1]: Started Fail2Ban Service.
92693 WARNING May 04 14:53:33 fail2ban-server[236]: Server ready
92694 WARNING May 04 14:53:34 systemd[1]: Reloading Fail2Ban Service.
92694 WARNING May 04 14:53:34 fail2ban-client[623]: OK
92694 WARNING May 04 14:53:34 systemd[1]: Reloaded Fail2Ban Service.
92695 WARNING May 04 14:54:46 systemd[1]: /lib/systemd/system/fail2ban.service:12: PIDFile= references path below legacy directory /var/run/, updating /var/run/fail2ban/fail2ban.pid → /run/fail2ban/fail2ban.pid; please update the unit file accordingly.
92695 WARNING May 04 14:54:46 systemd[1]: /lib/systemd/system/fail2ban.service:12: PIDFile= references path below legacy directory /var/run/, updating /var/run/fail2ban/fail2ban.pid → /run/fail2ban/fail2ban.pid; please update the unit file accordingly.
92696 WARNING May 04 14:54:58 systemd[1]: Reloading Fail2Ban Service.
92696 WARNING May 04 14:55:12 fail2ban-client[9867]:  NOK: ("No failure-id group in 'Regex to match into the log for a failed login'",)
92696 WARNING May 04 14:55:12 fail2ban-client[9867]: No failure-id group in 'Regex to match into the log for a failed login'
92697 WARNING May 04 14:55:12 systemd[1]: fail2ban.service: Control process exited, code=exited, status=255/EXCEPTION
92697 WARNING May 04 14:55:12 systemd[1]: Reload failed for Fail2Ban Service.
94289 ERROR Unable to install nonbiri: An error occurred inside the app installation script
94290 INFO The operation 'Install the 'nonbiri' app' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20220504-145341-app_install-nonbiri' to get help

You may just comment it. I’m not quite sure about fail2ban config in the scripts. I didn’t read the fail2ban section in the packaging docs :roll_eyes:. OK I’ll do it :sweat_smile:

Edit : here are the docs
https://yunohost.org/en/packaging_apps_helpers#fail2ban

Alright, so I tried it and it seems that it isn’t a problem anymore but, now I get nginx errors.

Running: yunohost app install --force /app_folder -a "domain=sub.domain.tld&path=/&is_public=1&language=fr&admin=package_checker&password=1Strong-Password&port=666&"
1825 INFO Installing nonbiri...
2260 INFO [....................] > Validating installation parameters... [00h00m,00s]
3232 INFO [+...................] > Storing installation settings... [00h00m,01s]
4360 INFO [#+..................] > Finding an available port... [00h00m,01s]
4862 INFO [##+.................] > Installing dependencies... [00h00m,01s]
50592 INFO [###+................] > Configuring system user... [00h00m,45s]
51158 INFO [####+...............] > Creating a MySQL database... [00h00m,01s]
52050 INFO [#####+..............] > Setting up source files... [00h00m,01s]
53849 INFO [######+.............] > Configuring NGINX web server... [00h00m,02s]
56297 INFO [#######+............] > Configuring PHP-FPM... [00h00m,02s]
59639 INFO [########+...........] > Creating a data directory... [00h00m,03s]
60118 INFO [#########+..........] > Adding a configuration file... [00h00m,01s]
62245 INFO [##########+.........] > Configuring a systemd service... [00h00m,02s]
64917 INFO [###########+........] > Configuring SSOwat... [00h00m,03s]
66029 INFO [############+.......] > Finalizing installation... [00h00m,01s]
70355 INFO [#############+......] > Configuring log rotation... [00h00m,04s]
70662 INFO [##############+.....] > Integrating service in YunoHost... [00h00m,00s]
71378 INFO [###############+....] > Starting a systemd service... [00h00m,01s]
71944 INFO [################+...] > Configuring Fail2Ban... [00h00m,01s]
72175 INFO [#################+..] > Configuring permissions... [00h00m,00s]
75942 INFO [##################+.] > Reloading NGINX web server... [00h00m,04s]
76447 INFO [####################] > Installation of nonbiri completed [00h00m,00s]
78647 SUCCESS Installation completed

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

Error: The HTTP code shows an error.
Warning: Test URL: sub.domain.tld
Real URL: https://sub.domain.tld/

HTTP code: 403
Page title: 
Page extract:
                                403 Forbidden
     __________________________________________________________________

                                    nginx
Error: The HTTP code shows an error.
Warning: Test URL: sub.domain.tld/
Real URL: https://sub.domain.tld/

HTTP code: 403
Page title: 
Page extract:
                                403 Forbidden
     __________________________________________________________________

                                    nginx

--- FAIL ---

Working time for this test: 2 minutes, 29 seconds (03:25:57)

 ============================================
  [Test 3/9] Installation in a sub path
 ============================================

Running: yunohost app install --force /app_folder -a "domain=sub.domain.tld&path=/path&is_public=1&language=fr&admin=package_checker&password=1Strong-Password&port=666&"
2010 INFO Installing nonbiri...
2534 INFO [....................] > Validating installation parameters... [00h00m,00s]
3602 INFO [+...................] > Storing installation settings... [00h00m,01s]
4659 INFO [#+..................] > Finding an available port... [00h00m,01s]
5263 INFO [##+.................] > Installing dependencies... [00h00m,01s]
50284 INFO [###+................] > Configuring system user... [00h00m,45s]
50804 INFO [####+...............] > Creating a MySQL database... [00h00m,00s]
51773 INFO [#####+..............] > Setting up source files... [00h00m,01s]
53364 INFO [######+.............] > Configuring NGINX web server... [00h00m,02s]
55751 INFO [#######+............] > Configuring PHP-FPM... [00h00m,02s]
59091 INFO [########+...........] > Creating a data directory... [00h00m,03s]
59638 INFO [#########+..........] > Adding a configuration file... [00h00m,01s]
61773 INFO [##########+.........] > Configuring a systemd service... [00h00m,02s]
64380 INFO [###########+........] > Configuring SSOwat... [00h00m,03s]
65659 INFO [############+.......] > Finalizing installation... [00h00m,01s]
69986 INFO [#############+......] > Configuring log rotation... [00h00m,04s]
70225 INFO [##############+.....] > Integrating service in YunoHost... [00h00m,01s]
70838 INFO [###############+....] > Starting a systemd service... [00h00m,00s]
71367 INFO [################+...] > Configuring Fail2Ban... [00h00m,01s]
71612 INFO [#################+..] > Configuring permissions... [00h00m,00s]
75071 INFO [##################+.] > Reloading NGINX web server... [00h00m,03s]
75577 INFO [####################] > Installation of nonbiri completed [00h00m,01s]
77773 SUCCESS Installation completed

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

Error: The HTTP code shows an error.
Warning: Test URL: sub.domain.tld/path
Real URL: https://sub.domain.tld/path/

HTTP code: 403
Page title: 
Page extract:
                                403 Forbidden
     __________________________________________________________________

                                    nginx
Error: The HTTP code shows an error.
Warning: Test URL: sub.domain.tld/path/
Real URL: https://sub.domain.tld/path/

HTTP code: 403
Page title: 
Page extract:
                                403 Forbidden
     __________________________________________________________________

                                    nginx

--- FAIL ---

In the install script remove the open port directive. This port doesn’t need to be open to the outside of the server.
In your nginx.conf add
proxy_pass http://127.0.0.1:42071

I advise you to install yunohost on a virtual machine for testing. Launching test on the ci takes time and it’s not convenient for starting to package. Sometimes it’s only a dot you forgot to type. Waiting hours to get this log is :upside_down_face:

Ok! So I added the proxy_pass http://127.0.0.1:42071 to the nginx.conf and edited the install script, the nginx errors are gone now (yay!) but, I can’t seem to access it via the url or ip address. Do I possibly have to add a command to run the application file that gets installed?

This branch should be a good starting point (although it doesn’t work yet): GitHub - YunoHost-Apps/nonbiri_ynh at test
According to the logs, a config file seems to be needed, but I can’t find any mention of this upstream

error reading config file: While parsing config: unexpected end of JSON input
1 Like

Looks like it should be nonbiri.json: nonbiri/prefs.go at c0baeb843134dd731e9b47a6064cce1c935c9479 · rs1703/nonbiri (github.com)

Ok, thank you for fixing it, it seems to install with no problems and the web ui is accessible using the ip and port. I run a VM to test the package, and when I goto the browse section to actually read it, it gives a image that seems to be a placeholder when it can’t get the manga. I had this error when installing it just from the git itself without YunoHost, and it seems it can’t access the MangaDex’s api, but when I check the logs on YunoHost I see no problem. (I’m just glad the web ui works at this point…) thank you @ericg

I hopefully plan to go ask them (MangaDex) on their discord server about it, hopefully they can share some insight as well.