[PR #3681] [CLOSED] Refactoring + geodat files auto update #5505

Closed
opened 2026-10-31 20:47:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/3681
Author: @mixa2130
Created: 1/18/2026
Status: ❌ Closed

Base: main ← Head: main


📝 Commits (10+)

  • 0f563dc Add .dockerignore
  • 4b9e34a Fixed errors in x-ui.sh
  • 3a2988c DRY: unified sh script for geodata update
  • e1058b1 Integrated unified sh scripts into docker build system + some cache updates
  • 1012636 Quick docker refactoring
  • 522a2f7 Merge branch 'feature/bash-scripts-update' into develop
  • 4b8275f Docker crom runner: cron works and restarts the main container, but shared volume still not in use
  • 67d4142 Used shared volume + system optimization
  • c4c5aee docker update
  • 11031da Code refactoring

📊 Changes

33 files changed (+2557 additions, -2223 deletions)

View changed files

➕ .dockerignore (+22 -0)
📝 .github/workflows/release.yml (+3 -2)
📝 .gitignore (+3 -0)
📝 DockerEntrypoint.sh (+6 -1)
➖ DockerInit.sh (+0 -40)
📝 Dockerfile (+42 -20)
➕ Dockerfile-cron-runner (+22 -0)
📝 README.md (+6 -6)
📝 docker-compose.yml (+43 -3)
➕ docker-cron-runner/cron-job-script.sh (+16 -0)
➕ docker-cron-runner/entrypoint.sh (+22 -0)
📝 docs/README.ar_EG.md (+2 -1)
📝 docs/README.es_ES.md (+2 -2)
📝 docs/README.fa_IR.md (+2 -2)
📝 docs/README.ru_RU.md (+2 -2)
📝 docs/README.zh_CN.md (+3 -2)
➕ docs/media/3x-ui-dark.png (+0 -0)
➕ docs/media/3x-ui-light.png (+0 -0)
➕ docs/media/default-yellow.png (+0 -0)
➕ docs/media/donation-button-black.svg (+1 -0)

...and 13 more files

📄 Description

What is the pull request?

Why is this needed?

We live in challenging times, as many governments attempt to restrict internet freedom and monitor users’ online activity. For example, in Russia, Roskomnadzor blocks or throttles around 20 services every day. Xray is a solid protocol, but it is not completely immune to detection. One of the most effective ways to protect a VPN server is to minimize outgoing traffic—something 3xui already does very well.

However, as mentioned earlier, the list of blocked resources changes extremely quickly, and manually updating geodat files through the panel has become quite inconvenient. This pull request addresses that issue by introducing automated updates.

What this PR includes:

  1. Cron container — downloads geodat files on a configurable schedule (via docker env), storing them in a shared volume.
  2. Docker proxy — allows the cron container to restart the main 3xui container so the new geodat files are applied automatically.
  3. Some additional refactoring that I believe will be useful.

P.S. The main 3xui container can run independently of geodata-cron and docker-proxy. If a user doesn’t need them, they can simply remove these containers.

What I refactored?

  • Split x-ui.sh into a set of Bash scripts located in the lib/ directory. This allowed me to reuse its functions in the main Dockerfile (which is why DockerInit.sh is no longer needed) and in Dockerfile-cron-runner.
  • Reduced Docker image size: 349.93 MB → 297.3 MB
  • Optimized Docker build time by ~1.5× on a VPS with 1 CPU core and 2 GB of RAM
  • Moved README translations from the root directory to docs/, making the root directory cleaner
  • Fixed several Bash linter issues

How I tested?

Local Docker tests on macOS, as well as testing on Ubuntu and Debian VPS instances with 1 CPU core and 2 GB of RAM.
An amd64 test release for manual installation is available at https://github.com/mixa2130/3x-ui/releases/tag/v0.0.1

Which part of the application is affected by the change?

  • Frontend
  • Backend

Type of Changes

  • Bug fix
  • New feature
  • Refactoring
  • Other

Screenshots

Screenshot 2026-01-18 at 22 39 08

What would I like to update in 3xui?

  • I would like to add support for custom geodat files.
  • I would like to have an official Docker image on Docker Hub to save time and VPS resources.
  • Built-in Nginx support / examples

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/3681 **Author:** [@mixa2130](https://github.com/mixa2130) **Created:** 1/18/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (10+) - [`0f563dc`](https://github.com/MHSanaei/3x-ui/commit/0f563dc0308801c31cd37389f99d8f4788e956f7) Add .dockerignore - [`4b9e34a`](https://github.com/MHSanaei/3x-ui/commit/4b9e34aea6e7ae7410b7e0ebe51c3b1a972bf0c7) Fixed errors in x-ui.sh - [`3a2988c`](https://github.com/MHSanaei/3x-ui/commit/3a2988c06812605fda074f240a284ee6c7202c8d) DRY: unified sh script for geodata update - [`e1058b1`](https://github.com/MHSanaei/3x-ui/commit/e1058b1eafc413b4a953bd6a5c34e0a39c8051d5) Integrated unified sh scripts into docker build system + some cache updates - [`1012636`](https://github.com/MHSanaei/3x-ui/commit/1012636d35f193732d0bb2fa38574cd24dfc0973) Quick docker refactoring - [`522a2f7`](https://github.com/MHSanaei/3x-ui/commit/522a2f73492a02393f87d20ceb6cf3cde73fcafc) Merge branch 'feature/bash-scripts-update' into develop - [`4b8275f`](https://github.com/MHSanaei/3x-ui/commit/4b8275f15f8c689c8ec8667a7fa268b57d3a61cc) Docker crom runner: cron works and restarts the main container, but shared volume still not in use - [`67d4142`](https://github.com/MHSanaei/3x-ui/commit/67d4142c3ad9ec3912efa1b60745c96d70c4480a) Used shared volume + system optimization - [`c4c5aee`](https://github.com/MHSanaei/3x-ui/commit/c4c5aee9acea0c7dec44c8653e5badd374de307a) docker update - [`11031da`](https://github.com/MHSanaei/3x-ui/commit/11031dad004a835eacc7cd0587336c7e8874354e) Code refactoring ### 📊 Changes **33 files changed** (+2557 additions, -2223 deletions) <details> <summary>View changed files</summary> ➕ `.dockerignore` (+22 -0) 📝 `.github/workflows/release.yml` (+3 -2) 📝 `.gitignore` (+3 -0) 📝 `DockerEntrypoint.sh` (+6 -1) ➖ `DockerInit.sh` (+0 -40) 📝 `Dockerfile` (+42 -20) ➕ `Dockerfile-cron-runner` (+22 -0) 📝 `README.md` (+6 -6) 📝 `docker-compose.yml` (+43 -3) ➕ `docker-cron-runner/cron-job-script.sh` (+16 -0) ➕ `docker-cron-runner/entrypoint.sh` (+22 -0) 📝 `docs/README.ar_EG.md` (+2 -1) 📝 `docs/README.es_ES.md` (+2 -2) 📝 `docs/README.fa_IR.md` (+2 -2) 📝 `docs/README.ru_RU.md` (+2 -2) 📝 `docs/README.zh_CN.md` (+3 -2) ➕ `docs/media/3x-ui-dark.png` (+0 -0) ➕ `docs/media/3x-ui-light.png` (+0 -0) ➕ `docs/media/default-yellow.png` (+0 -0) ➕ `docs/media/donation-button-black.svg` (+1 -0) _...and 13 more files_ </details> ### 📄 Description ## What is the pull request? ### Why is this needed? We live in challenging times, as many governments attempt to restrict internet freedom and monitor users’ online activity. For example, in Russia, Roskomnadzor blocks or throttles around 20 services every day. Xray is a solid protocol, but it is not completely immune to detection. One of the most effective ways to protect a VPN server is to minimize outgoing traffic—something 3xui already does very well. However, as mentioned earlier, the list of blocked resources changes extremely quickly, and manually updating geodat files through the panel has become quite inconvenient. This pull request addresses that issue by introducing automated updates. ### What this PR includes: 1. Cron container — downloads geodat files on a configurable schedule (via docker env), storing them in a shared volume. 2. Docker proxy — allows the cron container to restart the main 3xui container so the new geodat files are applied automatically. 3. Some additional refactoring that I believe will be useful. P.S. The main 3xui container can run independently of geodata-cron and docker-proxy. If a user doesn’t need them, they can simply remove these containers. ### What I refactored? * Split x-ui.sh into a set of Bash scripts located in the lib/ directory. This allowed me to reuse its functions in the main Dockerfile (which is why DockerInit.sh is no longer needed) and in Dockerfile-cron-runner. * Reduced Docker image size: 349.93 MB → 297.3 MB * Optimized Docker build time by ~1.5× on a VPS with 1 CPU core and 2 GB of RAM * Moved README translations from the root directory to `docs/`, making the root directory cleaner * Fixed several Bash linter issues ### How I tested? Local Docker tests on macOS, as well as testing on Ubuntu and Debian VPS instances with 1 CPU core and 2 GB of RAM. An amd64 test release for manual installation is available at https://github.com/mixa2130/3x-ui/releases/tag/v0.0.1 ## Which part of the application is affected by the change? - [ ] Frontend - [x] Backend ## Type of Changes - [ ] Bug fix - [x] New feature - [x] Refactoring - [ ] Other ## Screenshots <img width="719" height="95" alt="Screenshot 2026-01-18 at 22 39 08" src="https://github.com/user-attachments/assets/096b1733-fb60-4f69-8d75-fc938c54dc3b" /> ## What would I like to update in 3xui? * I would like to add support for custom geodat files. * I would like to have an official Docker image on Docker Hub to save time and VPS resources. * Built-in Nginx support / examples --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 20:47:25 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5505
No description provided.