From 892f0d4913872a0aa5181d43358b42ba25a85906 Mon Sep 17 00:00:00 2001 From: TranCuongQ4 Date: Wed, 27 Oct 2021 20:03:07 +0700 Subject: [PATCH] heroku --- Dockerfile | 8 +++++++ LICENSE | 21 ++++++++++++++++++ README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ app.json | 22 +++++++++++++++++++ entrypoint.sh | 46 +++++++++++++++++++++++++++++++++++++++ heroku.yml | 3 +++ 6 files changed, 159 insertions(+) create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 README.md create mode 100644 app.json create mode 100644 entrypoint.sh create mode 100644 heroku.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a61daa4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM alpine:latest + +ADD entrypoint.sh /opt/entrypoint.sh + +RUN apk add --no-cache --virtual .build-deps ca-certificates curl \ + && chmod +x /opt/entrypoint.sh + +ENTRYPOINT ["sh", "-c", "/opt/entrypoint.sh"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..09c5d7d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Yuki Kikuchi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..0c285ae --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# Giới thiệu: +Đây là một repository được fork lại từ [https://github.com/bclswl0827/v2ray-heroku](https://github.com/bclswl0827/v2ray-heroku) với chức năng là tạo ra một server V2Ray trên heroku một cách đơn giản nhất. + +Heroku sẽ không khuyến khích việc này nên các bạn cần phải fork lại dự án này để không bị heroku chặn. + +Với nhu cầu không quá cao thì heroku chính là giải pháp hoàn hảo cho anh em muốn dùng V2Ray để dùng 4G miễn phí: +* 2TB mỗi tháng +* 550 giờ mỗi tháng (~23 ngày, dĩ nhiên bạn cần ngủ 8 tiếng 1 ngày nên 550 giờ là quá đủ) + +Anh em xem hướng dẫn ở đây nhé: + +[![4G Free](https://img.youtube.com/vi/79jkqGWi0zU/0.jpg)](https://www.youtube.com/watch?v=79jkqGWi0zU) + +============================================================= + +# V2Ray Heroku + +**Nếu bạn cần triển khai V2Ray VLESS,thì qua bài viết này [vless](https://github.com/bclswl0827/v2ray-heroku/tree/vless)** + +## Tổng quan + +Dự án V2Ray WebSocket trên Heroku phải được sử dụng một cách hợp lý nếu không sẽ bị chặn + +Sau khi triển khai, mỗi khi khởi động sẽ tải bản V2Ray mới nhất + +## Triển khai + +### Bắt đầu + + 1. Fork dự án này qua tài khoản GitHub của bạn(trên PC có thể thấy nút Fork trên cùng bên tay phải, ví dụ tài khoản của bạn tên là `example`) + 2. Sửa lại tên dự án thành tên bất kỳ không nên chứa hai từ khóa `v2ray` và `heroku`(Ví dụ đổi thành `demo`) + 3. Sửa lại file `README.md`,đường dẫn `kim7tin/v2heroku` bằng đường dẫn của bạn(ví dụ `example/demo`) + +> [![Deploy](https://www.herokucdn.com/deploy/button.png)](https://dashboard.heroku.com/new?template=https://github.com/kim7tin/v2heroku) + + 4. Quay lại trang chủ của dự án,bấm vào liên kết để triển khai V2Ray + +### Đối số + +Các đối số sẽ dùng trong quá trình cài đặt。 + +| Đối số | Mặc định | Diễn giải | +| :--- | :--- | :--- | +| `ID` | `ad806487-2d26-4636-98b6-ab85cc8521f7` | VMess user ID | +| `AID` | `64` | AlterID,Số từ 0 đến 65535 | +| `WSPATH` | `/` | | + +## Truy cập CloudFlare + +Hai phương pháp sau có thể kết nối ứng dụng với CloudFlare, từ đó tăng tốc độ ở một mức độ nhất định: + +1. Liên kết tên miền với ứng dụng và kết nối tên miền với CloudFlare +2. Reverse proxy thông qua CloudFlare worker + +## Lưu ý + + 1. ** Xin đừng lạm dụng dự án này, có rất ít dịch vụ miễn phí như Heroku, hãy sử dụng và trân trọng ** + 2. Nếu bạn sử dụng tên miền để kết nối với CloudFlare, vui lòng xem xét bật TLS 1.3 + 3. Hầu hết các địa chỉ AWS IPv4 đã bị Twitter chặn diff --git a/app.json b/app.json new file mode 100644 index 0000000..b4e5b0e --- /dev/null +++ b/app.json @@ -0,0 +1,22 @@ +{ + "name": "V2Ray", + "description": "Deploy V2ray on Heroku.", + "keywords": ["V2Ray"], + "env": { + "ID": { + "description": "UUID", + "value": "ad806487-2d26-4636-98b6-ab85cc8521f7" + }, + "AID": { + "description": "AlterID", + "value": "64" + }, + "WSPATH": { + "description": "WebSocket Path", + "value": "/" + } + }, + "website": "https://ibcl.us/Heroku-V2Ray_20191014/", + "repository": "https://github.com/bclswl0827/v2ray-heroku", + "stack": "container" +} diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..2b907b9 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +# Global variables +DIR_CONFIG="/etc/v2ray" +DIR_RUNTIME="/usr/bin" +DIR_TMP="$(mktemp -d)" + +# Write V2Ray configuration +cat << EOF > ${DIR_TMP}/heroku.json +{ + "inbounds": [{ + "port": ${PORT}, + "protocol": "vmess", + "settings": { + "clients": [{ + "id": "${ID}", + "alterId": ${AID} + }] + }, + "streamSettings": { + "network": "ws", + "wsSettings": { + "path": "${WSPATH}" + } + } + }], + "outbounds": [{ + "protocol": "freedom" + }] +} +EOF + +# Get V2Ray executable release +curl --retry 10 --retry-max-time 60 -H "Cache-Control: no-cache" -fsSL github.com/v2fly/v2ray-core/releases/latest/download/v2ray-linux-64.zip -o ${DIR_TMP}/v2ray_dist.zip +busybox unzip ${DIR_TMP}/v2ray_dist.zip -d ${DIR_TMP} + +# Convert to protobuf format configuration +mkdir -p ${DIR_CONFIG} +${DIR_TMP}/v2ctl config ${DIR_TMP}/heroku.json > ${DIR_CONFIG}/config.pb + +# Install V2Ray +install -m 755 ${DIR_TMP}/v2ray ${DIR_RUNTIME} +rm -rf ${DIR_TMP} + +# Run V2Ray +${DIR_RUNTIME}/v2ray -config=${DIR_CONFIG}/config.pb diff --git a/heroku.yml b/heroku.yml new file mode 100644 index 0000000..8eec25b --- /dev/null +++ b/heroku.yml @@ -0,0 +1,3 @@ +build: + docker: + web: Dockerfile