gitscope
https://dev.kronoz.win/r/marzneshin.git
README.md · v0.1.0
Source
1 a47eb4c Dawsh 2y ago <p align="center">
2 a47eb4c Dawsh 2y ago <a href="https://github.com/gozargah/marzban" target="_blank" rel="noopener noreferrer">
3 a47eb4c Dawsh 2y ago <picture>
4 a47eb4c Dawsh 2y ago <source media="(prefers-color-scheme: dark)" srcset="https://github.com/Gozargah/Marzban-docs/raw/master/screenshots/logo-dark.png">
5 a47eb4c Dawsh 2y ago <img width="160" height="160" src="https://github.com/Gozargah/Marzban-docs/raw/master/screenshots/logo-light.png">
6 a47eb4c Dawsh 2y ago </picture>
7 a47eb4c Dawsh 2y ago </a>
8 a47eb4c Dawsh 2y ago </p>
9 a47eb4c Dawsh 2y ago
10 a47eb4c Dawsh 2y ago <h1 align="center"/>Marzban</h1>
11 a47eb4c Dawsh 2y ago
12 a47eb4c Dawsh 2y ago <p align="center">
13 a47eb4c Dawsh 2y ago Unified GUI Censorship Resistant Solution Powered by <a href="https://github.com/XTLS/Xray-core">Xray</a>
14 a47eb4c Dawsh 2y ago </p>
15 a47eb4c Dawsh 2y ago
16 a47eb4c Dawsh 2y ago <br/>
17 a47eb4c Dawsh 2y ago <p align="center">
18 a47eb4c Dawsh 2y ago <a href="#">
19 a47eb4c Dawsh 2y ago <img src="https://img.shields.io/github/actions/workflow/status/gozargah/marzban/build.yml?style=flat-square" />
20 a47eb4c Dawsh 2y ago </a>
21 a47eb4c Dawsh 2y ago <a href="https://hub.docker.com/r/gozargah/marzban" target="_blank">
22 a47eb4c Dawsh 2y ago <img src="https://img.shields.io/docker/pulls/gozargah/marzban?style=flat-square&logo=docker" />
23 a47eb4c Dawsh 2y ago </a>
24 a47eb4c Dawsh 2y ago <a href="#">
25 a47eb4c Dawsh 2y ago <img src="https://img.shields.io/github/license/gozargah/marzban?style=flat-square" />
26 a47eb4c Dawsh 2y ago </a>
27 a47eb4c Dawsh 2y ago <a href="https://t.me/gozargah_marzban" target="_blank">
28 a47eb4c Dawsh 2y ago <img src="https://img.shields.io/badge/telegram-group-blue?style=flat-square&logo=telegram" />
29 a47eb4c Dawsh 2y ago </a>
30 a47eb4c Dawsh 2y ago <a href="#">
31 a47eb4c Dawsh 2y ago <img src="https://img.shields.io/badge/twitter-commiunity-blue?style=flat-square&logo=twitter" />
32 a47eb4c Dawsh 2y ago </a>
33 a47eb4c Dawsh 2y ago <a href="#">
34 a47eb4c Dawsh 2y ago <img src="https://img.shields.io/github/stars/gozargah/marzban?style=social" />
35 a47eb4c Dawsh 2y ago </a>
36 a47eb4c Dawsh 2y ago </p>
37 a47eb4c Dawsh 2y ago
38 a47eb4c Dawsh 2y ago <p align="center">
39 a47eb4c Dawsh 2y ago <a href="./README.md">
40 a47eb4c Dawsh 2y ago English
41 a47eb4c Dawsh 2y ago </a>
42 a47eb4c Dawsh 2y ago /
43 a47eb4c Dawsh 2y ago <a href="./README-fa.md">
44 a47eb4c Dawsh 2y ago فارسی
45 a47eb4c Dawsh 2y ago </a>
46 a47eb4c Dawsh 2y ago /
47 a47eb4c Dawsh 2y ago <a href="./README-zh-cn.md">
48 a47eb4c Dawsh 2y ago 简体中文
49 a47eb4c Dawsh 2y ago </a>
50 a47eb4c Dawsh 2y ago /
51 a47eb4c Dawsh 2y ago <a href="./README-ru.md">
52 a47eb4c Dawsh 2y ago Русский
53 a47eb4c Dawsh 2y ago </a>
54 a47eb4c Dawsh 2y ago </p>
55 a47eb4c Dawsh 2y ago
56 a47eb4c Dawsh 2y ago <p align="center">
57 a47eb4c Dawsh 2y ago <a href="https://github.com/gozargah/marzban" target="_blank" rel="noopener noreferrer" >
58 a47eb4c Dawsh 2y ago <img src="https://github.com/Gozargah/Marzban-docs/raw/master/screenshots/preview.png" alt="Marzban screenshots" width="600" height="auto">
59 a47eb4c Dawsh 2y ago </a>
60 a47eb4c Dawsh 2y ago </p>
61 a47eb4c Dawsh 2y ago
62 a47eb4c Dawsh 2y ago ## Table of Contents
63 a47eb4c Dawsh 2y ago
64 a47eb4c Dawsh 2y ago - [Overview](#overview)
65 a47eb4c Dawsh 2y ago - [Why using Marzban?](#why-using-marzban)
66 a47eb4c Dawsh 2y ago - [Features](#features)
67 a47eb4c Dawsh 2y ago - [Installation guide](#installation-guide)
68 a47eb4c Dawsh 2y ago - [Configuration](#configuration)
69 a47eb4c Dawsh 2y ago - [API](#api)
70 a47eb4c Dawsh 2y ago - [Backup](#backup)
71 a47eb4c Dawsh 2y ago - [Telegram Bot](#telegram-bot)
72 a47eb4c Dawsh 2y ago - [Marzban CLI](#marzban-cli)
73 a47eb4c Dawsh 2y ago - [Marzban Node](#marzban-node)
74 a47eb4c Dawsh 2y ago - [Webhook notifications](#webhook-notifications)
75 a47eb4c Dawsh 2y ago - [Donation](#donation)
76 a47eb4c Dawsh 2y ago - [License](#license)
77 a47eb4c Dawsh 2y ago - [Contributors](#contributors)
78 a47eb4c Dawsh 2y ago
79 a47eb4c Dawsh 2y ago # Overview
80 a47eb4c Dawsh 2y ago
81 a47eb4c Dawsh 2y ago Marzban (the Persian word for "border guard" - pronounced /mærz'ban/) is a proxy management tool that provides a simple and easy-to-use user interface for managing hundreds of proxy accounts powered by [Xray-core](https://github.com/XTLS/Xray-core) and built using Python and Reactjs.
82 a47eb4c Dawsh 2y ago
83 a47eb4c Dawsh 2y ago ## Why using Marzban?
84 a47eb4c Dawsh 2y ago
85 a47eb4c Dawsh 2y ago Marzban is user-friendly, feature-rich and reliable. It lets you to create different proxies for your users without any complicated configuration. Using its built-in web UI, you are able to monitor, modify and limit users.
86 a47eb4c Dawsh 2y ago
87 a47eb4c Dawsh 2y ago ### Features
88 a47eb4c Dawsh 2y ago
89 a47eb4c Dawsh 2y ago - Built-in **Web UI**
90 a47eb4c Dawsh 2y ago - [**Multiple Nodes**](#marzban-node) support (for infrastructure distribution & scalability)
91 a47eb4c Dawsh 2y ago - Supports protocols **Vmess**, **VLESS**, **Trojan** and **Shadowsocks**
92 a47eb4c Dawsh 2y ago - **Multi-protocol** for a single user
93 a47eb4c Dawsh 2y ago - **Multi-user** on a single inbound
94 a47eb4c Dawsh 2y ago - **Multi-inbound** on a **single port** (fallbacks support)
95 a47eb4c Dawsh 2y ago - **Traffic** and **expiry date** limitations
96 a47eb4c Dawsh 2y ago - **Periodic** traffic limit (e.g. daily, weekly, etc.)
97 a47eb4c Dawsh 2y ago - **Subscription link** compatible with **V2ray** _(such as V2RayNG, OneClick, Nekoray, etc.)_, **Clash** and **ClashMeta**
98 a47eb4c Dawsh 2y ago - Automated **Share link** and **QRcode** generator
99 a47eb4c Dawsh 2y ago - System monitoring and **traffic statistics**
100 a47eb4c Dawsh 2y ago - Customizable xray configuration
101 a47eb4c Dawsh 2y ago - **TLS** and **REALITY** support
102 a47eb4c Dawsh 2y ago - Integrated **Telegram Bot**
103 a47eb4c Dawsh 2y ago - Integrated **Command Line Interface (CLI)**
104 a47eb4c Dawsh 2y ago - **Multi-language**
105 a47eb4c Dawsh 2y ago - **Multi-admin** support (WIP)
106 a47eb4c Dawsh 2y ago
107 a47eb4c Dawsh 2y ago # Installation guide
108 a47eb4c Dawsh 2y ago
109 a47eb4c Dawsh 2y ago Run the following command
110 a47eb4c Dawsh 2y ago
111 a47eb4c Dawsh 2y ago ```bash
112 a47eb4c Dawsh 2y ago sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install
113 a47eb4c Dawsh 2y ago ```
114 a47eb4c Dawsh 2y ago
115 a47eb4c Dawsh 2y ago Once the installation is complete:
116 a47eb4c Dawsh 2y ago
117 a47eb4c Dawsh 2y ago - You will see the logs that you can stop watching them by closing the terminal or pressing `Ctrl+C`
118 a47eb4c Dawsh 2y ago - The Marzban files will be located at `/opt/marzban`
119 a47eb4c Dawsh 2y ago - The configuration file can be found at `/opt/marzban/.env` (refer to [configurations](#configuration) section to see variables)
120 a47eb4c Dawsh 2y ago - The data files will be placed at `/var/lib/marzban`
121 a47eb4c Dawsh 2y ago - You can access the Marzban dashboard by opening a web browser and navigating to `http://YOUR_SERVER_IP:8000/dashboard/` (replace YOUR_SERVER_IP with the actual IP address of your server)
122 a47eb4c Dawsh 2y ago
123 a47eb4c Dawsh 2y ago Next, you need to create a sudo admin for logging into the Marzban dashboard by the following command
124 a47eb4c Dawsh 2y ago
125 a47eb4c Dawsh 2y ago ```bash
126 a47eb4c Dawsh 2y ago marzban cli admin create --sudo
127 a47eb4c Dawsh 2y ago ```
128 a47eb4c Dawsh 2y ago
129 a47eb4c Dawsh 2y ago That's it! You can login to your dashboard using these credentials
130 a47eb4c Dawsh 2y ago
131 a47eb4c Dawsh 2y ago To see the help message of the Marzban script, run the following command
132 a47eb4c Dawsh 2y ago
133 a47eb4c Dawsh 2y ago ```bash
134 a47eb4c Dawsh 2y ago marzban --help
135 a47eb4c Dawsh 2y ago ```
136 a47eb4c Dawsh 2y ago
137 a47eb4c Dawsh 2y ago If you are eager to run the project using the source code, check the section below
138 a47eb4c Dawsh 2y ago <details markdown="1">
139 a47eb4c Dawsh 2y ago <summary><h3>Manual install (advanced)</h3></summary>
140 a47eb4c Dawsh 2y ago
141 a47eb4c Dawsh 2y ago Install xray on your machine
142 a47eb4c Dawsh 2y ago
143 a47eb4c Dawsh 2y ago You can install it using [Xray-install](https://github.com/XTLS/Xray-install)
144 a47eb4c Dawsh 2y ago
145 a47eb4c Dawsh 2y ago ```bash
146 a47eb4c Dawsh 2y ago bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
147 a47eb4c Dawsh 2y ago ```
148 a47eb4c Dawsh 2y ago
149 a47eb4c Dawsh 2y ago Clone this project and install the dependencies (you need Python >= 3.8)
150 a47eb4c Dawsh 2y ago
151 a47eb4c Dawsh 2y ago ```bash
152 a47eb4c Dawsh 2y ago git clone https://github.com/Gozargah/Marzban.git
153 a47eb4c Dawsh 2y ago cd Marzban
154 a47eb4c Dawsh 2y ago wget -qO- https://bootstrap.pypa.io/get-pip.py | python3 -
155 a47eb4c Dawsh 2y ago python3 -m pip install -r requirements.txt
156 a47eb4c Dawsh 2y ago ```
157 a47eb4c Dawsh 2y ago
158 a47eb4c Dawsh 2y ago Alternatively, to have an isolated environment you can use [Python Virtualenv](https://pypi.org/project/virtualenv/)
159 a47eb4c Dawsh 2y ago
160 a47eb4c Dawsh 2y ago Then run the following command to run the database migration scripts
161 a47eb4c Dawsh 2y ago
162 a47eb4c Dawsh 2y ago ```bash
163 a47eb4c Dawsh 2y ago alembic upgrade head
164 a47eb4c Dawsh 2y ago ```
165 a47eb4c Dawsh 2y ago
166 a47eb4c Dawsh 2y ago If you want to use `marzban-cli`, you should link it to a file in your `$PATH`, make it executable, and install the auto-completion:
167 a47eb4c Dawsh 2y ago
168 a47eb4c Dawsh 2y ago ```bash
169 a47eb4c Dawsh 2y ago sudo ln -s $(pwd)/marzban-cli.py /usr/bin/marzban-cli
170 a47eb4c Dawsh 2y ago sudo chmod +x /usr/bin/marzban-cli
171 a47eb4c Dawsh 2y ago marzban-cli completion install
172 a47eb4c Dawsh 2y ago ```
173 a47eb4c Dawsh 2y ago
174 a47eb4c Dawsh 2y ago Now it's time to configuration
175 a47eb4c Dawsh 2y ago
176 a47eb4c Dawsh 2y ago Make a copy of `.env.example` file, take a look and edit it using a text editor like `nano`.
177 a47eb4c Dawsh 2y ago
178 a47eb4c Dawsh 2y ago You probably like to modify the admin credentials.
179 a47eb4c Dawsh 2y ago
180 a47eb4c Dawsh 2y ago ```bash
181 a47eb4c Dawsh 2y ago cp .env.example .env
182 a47eb4c Dawsh 2y ago nano .env
183 a47eb4c Dawsh 2y ago ```
184 a47eb4c Dawsh 2y ago
185 a47eb4c Dawsh 2y ago > Check [configurations](#configuration) section for more information
186 a47eb4c Dawsh 2y ago
187 a47eb4c Dawsh 2y ago Eventually, launch the application using command below
188 a47eb4c Dawsh 2y ago
189 a47eb4c Dawsh 2y ago ```bash
190 a47eb4c Dawsh 2y ago python3 main.py
191 a47eb4c Dawsh 2y ago ```
192 a47eb4c Dawsh 2y ago
193 a47eb4c Dawsh 2y ago To launch with linux systemctl (copy marzban.service file to `/var/lib/marzban/marzban.service`)
194 a47eb4c Dawsh 2y ago
195 a47eb4c Dawsh 2y ago ```
196 a47eb4c Dawsh 2y ago systemctl enable /var/lib/marzban/marzban.service
197 a47eb4c Dawsh 2y ago systemctl start marzban
198 a47eb4c Dawsh 2y ago ```
199 a47eb4c Dawsh 2y ago
200 a47eb4c Dawsh 2y ago To use with nginx
201 a47eb4c Dawsh 2y ago
202 a47eb4c Dawsh 2y ago ```
203 a47eb4c Dawsh 2y ago server {
204 a47eb4c Dawsh 2y ago listen 443 ssl http2;
205 a47eb4c Dawsh 2y ago listen [::]:443 ssl http2;
206 a47eb4c Dawsh 2y ago server_name example.com;
207 a47eb4c Dawsh 2y ago
208 a47eb4c Dawsh 2y ago ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
209 a47eb4c Dawsh 2y ago ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
210 a47eb4c Dawsh 2y ago
211 a47eb4c Dawsh 2y ago location ~* /(dashboard|api|docs|redoc|openapi.json) {
212 a47eb4c Dawsh 2y ago proxy_pass http://0.0.0.0:8000;
213 a47eb4c Dawsh 2y ago proxy_set_header Host $host;
214 a47eb4c Dawsh 2y ago proxy_set_header X-Real-IP $remote_addr;
215 a47eb4c Dawsh 2y ago proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
216 a47eb4c Dawsh 2y ago }
217 a47eb4c Dawsh 2y ago
218 a47eb4c Dawsh 2y ago # xray-core ws-path: /
219 a47eb4c Dawsh 2y ago # client ws-path: /marzban/me/2087
220 a47eb4c Dawsh 2y ago #
221 a47eb4c Dawsh 2y ago # All traffic is proxed through port 443, and send to the xray port(2087, 2088 etc.).
222 a47eb4c Dawsh 2y ago # The '/marzban' in location regex path can changed any characters by yourself.
223 a47eb4c Dawsh 2y ago #
224 a47eb4c Dawsh 2y ago # /${path}/${username}/${xray-port}
225 a47eb4c Dawsh 2y ago location ~* /marzban/.+/(.+)$ {
226 a47eb4c Dawsh 2y ago proxy_redirect off;
227 a47eb4c Dawsh 2y ago proxy_pass http://127.0.0.1:$1/;
228 a47eb4c Dawsh 2y ago proxy_http_version 1.1;
229 a47eb4c Dawsh 2y ago proxy_set_header Upgrade $http_upgrade;
230 a47eb4c Dawsh 2y ago proxy_set_header Connection "upgrade";
231 a47eb4c Dawsh 2y ago proxy_set_header Host $http_host;
232 a47eb4c Dawsh 2y ago proxy_set_header X-Real-IP $remote_addr;
233 a47eb4c Dawsh 2y ago proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
234 a47eb4c Dawsh 2y ago }
235 a47eb4c Dawsh 2y ago }
236 a47eb4c Dawsh 2y ago ```
237 a47eb4c Dawsh 2y ago
238 a47eb4c Dawsh 2y ago or
239 a47eb4c Dawsh 2y ago
240 a47eb4c Dawsh 2y ago ```
241 a47eb4c Dawsh 2y ago server {
242 a47eb4c Dawsh 2y ago listen 443 ssl http2;
243 a47eb4c Dawsh 2y ago listen [::]:443 ssl http2;
244 a47eb4c Dawsh 2y ago server_name marzban.example.com;
245 a47eb4c Dawsh 2y ago
246 a47eb4c Dawsh 2y ago ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
247 a47eb4c Dawsh 2y ago ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
248 a47eb4c Dawsh 2y ago
249 a47eb4c Dawsh 2y ago location / {
250 a47eb4c Dawsh 2y ago proxy_pass http://0.0.0.0:8000;
251 a47eb4c Dawsh 2y ago proxy_set_header Host $host;
252 a47eb4c Dawsh 2y ago proxy_set_header X-Real-IP $remote_addr;
253 a47eb4c Dawsh 2y ago proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
254 a47eb4c Dawsh 2y ago }
255 a47eb4c Dawsh 2y ago }
256 a47eb4c Dawsh 2y ago ```
257 a47eb4c Dawsh 2y ago
258 a47eb4c Dawsh 2y ago By default the app will be run on `http://localhost:8000/dashboard`. You can configure it using changing the `UVICORN_HOST` and `UVICORN_PORT` environment variables.
259 a47eb4c Dawsh 2y ago </details>
260 a47eb4c Dawsh 2y ago
261 a47eb4c Dawsh 2y ago # Configuration
262 a47eb4c Dawsh 2y ago
263 a47eb4c Dawsh 2y ago > You can set settings below using environment variables or placing them in `.env` file.
264 a47eb4c Dawsh 2y ago
265 a47eb4c Dawsh 2y ago | Variable | Description |
266 a47eb4c Dawsh 2y ago | --------------------------------- | ----------------------------------------------------------------------------------------------------- |
267 a47eb4c Dawsh 2y ago | SUDO_USERNAME | Superuser's username |
268 a47eb4c Dawsh 2y ago | SUDO_PASSWORD | Superuser's password |
269 a47eb4c Dawsh 2y ago | SQLALCHEMY_DATABASE_URL | Database URL ([SQLAlchemy's docs](https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls)) |
270 a47eb4c Dawsh 2y ago | UVICORN_HOST | Bind application to this host (default: `0.0.0.0`) |
271 a47eb4c Dawsh 2y ago | UVICORN_PORT | Bind application to this port (default: `8000`) |
272 a47eb4c Dawsh 2y ago | UVICORN_UDS | Bind application to a UNIX domain socket |
273 a47eb4c Dawsh 2y ago | UVICORN_SSL_CERTFILE | SSL certificate file to have application on https |
274 a47eb4c Dawsh 2y ago | UVICORN_SSL_KEYFILE | SSL key file to have application on https |
275 a47eb4c Dawsh 2y ago | XRAY_JSON | Path of Xray's json config file (default: `xray_config.json`) |
276 a47eb4c Dawsh 2y ago | XRAY_EXECUTABLE_PATH | Path of Xray binary (default: `/usr/local/bin/xray`) |
277 a47eb4c Dawsh 2y ago | XRAY_ASSETS_PATH | Path of Xray assets (default: `/usr/local/share/xray`) |
278 a47eb4c Dawsh 2y ago | XRAY_SUBSCRIPTION_URL_PREFIX | Prefix of subscription URLs |
279 a47eb4c Dawsh 2y ago | XRAY_FALLBACKS_INBOUND_TAG | Tag of the inbound that includes fallbacks, needed in the case you're using fallbacks |
280 a47eb4c Dawsh 2y ago | XRAY_EXCLUDE_INBOUND_TAGS | Tags of the inbounds that shouldn't be managed and included in links by application |
281 a47eb4c Dawsh 2y ago | CUSTOM_TEMPLATES_DIRECTORY | Customized templates directory (default: `app/templates`) |
282 a47eb4c Dawsh 2y ago | CLASH_SUBSCRIPTION_TEMPLATE | The template that will be used for generating clash configs (default: `clash/default.yml`) |
283 a47eb4c Dawsh 2y ago | SUBSCRIPTION_PAGE_TEMPLATE | The template used for generating subscription info page (default: `subscription/index.html`) |
284 a47eb4c Dawsh 2y ago | HOME_PAGE_TEMPLATE | Decoy page template (default: `home/index.html`) |
285 a47eb4c Dawsh 2y ago | TELEGRAM_API_TOKEN | Telegram bot API token (get token from [@botfather](https://t.me/botfather)) |
286 a47eb4c Dawsh 2y ago | TELEGRAM_ADMIN_ID | Numeric Telegram ID of admin (use [@userinfobot](https://t.me/userinfobot) to found your ID) |
287 a47eb4c Dawsh 2y ago | TELEGRAM_PROXY_URL | Run Telegram Bot over proxy |
288 a47eb4c Dawsh 2y ago | JWT_ACCESS_TOKEN_EXPIRE_MINUTES | Expire time for the Access Tokens in minutes, `0` considered as infinite (default: `1440`) |
289 a47eb4c Dawsh 2y ago | DOCS | Whether API documents should be available on `/docs` and `/redoc` or not (default: `False`) |
290 a47eb4c Dawsh 2y ago | DEBUG | Debug mode for development (default: `False`) |
291 a47eb4c Dawsh 2y ago | WEBHOOK_ADDRESS | Webhook address to send notifications to. Webhook notifications will be sent if this value was set. |
292 a47eb4c Dawsh 2y ago | WEBHOOK_SECRET | Webhook secret will be sent with each request as `x-webhook-secret` in the header (default: `None`) |
293 a47eb4c Dawsh 2y ago | NUMBER_OF_RECURRENT_NOTIFICATIONS | How many times to retry if an error detected in sending a notification (default: `3`) |
294 a47eb4c Dawsh 2y ago | RECURRENT_NOTIFICATIONS_TIMEOUT | Timeout between each retry if an error detected in sending a notification in seconds (default: `180`) |
295 a47eb4c Dawsh 2y ago | NOTIFY_REACHED_USAGE_PERCENT | At which percentage of usage to send the warning notification (default: `80`) |
296 a47eb4c Dawsh 2y ago | NOTIFY_DAYS_LEFT | When to send warning notifaction about expiration (default: `3`) |
297 a47eb4c Dawsh 2y ago
298 a47eb4c Dawsh 2y ago # API
299 a47eb4c Dawsh 2y ago
300 a47eb4c Dawsh 2y ago Marzban provides a REST API that enables developers to interact with Marzban services programmatically. To view the API documentation in Swagger UI or ReDoc, set the configuration variable `DOCS=True` and navigate to the `/docs` and `/redoc`.
301 a47eb4c Dawsh 2y ago
302 a47eb4c Dawsh 2y ago # Backup
303 a47eb4c Dawsh 2y ago
304 a47eb4c Dawsh 2y ago It's always a good idea to backup your Marzban files regularly to prevent data loss in case of system failures or accidental deletion. Here are the steps to backup Marzban:
305 a47eb4c Dawsh 2y ago
306 a47eb4c Dawsh 2y ago 1. By default, all Marzban important files are saved in `/var/lib/marzban` (Docker versions). Copy the entire `/var/lib/marzban` directory to a backup location of your choice, such as an external hard drive or cloud storage.
307 a47eb4c Dawsh 2y ago 2. Additionally, make sure to backup your env file, which contains your configuration variables, and also, your Xray config file. If you installed Marzban using marzban-scripts (recommended installation approach), the env and other configurations should be inside `/opt/marzban/` directory.
308 a47eb4c Dawsh 2y ago
309 a47eb4c Dawsh 2y ago By following these steps, you can ensure that you have a backup of all your Marzban files and data, as well as your configuration variables and Xray configuration, in case you need to restore them in the future. Remember to update your backups regularly to keep them up-to-date.
310 a47eb4c Dawsh 2y ago
311 a47eb4c Dawsh 2y ago # Telegram Bot
312 a47eb4c Dawsh 2y ago
313 a47eb4c Dawsh 2y ago Marzban comes with an integrated Telegram bot that can handle server management, user creation and removal, and send notifications. This bot can be easily enabled by following a few simple steps, and it provides a convenient way to interact with Marzban without having to log in to the server every time.
314 a47eb4c Dawsh 2y ago
315 a47eb4c Dawsh 2y ago To enable Telegram Bot:
316 a47eb4c Dawsh 2y ago
317 a47eb4c Dawsh 2y ago 1. set `TELEGRAM_API_TOKEN` to your bot's API Token
318 a47eb4c Dawsh 2y ago 2. set `TELEGRAM_ADMIN_ID` to your Telegram account's numeric ID, you can get your ID from [@userinfobot](https://t.me/userinfobot)
319 a47eb4c Dawsh 2y ago
320 a47eb4c Dawsh 2y ago # Marzban CLI
321 a47eb4c Dawsh 2y ago
322 a47eb4c Dawsh 2y ago Marzban comes with an integrated CLI named `marzban-cli` which allows administrators to have direct interaction with it.
323 a47eb4c Dawsh 2y ago
324 a47eb4c Dawsh 2y ago If you've installed Marzban using easy install script, you can access the cli commands by running
325 a47eb4c Dawsh 2y ago
326 a47eb4c Dawsh 2y ago ```bash
327 a47eb4c Dawsh 2y ago marzban cli [OPTIONS] COMMAND [ARGS]...
328 a47eb4c Dawsh 2y ago ```
329 a47eb4c Dawsh 2y ago
330 a47eb4c Dawsh 2y ago For more information, You can read [Marzban CLI's documentation](./cli/README.md).
331 a47eb4c Dawsh 2y ago
332 a47eb4c Dawsh 2y ago # Marzban Node
333 a47eb4c Dawsh 2y ago
334 a47eb4c Dawsh 2y ago The Marzban project introduces the [Marzban-node](https://github.com/gozargah/marzban-node), which revolutionizes infrastructure distribution. With Marzban-node, you can distribute your infrastructure across multiple locations, unlocking benefits such as redundancy, high availability, scalability, flexibility. Marzban-node empowers users to connect to different servers, offering them the flexibility to choose and connect to multiple servers instead of being limited to only one server.
335 a47eb4c Dawsh 2y ago For more detailed information and installation instructions, please refer to the [Marzban-node official documentation](https://github.com/gozargah/marzban-node)
336 a47eb4c Dawsh 2y ago
337 a47eb4c Dawsh 2y ago # Webhook notifications
338 a47eb4c Dawsh 2y ago
339 a47eb4c Dawsh 2y ago You can set a webhook address and Marzban will send the notifications to that address.
340 a47eb4c Dawsh 2y ago
341 a47eb4c Dawsh 2y ago the requests will be sent as a post request to the adress provided by `WEBHOOK_ADDRESS` with `WEBHOOK_SECRET` as `x-webhook-secret` in the headers.
342 a47eb4c Dawsh 2y ago
343 a47eb4c Dawsh 2y ago Example request sent from Marzban:
344 a47eb4c Dawsh 2y ago
345 a47eb4c Dawsh 2y ago ```
346 a47eb4c Dawsh 2y ago Headers:
347 a47eb4c Dawsh 2y ago Host: 0.0.0.0:9000
348 a47eb4c Dawsh 2y ago User-Agent: python-requests/2.28.1
349 a47eb4c Dawsh 2y ago Accept-Encoding: gzip, deflate
350 a47eb4c Dawsh 2y ago Accept: */*
351 a47eb4c Dawsh 2y ago Connection: keep-alive
352 a47eb4c Dawsh 2y ago x-webhook-secret: something-very-very-secret
353 a47eb4c Dawsh 2y ago Content-Length: 107
354 a47eb4c Dawsh 2y ago Content-Type: application/json
355 a47eb4c Dawsh 2y ago
356 a47eb4c Dawsh 2y ago
357 a47eb4c Dawsh 2y ago
358 a47eb4c Dawsh 2y ago Body:
359 a47eb4c Dawsh 2y ago {"username": "marzban_test_user", "action": "user_updated", "enqueued_at": 1680506457.636369, "tries": 0}
360 a47eb4c Dawsh 2y ago ```
361 a47eb4c Dawsh 2y ago
362 a47eb4c Dawsh 2y ago Different action typs are: `user_created`, `user_updated`, `user_deleted`, `user_limited`, `user_expired`, `user_disabled`, `user_enabled`
363 a47eb4c Dawsh 2y ago
364 a47eb4c Dawsh 2y ago # Donation
365 a47eb4c Dawsh 2y ago
366 a47eb4c Dawsh 2y ago If you found Marzban useful and would like to support its development, you can make a donation in one of the following crypto networks:
367 a47eb4c Dawsh 2y ago
368 a47eb4c Dawsh 2y ago - TRON network (TRC20): `TX8kJoDcowQPBFTYHAJR36GyoUKP1Xwzkb`
369 a47eb4c Dawsh 2y ago - ETH, BNB, MATIC network (ERC20, BEP20): `0xFdc9ad32454FA4fc4733270FCc12ddBFb68b83F7`
370 a47eb4c Dawsh 2y ago - Bitcoin network: `bc1qpys2nefgsjjgae3g3gqy9crsv3h3rm96tlkz0v`
371 a47eb4c Dawsh 2y ago - Dogecoin network: `DJAocBAu8y6LwhDKUktLAyzV8xyoFeHH6R`
372 a47eb4c Dawsh 2y ago - TON network: `EQAVf-7hAXHlF-jmrKE44oBwN7HGQFVBLAtrOsev5K4qR4P8`
373 a47eb4c Dawsh 2y ago
374 a47eb4c Dawsh 2y ago Thank you for your support!
375 a47eb4c Dawsh 2y ago
376 a47eb4c Dawsh 2y ago # License
377 a47eb4c Dawsh 2y ago
378 a47eb4c Dawsh 2y ago Made in [Unknown!] and Published under [AGPL-3.0](./LICENSE).
379 a47eb4c Dawsh 2y ago
380 a47eb4c Dawsh 2y ago # Contributors
381 a47eb4c Dawsh 2y ago
382 a47eb4c Dawsh 2y ago We ❤️‍🔥 contributors! If you'd like to contribute, please check out our [Contributing Guidelines](CONTRIBUTING.md) and feel free to submit a pull request or open an issue. We also welcome you to join our [Telegram](https://t.me/gozargah_marzban) group for either support or contributing guidance.
383 a47eb4c Dawsh 2y ago
384 a47eb4c Dawsh 2y ago Check [open issues](https://github.com/gozargah/marzban/issues) to help the progress of this project.
385 a47eb4c Dawsh 2y ago
386 a47eb4c Dawsh 2y ago <p align="center">
387 a47eb4c Dawsh 2y ago Thanks to the all contributors who have helped improve Marzban:
388 a47eb4c Dawsh 2y ago </p>
389 a47eb4c Dawsh 2y ago <p align="center">
390 a47eb4c Dawsh 2y ago <a href="https://github.com/Gozargah/Marzban/graphs/contributors">
391 a47eb4c Dawsh 2y ago <img src="https://contrib.rocks/image?repo=Gozargah/Marzban" />
392 a47eb4c Dawsh 2y ago </a>
393 a47eb4c Dawsh 2y ago </p>
394 a47eb4c Dawsh 2y ago <p align="center">
395 a47eb4c Dawsh 2y ago Made with <a rel="noopener noreferrer" target="_blank" href="https://contrib.rocks">contrib.rocks</a>
396 a47eb4c Dawsh 2y ago </p>