[PR #3657] [CLOSED] Automatic geodat file updates in docker #5498

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

📋 Pull Request Information

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

Base: main ← Head: main


📄 Description

Сontinuation of the PR#3592

What is the pull request?

Hi everyone!
The main goal of this pull request is to introduce a new killer feature to 3xui: automatic geodat file updates.

Why is this needed?

We live in challenging times, where many governments try 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 great protocol, but it’s not completely immune to detection. One of the best ways to protect a VPN server is to minimize outgoing traffic — something 3xui already helps with a lot.

However, as I mentioned earlier, the list of blocked resources changes extremely quickly nowadays, and updating geodat files manually through the panel has become quite inconvenient. This pull request solves that problem by adding 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.

Answers to frequently asked questions:

  • What happens if one of the geodat file sources doesn’t respond or becomes unavailable?

I updated the current geodat download logic. Previously, it used a simple wget -O, which overwrote the existing file even if the source was unavailable or returned an empty response.
Now it uses a safer method: xray-tools.sh/safe_download_and_update, which updates the file only if the newly downloaded version is valid and not empty. This prevents accidental corruption of existing geodat files and makes the update process much more reliable.

  • What if a user doesn’t want geodat files to be updated automatically?

No problem. After the first launch, the user can simply disable the geodata_cron and docker_proxy containers. The existing geodat files will still be available through the shared volume, but they will no longer be updated automatically. Updates will occur again only if the containers are re-enabled or restarted.

  • What if I want to add my custom geodat files in an existing container?

No problem, just add them to shared volume $PWD/geodata/ and restart the 3xui_app container

  • Is it safe to use docker-proxy?

Absolutely! It can only restart the container

  • How can I update the schedule for geodat update?

Update CRON_SCHEDULE and restart the geodata_cron container

  • How can I check geodata_cron really works?

Enter the geodata_cron container and view /var/log/cron.log.

  • On which systems was this tested?

I tested all the changes on both Debian and Ubuntu based VPS servers, and everything works correctly even with 1 vCore/​1Gb resources

Which part of the application is affected by the change?

  • Frontend
  • Backend

Type of Changes

  • Bug fix
  • New feature
  • Refactoring
  • Other

🔄 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/3657 **Author:** [@mixa2130](https://github.com/mixa2130) **Created:** 1/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📄 Description # Сontinuation of the [PR#3592 ](https://github.com/MHSanaei/3x-ui/pull/3592) ## What is the pull request? Hi everyone! The main goal of this pull request is to introduce a new killer feature to 3xui: automatic geodat file updates. Why is this needed? We live in challenging times, where many governments try 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 great protocol, but it’s not completely immune to detection. One of the best ways to protect a VPN server is to minimize outgoing traffic — something 3xui already helps with a lot. However, as I mentioned earlier, the list of blocked resources changes extremely quickly nowadays, and updating geodat files manually through the panel has become quite inconvenient. This pull request solves that problem by adding 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. Answers to frequently asked questions: - What happens if one of the geodat file sources doesn’t respond or becomes unavailable? I updated the current geodat download logic. Previously, it used a simple `wget -O`, which overwrote the existing file even if the source was unavailable or returned an empty response. Now it uses a safer method: `xray-tools.sh/safe_download_and_update`, which updates the file only if the newly downloaded version is valid and not empty. This prevents accidental corruption of existing geodat files and makes the update process much more reliable. - What if a user doesn’t want geodat files to be updated automatically? No problem. After the first launch, the user can simply disable the geodata_cron and docker_proxy containers. The existing geodat files will still be available through the shared volume, but they will no longer be updated automatically. Updates will occur again only if the containers are re-enabled or restarted. - What if I want to add my custom geodat files in an existing container? No problem, just add them to shared volume `$PWD/geodata/` and restart the `3xui_app` container - Is it safe to use docker-proxy? Absolutely! It can only restart the container - How can I update the schedule for geodat update? Update `CRON_SCHEDULE` and restart the `geodata_cron` container - How can I check `geodata_cron` really works? Enter the `geodata_cron` container and view `/var/log/cron.log`. - On which systems was this tested? I tested all the changes on both Debian and Ubuntu based VPS servers, and everything works correctly even with 1 vCore/​1Gb resources ## Which part of the application is affected by the change? - [ ] Frontend - [x] Backend ## Type of Changes - [ ] Bug fix - [x] New feature - [ ] Refactoring - [ ] Other --- <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:23 +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#5498
No description provided.