nginx-ui icon indicating copy to clipboard operation
nginx-ui copied to clipboard

beta.38 - nginx-ui wont start anymore

Open jiriteach opened this issue 1 year ago • 7 comments

Upgraded to beta.38 and the update hung. Checked the service and it was stopped. Trying to restart - just errors.

How do I restart? I tried re-installing and no luck either.

root@moober:/home/administrator# systemctl status nginx-ui
× nginx-ui.service - Yet another WebUI for Nginx
     Loaded: loaded (/etc/systemd/system/nginx-ui.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Mon 2024-10-28 23:29:38 NZDT; 3min 7s ago
   Duration: 408ms
       Docs: https://github.com/0xJacky/nginx-ui
    Process: 51766 ExecStart=/usr/local/bin/nginx-ui -config /usr/local/etc/nginx-ui/app.ini (code=exited, status=1/FAILURE)
   Main PID: 51766 (code=exited, status=1/FAILURE)
        CPU: 516ms

Here is the log from /var/log/syslog

2024-10-28T23:29:37.601282+13:00 moober systemd[1]: Started nginx-ui.service - Yet another WebUI for Nginx.
2024-10-28T23:29:38.003156+13:00 moober nginx-ui[51777]: #015
2024-10-28T23:29:38.003233+13:00 moober nginx-ui[51777]: 2024/10/28 23:29:38 #033[31;1m/home/runner/go/pkg/mod/github.com/uozi-tech/[email protected]/model/model.go:73 #033[35;1mUNIQUE constraint failed: sites.path
2024-10-28T23:29:38.003253+13:00 moober nginx-ui[51777]: #033[0m#033[33m[0.269ms] #033[34;1m[rows:0]#033[0m CREATE UNIQUE INDEX `idx_sites_path` ON `sites`(`path`)
2024-10-28T23:29:38.003289+13:00 moober nginx-ui[51777]: 2024-10-28 23:29:38#011FATAL#011model/model.go:76#011UNIQUE constraint failed: sites.path
2024-10-28T23:29:38.009467+13:00 moober systemd[1]: nginx-ui.service: Main process exited, code=exited, status=1/FAILURE
2024-10-28T23:29:38.009556+13:00 moober systemd[1]: nginx-ui.service: Failed with result 'exit-code'.

Looks like the error -

2024-10-28T23:29:38.003289+13:00 moober nginx-ui[51777]: 2024-10-28 23:29:38#011FATAL#011model/model.go:76#011UNIQUE constraint failed: sites.path

jiriteach avatar Oct 28 '24 10:10 jiriteach

Hi @jiriteach, If you have an SQLite editor, open the database.db under /usr/local/etc/nginx-ui, clear the sites table, and restart the nginx-ui. Normally, this issue should not happend.

0xJacky avatar Oct 28 '24 10:10 0xJacky

Perfect - thanks. Looks like its worked. Will run some tests.

jiriteach avatar Oct 28 '24 11:10 jiriteach

Re-opened this as it is a bug. The fix you mentioned above works and my main instance is working fine after clearing the sites table.

Trying on my backup instance going from beta.36 > beta.38. Stuck on ~ 80%. Performing core upgrade.

Screenshot 2024-10-29 at 00 18 10

systemctl status nginx-ui and its failed with the same errors as I posted above.

Its an almost replica of my main instance. Looks like I will have to clear the sites table on this one as well but I might just revert to a previous snapshot and can re-test when the bug is fixed.

jiriteach avatar Oct 28 '24 11:10 jiriteach

Yes, I added a unique constraint in https://github.com/0xJacky/nginx-ui/blob/bb02d7be77ba4c8131592b86ff99b4635f3178d2/model/site.go#L5 since beta.37.

If the sites table has more than one row with the same path, the db migration will fail, so you have to clear the table manaully.

0xJacky avatar Oct 28 '24 11:10 0xJacky

This problem may be caused by the soft delete introduced in the previous version, I'm sorry about that.

0xJacky avatar Oct 28 '24 11:10 0xJacky

No worries - is there any issue with clearing the sites table? Does it have any affect? I see all my sites look fine so clearing it didnt break anything?

jiriteach avatar Oct 28 '24 11:10 jiriteach

No worries - is there any issue with clearing the sites table? Does it have any affect? I see all my sites look fine so clearing it didnt break anything?

No side effects if the database is created in previous versions.

If you clear the database since beta.37, you will lose the category and the sync nodes settings of the site.

0xJacky avatar Oct 28 '24 11:10 0xJacky