Last active
September 9, 2024 06:52
-
-
Save greatbody/1e432a06e8be4fcf31140818aa0d434a to your computer and use it in GitHub Desktop.
One key xboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 安装 Docker & Docker Compose | |
echo ">>> Installing Docker & Docker Compose..." | |
curl -sSL https://get.docker.com | bash | |
# Xboard 安装及配置 | |
echo ">>> Installing and configuring Xboard..." | |
# 获取Docker compose 文件 | |
git clone -b docker-compose --depth 1 https://github.com/greatbody/Xboard | |
cd Xboard | |
# Pull images | |
docker pull ghcr.io/greatbody/xboard:latest | |
# Build redis so no need to build when execute docker compose run | |
docker compose build | |
# 执行数据库安装命令 | |
echo ">>> Installing database..." | |
docker compose run -d --name xboard-install xboard php artisan xboard:install | |
echo ">>> Waiting for database installation..." | |
sleep 20 | |
docker logs -f xboard-install | |
sleep 10 | |
# # 启动Xboard | |
echo ">>> Starting Xboard..." | |
docker compose up -d | |
echo ">>> Xboard installation and configuration complete!" | |
echo ">>> Installing XrayR" | |
# 安装 XrayR | |
echo ">>> Installing XrayR..." | |
bash <(curl -Ls https://raw.githubusercontent.com/XrayR-project/XrayR-release/master/install.sh) | |
# Config XrayR | |
echo ">>> Configuring XrayR..." | |
# /etc/XrayR/config.yml | |
# Override config.yml with the following content | |
cat <<EOF > /etc/XrayR/config.yml | |
Log: | |
Level: warning # Log level: none, error, warning, info, debug | |
AccessPath: # /etc/XrayR/access.Log | |
ErrorPath: # /etc/XrayR/error.log | |
DnsConfigPath: # /etc/XrayR/dns.json # Path to dns config, check https://xtls.github.io/config/dns.html for help | |
RouteConfigPath: # /etc/XrayR/route.json # Path to route config, check https://xtls.github.io/config/routing.html for help | |
InboundConfigPath: # /etc/XrayR/custom_inbound.json # Path to custom inbound config, check https://xtls.github.io/config/inbound.html for help | |
OutboundConfigPath: # /etc/XrayR/custom_outbound.json # Path to custom outbound config, check https://xtls.github.io/config/outbound.html for help | |
ConnectionConfig: | |
Handshake: 4 # Handshake time limit, Second | |
ConnIdle: 30 # Connection idle time limit, Second | |
UplinkOnly: 2 # Time limit when the connection downstream is closed, Second | |
DownlinkOnly: 4 # Time limit when the connection is closed after the uplink is closed, Second | |
BufferSize: 64 # The internal cache size of each connection, kB | |
Nodes: | |
- PanelType: "NewV2board" # Panel type: SSpanel, NewV2board, PMpanel, Proxypanel, V2RaySocks, GoV2Panel, BunPanel | |
ApiConfig: | |
ApiHost: "http://127.0.0.1:7001" | |
ApiKey: "xxx" | |
NodeID: 1 | |
NodeType: Shadowsocks # Node type: V2ray,vmess,vless, Shadowsocks, Trojan, Shadowsocks-Plugin | |
Timeout: 30 # Timeout for the api request | |
EnableVless: false # Enable Vless for V2ray Type | |
VlessFlow: "xtls-rprx-vision" # Only support vless | |
SpeedLimit: 0 # Mbps, Local settings will replace remote settings, 0 means disable | |
DeviceLimit: 0 # Local settings will replace remote settings, 0 means disable | |
RuleListPath: # /etc/XrayR/rulelist Path to local rulelist file | |
DisableCustomConfig: false # disable custom config for sspanel | |
ControllerConfig: | |
ListenIP: 0.0.0.0 # IP address you want to listen | |
SendIP: 0.0.0.0 # IP address you want to send pacakage | |
UpdatePeriodic: 60 # Time to update the nodeinfo, how many sec. | |
EnableDNS: false # Use custom DNS config, Please ensure that you set the dns.json well | |
DNSType: AsIs # AsIs, UseIP, UseIPv4, UseIPv6, DNS strategy | |
EnableProxyProtocol: false # Only works for WebSocket and TCP | |
AutoSpeedLimitConfig: | |
Limit: 0 # Warned speed. Set to 0 to disable AutoSpeedLimit (mbps) | |
WarnTimes: 0 # After (WarnTimes) consecutive warnings, the user will be limited. Set to 0 to punish overspeed user immediately. | |
LimitSpeed: 0 # The speedlimit of a limited user (unit: mbps) | |
LimitDuration: 0 # How many minutes will the limiting last (unit: minute) | |
GlobalDeviceLimitConfig: | |
Enable: true # Enable the global device limit of a user | |
RedisNetwork: tcp # Redis protocol, tcp or unix | |
RedisAddr: 127.0.0.1:6379 # Redis server address, or unix socket path | |
RedisUsername: # Redis username | |
RedisPassword: YOUR PASSWORD # Redis password | |
RedisDB: 0 # Redis DB | |
Timeout: 5 # Timeout for redis request | |
Expiry: 60 # Expiry time (second) | |
EnableFallback: false # Only support for Trojan and Vless | |
FallBackConfigs: # Support multiple fallbacks | |
- SNI: # TLS SNI(Server Name Indication), Empty for any | |
Alpn: # Alpn, Empty for any | |
Path: # HTTP PATH, Empty for any | |
Dest: 80 # Required, Destination of fallback, check https://xtls.github.io/config/features/fallback.html for details. | |
ProxyProtocolVer: 0 # Send PROXY protocol version, 0 for disable | |
DisableLocalREALITYConfig: false # disable local reality config | |
- PanelType: "NewV2board" # Panel type: SSpanel, NewV2board, PMpanel, Proxypanel, V2RaySocks, GoV2Panel, BunPanel | |
ApiConfig: | |
ApiHost: "http://127.0.0.1:7001" | |
ApiKey: "xxx" | |
NodeID: 2 | |
NodeType: Vmess # Node type: V2ray,vmess,vless, Shadowsocks, Trojan, Shadowsocks-Plugin | |
Timeout: 30 # Timeout for the api request | |
EnableVless: false # Enable Vless for V2ray Type | |
VlessFlow: "xtls-rprx-vision" # Only support vless | |
SpeedLimit: 0 # Mbps, Local settings will replace remote settings, 0 means disable | |
DeviceLimit: 0 # Local settings will replace remote settings, 0 means disable | |
RuleListPath: # /etc/XrayR/rulelist Path to local rulelist file | |
DisableCustomConfig: false # disable custom config for sspanel | |
ControllerConfig: | |
ListenIP: 0.0.0.0 # IP address you want to listen | |
SendIP: 0.0.0.0 # IP address you want to send pacakage | |
UpdatePeriodic: 60 # Time to update the nodeinfo, how many sec. | |
EnableDNS: false # Use custom DNS config, Please ensure that you set the dns.json well | |
DNSType: AsIs # AsIs, UseIP, UseIPv4, UseIPv6, DNS strategy | |
EnableProxyProtocol: false # Only works for WebSocket and TCP | |
AutoSpeedLimitConfig: | |
Limit: 0 # Warned speed. Set to 0 to disable AutoSpeedLimit (mbps) | |
WarnTimes: 0 # After (WarnTimes) consecutive warnings, the user will be limited. Set to 0 to punish overspeed user immediately. | |
LimitSpeed: 0 # The speedlimit of a limited user (unit: mbps) | |
LimitDuration: 0 # How many minutes will the limiting last (unit: minute) | |
GlobalDeviceLimitConfig: | |
Enable: true # Enable the global device limit of a user | |
RedisNetwork: tcp # Redis protocol, tcp or unix | |
RedisAddr: 127.0.0.1:6379 # Redis server address, or unix socket path | |
RedisUsername: # Redis username | |
RedisPassword: YOUR PASSWORD # Redis password | |
RedisDB: 0 # Redis DB | |
Timeout: 5 # Timeout for redis request | |
Expiry: 60 # Expiry time (second) | |
EnableFallback: false # Only support for Trojan and Vless | |
FallBackConfigs: # Support multiple fallbacks | |
- SNI: # TLS SNI(Server Name Indication), Empty for any | |
Alpn: # Alpn, Empty for any | |
Path: # HTTP PATH, Empty for any | |
Dest: 80 # Required, Destination of fallback, check https://xtls.github.io/config/features/fallback.html for details. | |
ProxyProtocolVer: 0 # Send PROXY protocol version, 0 for disable | |
DisableLocalREALITYConfig: true # disable local reality config | |
CertConfig: | |
CertMode: none # Option about how to get certificate: none, file, http, dns. Choose "none" will forcedly disable the tls config. | |
EOF | |
# Generate a ApiKey | |
ApiKey=$(openssl rand -hex 16) | |
sed -i "s|ApiKey:.*|ApiKey: \"$ApiKey\"|" /etc/XrayR/config.yml | |
# 启动 XrayR | |
echo ">>> Starting XrayR..." | |
XrayR restart | |
echo ">>> XrayR started!" | |
# we have the above output from docker logs -f xboard-install. extract the admin email and password | |
AdminEmail=$(docker logs xboard-install | grep "管理员邮箱" | awk -F ':' '{print $2}') | |
AdminPassword=$(docker logs xboard-install | grep "管理员密码" | awk -F ':' '{print $2}') | |
AdminPath=$(docker logs xboard-install | grep "访问 http(s)://你的站点/" | awk -F '/' '{print $4}' | awk -F ' 进入管理面板,你可以在用户中心修改你的密码。' '{print $1}') | |
IP=$(curl -s -4 ifconfig.me) | |
echo -e "\e[32m>>> 🎉:一切就绪\e[0m" | |
echo -e "\e[32m管理员邮箱: $AdminEmail\e[0m" | |
echo -e "\e[32m管理员密码: $AdminPassword\e[0m" | |
echo -e "\e[32m访问 Xboard 站点: http://$IP:7001\e[0m" | |
echo -e "\e[32m访问管理员面板: http://$IP:7001/$AdminPath\e[0m" | |
echo -e "\e[32m通讯密钥(请以管理员身份登录后配置): $ApiKey\e[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment