2017年10月23日星期一

Gsnova应用websockets /JS Nodes模式部署到Heroku平台教程

翻墙方案: 基于GSnova的websockets /JS Nodes 部署在Heroku上翻墙教程


部署方式一:git push模式


1.新建工作文件夹Workspace
2.Heroku login
E-mail:xxxxxx@gmail.com
Password:xxxxxx

3.cd <path_to_Workspace>  //
cd c:\
c:\>cd C:\Users\用户名\Desktop\gsnova

4.解压复制gsnova pass服务端文件到Workspace文件夹

5.git init // 初始化Workspace文件夹为本地仓库文件夹
Workspace文件夹生成.git
替代方案:用GithubGo-Heroku-example实例文件部署
git clone https://github.com/freeformz/go-heroku-example
cd go-heroku-example
进入go-heroku-example目录,删除web.go,然后把前面下载的index.go放进去


6.heroku create <app name>  //创建heroku app
Creating gsnovago... done
https://gsnovago.herokuapp.com/ | https://git.heroku.com/gsnovago.git

7.git add . -A  // 把本地仓库改动全部加入本地git仓库
8.git commit -am "make it better"  // commit
9.git push heroku master  //推送Workspace文件夹里的内容到heroku master分支

C:\Users\JonasXiao\Desktop\gsnova>git push heroku master
Counting objects: 752, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (709/709), done.
Writing objects: 100% (752/752), 1.25 MiB | 1.44 MiB/s, done.
Total 752 (delta 96), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq... done
remote: -----> Checking Godeps/Godeps.json file.
remote: -----> Installing go1.9.1
remote: -----> Fetching go1.9.1.linux-amd64.tar.gz... done
remote:  !!    Installing package '.' (default)
remote:  !!
remote: -----> Running: go install -v -tags heroku .
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/gotoolkit/ots
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/gsnova/common/logger
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/gsnova/common/netx
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/golang/snappy
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/gsnova/common/helper
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/gorilla/websocket
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/quic-go/internal/protocol
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/quic-go/internal/utils
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/bifurcation/mint/syntax
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/quic-go/congestion
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/curve25519
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/hashicorp/golang-lru/simplelru
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/bifurcation/mint
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/hashicorp/golang-lru
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/aes12
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/fnv128a
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/quic-go-certificates
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/quic-go/qerr
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/hkdf
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/vmihailenco/msgpack/codes
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/vmihailenco/msgpack
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/quic-go/internal/crypto
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/quic-go/internal/handshake
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/chacha20poly1305/internal/chacha20
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/poly1305
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/chacha20poly1305
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/salsa20/salsa
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/salsa20
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/pmux
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/quic-go/internal/wire
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/quic-go/internal/flowcontrol
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/quic-go/ackhandler
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/net/http2/hpack
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/lucas-clemente/quic-go
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/text/transform
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/text/unicode/bidi
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/text/secure/bidirule
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/text/unicode/norm
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/pkg/errors
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/templexxx/cpufeat
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/templexxx/reedsolomon
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/net/idna
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/net/lex/httplex
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/net/http2
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/templexxx/xor
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/tjfoc/gmsm/sm4
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/blowfish
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/cast5
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/pbkdf2
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/tea
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/twofish
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/crypto/xtea
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/net/bpf
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/net/internal/iana
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/net/internal/socket
remote: github.com/yinqiwen/gsnova/remote/server/vendor/golang.org/x/net/ipv4
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/gsnova/common/mux
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/xtaci/kcp-go
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/gsnova/remote
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/gsnova/remote/channel/websocket
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/gsnova/remote/channel/http2
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/gsnova/remote/channel/http
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/gsnova/remote/channel/kcp
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/gsnova/remote/channel/quic
remote: github.com/yinqiwen/gsnova/remote/server/vendor/github.com/yinqiwen/gsnova/remote/channel/tcp
remote: github.com/yinqiwen/gsnova/remote/server
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 4.7M
remote: -----> Launching...
remote:        Released v3
remote:        https://gsnovago.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/gsnovago.git

 * [new branch]      master -> master

至此部署成功



部署方式二:Heroku部署php go的dropbox模式教程


d. 登录进入Heroku,进入主控面板,并创建一个app,记住app的名字。
e. 进入该app的控制面板,点击deploy,接着点击dropbox,connnect to dropbox,用你注册的dropbox账号登录,把Heroku的这个app跟dropbox关联起来
f. 登录dropbox,点击应用=》Heroku,找到那个app,把前面准备好的gsnova-paas-deploy-with-dependencies-v0.29.0.tar.bz2文件夹里面的文件全部上传上去
g.重新回到heroku的那个app页面,点击deploy=>dropbox,然后转到Deploy your latest changes,随便敲几个字,再点deploy,heroku就能自动同步dropbox上传的文件并编译了,heroku能够自动识别go程序,自动 安装go编译器,自动编译程序,自动部署。

然后部署完成。
测试一下,php网址是 http://app名.herokuapp.com,如果成功,进入网址会提示如下信息:

GSnova by @yinqiwen

Welcome to use GSnova HTTP/WebSocket Server r10.1!

Code

You can clone the project with Git by running:
$ git clone https://github.com/yinqiwen/gsnova.git

然后把php网址:http://app名称.herokuapp.com,填入client.json里面运行gsnova客户端。
Heroku通过dropbox部署php go服务端到此完成!

没有评论:

发表评论