update build from source doc

This commit is contained in:
c9s 2021-12-06 23:29:46 +08:00
parent 92b4375481
commit df55d3a768
3 changed files with 62 additions and 14 deletions

View File

@ -45,7 +45,7 @@ The following script will help you set up a config file, dotenv file:
bash <(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-grid.sh) bash <(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-grid.sh)
``` ```
### Install and Run from the One-click Linode StackScript: ### One-click Linode StackScript:
- BBGO USDT/TWD Market Grid Trading <https://cloud.linode.com/stackscripts/793380> - BBGO USDT/TWD Market Grid Trading <https://cloud.linode.com/stackscripts/793380>
- BBGO USDC/TWD Market Grid Trading <https://cloud.linode.com/stackscripts/797776> - BBGO USDC/TWD Market Grid Trading <https://cloud.linode.com/stackscripts/797776>
@ -53,19 +53,11 @@ bash <(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-gri
- BBGO USDC/USDT Market Grid Trading <https://cloud.linode.com/stackscripts/797777> - BBGO USDC/USDT Market Grid Trading <https://cloud.linode.com/stackscripts/797777>
- BBGO Standard Grid Trading <https://cloud.linode.com/stackscripts/795788> - BBGO Standard Grid Trading <https://cloud.linode.com/stackscripts/795788>
### Install from source ### Build from source
If you need to use go-sqlite, you will need to enable CGO first: See [Build from source](./doc/build-from-source.md)
``` ## Configuration
CGO_ENABLED=1 go get github.com/mattn/go-sqlite3
```
Install the bbgo command:
```sh
go install github.com/c9s/bbgo/cmd/bbgo@latest
```
Add your dotenv file: Add your dotenv file:

View File

@ -1,5 +1,14 @@
# Build From Source # Build From Source
Go to the Go official website to download the Go SDK <https://go.dev/dl/>.
Make sure your `go` is successfully installed:
```shell
go version
```
If you need to use go-sqlite, you will need to enable CGO first: If you need to use go-sqlite, you will need to enable CGO first:
``` ```
@ -8,8 +17,55 @@ CGO_ENABLED=1 go get github.com/mattn/go-sqlite3
If you prefer to put go related binary in your HOME directory: If you prefer to put go related binary in your HOME directory:
Install the bbgo command: Install bbgo:
```sh ```sh
go get github.com/c9s/bbgo/cmd/bbgo@latest go install github.com/c9s/bbgo/cmd/bbgo@latest
```
Your binary will be installed into the default GOPATH `~/go/bin`.
You can add the bin path to your PATH env var by adding the following code to your `~/.zshrc` or `~/.bashrc`:
```shell
export PATH=~/go/bin:$PATH
```
And then, check the version, it should be `1.x-dev`:
```shell
bbgo version
```
If not, try running `ls -lh ~/go/bin/bbgo` to see if the binary is installed.
If it's already there, it means your PATH is misconfigured.
If you prefer other place for installing the go related binaries, you can set GOPATH to somewhere else, e.g.
```shell
export GOPATH=~/mygo
```
Then your bbgo will be installed at `~/mygo/bin/bbgo`.
## Alpine
Starts a docker container with the alpine image:
```shell
docker run -it --rm alpine
```
Run the following command to install the dependencies:
```shell
apk add git go gcc libc-dev sqlite
export CGO_ENABLED=1
go get github.com/mattn/go-sqlite3
go install github.com/c9s/bbgo/cmd/bbgo@latest
```
Your installed bbgo binary will be located in:
```
/root/go/bin/bbgo version
``` ```