24 Commits

Author SHA1 Message Date
Hintay f6992d8789 fix(docker): upgrade persisted bundled nginx-ui.conf safely (#1696)
* test(self_check): add fixed-default bundled nginx-ui.conf fixture

* test(self_check): add unfixed-default bundled nginx-ui.conf fixture

* test(self_check): add customized and partial-fix fixtures

* feat(self_check): add error codes for bundled nginx-ui.conf upgrade

* feat(self_check): add CheckBundledNginxUIConf

* feat(self_check): add idempotent applyBundledConfPatch

* feat(self_check): add transactional patch-on-disk with backup restore

* feat(self_check): wire FixBundledNginxUIConf with verify+reload

* feat(self_check): register bundled nginx-ui.conf WS-fix task

* test(docker): add init-config bats fixtures

* feat(docker): hash-whitelist sync for bundled nginx-ui.conf

* feat(docker): seed nginx-ui.conf known-hashes list

* chore(docker): add maintainer script for nginx-ui.conf hash list

* ci(docker): add bats + hash-consistency workflow for init-config.sh

* feat(docker): ship nginx-ui.conf known-hashes inside the image

* feat(self-check): banner button shows Fix when all failures are fixable

* docs: add docker websocket fix guide (en)

* docs: add docker websocket fix guide (zh_CN, zh_TW)

* docs: link docker-websocket-fix page in all locale sidebars

* docs(readme): link docker websocket fix guide

* docs(readme): link docker websocket fix guide (translations)

* fix(self_check): WS-fix check independent of NGINX_UI_IGNORE_DOCKER_SOCKET

* fix(docker): respect bundled nginx host mode

Keep bundled nginx-ui.conf self-checks aligned with Docker host mode and prevent config sync failures from blocking startup.

* fix(docker): tighten bundled conf review fixes

Co-authored-by: Jacky <me@jackyu.cn>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Jacky <me@jackyu.cn>
2026-05-24 09:48:19 +08:00
Jacky 72932f4a6c Nginx duplicate includes (#1550)
* fix: prevent duplicate include directives in nginx.conf

The FixNginxConfIncludeSites, FixNginxConfIncludeStreams, and
FixNginxConfIncludeConfD functions now check if the include directive
already exists before adding a new one. This prevents duplicate include
directives that could cause nginx to load configurations twice, leading
to errors like 'duplicate upstream' in stream configurations.

Fixes the issue where stream and http includes were being added
multiple times to nginx.conf:
- include /etc/nginx/sites-enabled/*;
- include /etc/nginx/streams-enabled/*;
- include /etc/nginx/conf.d/*.conf;

Added test TestFixNginxConfNoDuplicateIncludes to verify the fix.

Co-authored-by: Jacky <me@jackyu.cn>

* fix: align Fix function patterns with Check functions and defer backup creation

- Change Fix functions to use same glob patterns as Check functions:
  - 'sites-enabled/*' instead of 'sites-enabled'
  - 'streams-enabled/*' instead of 'streams-enabled'
  - 'conf.d/*' instead of 'conf.d'
- Move backup file creation after the duplicate check to avoid
  creating unnecessary backup files when no changes are needed

This fixes two issues:
1. Fix functions would incorrectly skip adding includes when a
   non-glob include existed (e.g., conf.d/default.conf)
2. Backup files were created even when early-returning due to
   duplicate detection

* Fix: Add backup creation for fallback paths in nginx.conf fix functions

The backup creation was moved inside the block-found branch, but the fallback
paths (when no http/stream block exists) still write to the file without
creating a backup first. This fix adds backup creation before each fallback
write operation to restore the original behavior where all code paths that
modify the file are protected by a backup.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-02-08 20:02:10 +08:00
0xJacky 5b47ccf639 feat(geolite): add GeoLite2 database checks and download functionality in self-check tasks 2025-10-04 15:47:40 +00:00
0xJacky 29ff77a87f fix: websocket readPump context handling 2025-09-06 19:14:11 +08:00
0xJacky 261c76686e refactor: rename env to node, env group to namespace 2025-08-13 10:50:37 +08:00
0xJacky 30db673856 feat(self_check): add checks and fixes for conf.d directory existence 2025-08-06 11:06:12 +08:00
Jacky 34ef1de236 fix(nginx): panic if sbin path is empty #1178 2025-06-28 12:32:13 +08:00
Jacky f19d6c0241 chore: update translations 2025-06-02 09:29:29 +08:00
Jacky ab97f94356 fix: unify symlink handling for site and stream on posix and win 2025-05-13 16:26:25 +08:00
Jacky 909d63bdb1 fix: unify symlink handling for site and stream on posix and win 2025-05-13 08:00:13 +00:00
Jacky 5da4136fcd fix(self-check): supports Windows #1046 2025-05-13 12:10:33 +08:00
Jacky adf6f80061 feat(modules): retrieve nginx modules status 2025-05-09 18:35:00 +08:00
Jacky 5b0cbf98e1 feat: add env for ignore docker socket check #1024 2025-05-09 16:18:00 +08:00
Jacky 202ac03537 feat(self-check): check stream if stream loaded #1028 2025-05-09 08:52:47 +08:00
Jacky d772dcfb95 chore: update deps 2025-05-07 09:42:08 +08:00
Jacky 56ffade4e2 fix(self_check): remove redundant file existence check in CheckPIDPath function 2025-05-07 08:03:26 +08:00
Jacky 1c282a57ad fix(self-check): fail to fix 2025-05-03 07:56:10 +08:00
Jacky 63824d5724 refactor: self check 2025-04-27 15:43:18 +08:00
Jacky e8f1321e0c enhance: translations 2025-04-24 22:47:27 +08:00
Jacky 7dfb6e86e6 feat(self-check): add Docker socket existence check 2025-04-22 14:14:23 +00:00
Jacky 84bfc90077 feat: add check and fix functions for Nginx conf.d directory inclusion 2025-04-11 08:38:56 +00:00
Jacky 650196d06a enhance(wip): error handle 2025-01-24 16:41:35 +08:00
Jacky 01ffa362af chore: update deps 2025-01-23 10:37:42 +08:00
Jacky ded74bbe0a feat(wip): self check 2025-01-22 16:21:33 +08:00