From df55d3a768642e5d6bcc5400ae56aec391e65155 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 6 Dec 2021 23:29:46 +0800 Subject: [PATCH] update build from source doc --- README.md | 16 ++--- doc/build-from-source.md | 60 ++++++++++++++++++- .../release-process.md} | 0 3 files changed, 62 insertions(+), 14 deletions(-) rename doc/{release.md => development/release-process.md} (100%) diff --git a/README.md b/README.md index 1e9c08371..9bb677f0e 100644 --- a/README.md +++ b/README.md @@ -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) ``` -### Install and Run from the One-click Linode StackScript: +### One-click Linode StackScript: - BBGO USDT/TWD Market Grid Trading - BBGO USDC/TWD Market Grid Trading @@ -53,19 +53,11 @@ bash <(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-gri - BBGO USDC/USDT Market Grid Trading - BBGO Standard Grid Trading -### 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) -``` -CGO_ENABLED=1 go get github.com/mattn/go-sqlite3 -``` - -Install the bbgo command: - -```sh -go install github.com/c9s/bbgo/cmd/bbgo@latest -``` +## Configuration Add your dotenv file: diff --git a/doc/build-from-source.md b/doc/build-from-source.md index e4b893879..0c2be599a 100644 --- a/doc/build-from-source.md +++ b/doc/build-from-source.md @@ -1,5 +1,14 @@ # Build From Source +Go to the Go official website to download the Go SDK . + + +Make sure your `go` is successfully installed: + +```shell +go version +``` + 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: -Install the bbgo command: +Install bbgo: ```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 ``` \ No newline at end of file diff --git a/doc/release.md b/doc/development/release-process.md similarity index 100% rename from doc/release.md rename to doc/development/release-process.md