Skip to content

Commit

Permalink
heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
TranCuongQ4 committed Oct 27, 2021
0 parents commit 892f0d4
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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``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
22 changes: 22 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -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"
}
46 changes: 46 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build:
docker:
web: Dockerfile

0 comments on commit 892f0d4

Please sign in to comment.