Skip to content

Commit

Permalink
Merge pull request apache#370 from phial3/develop
Browse files Browse the repository at this point in the history
add docker example in readme
  • Loading branch information
AlexStocks authored Feb 28, 2022
2 parents 2c973f6 + b2ae112 commit 19fa124
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 8 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ image:
-t apache/$(targetName):latest \
-t apache/$(targetName):$(VERSION) \
--build-arg build=$(BUILD) --build-arg version=$(VERSION) \
-f Dockerfile --no-cache .
-f Dockerfile --no-cache --platform linux/amd64 .

test:
sh before_ut.sh
go test ./pkg/... -coverprofile=coverage.txt -covermode=atomic

integrate-test:
sh start_integrate_test.sh
sh start_integrate_test.sh

clean:
@rm -rf ./dubbo-go-pixiu
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ It supports **HTTP-to-Dubbo** and **HTTP-to-HTTP** proxy and more protocols will
#### cd samples dir

```
cd samples/dubbo/simple
cd samples/dubbogo/simple
```

we can use start.sh to run samples quickly. for more info, execute command as below for more help
Expand Down Expand Up @@ -55,7 +55,7 @@ if prepare config file manually, notice:
if run pixiu manually, use command as below

```
go run cmd/pixiu/*.go gateway start -c /[absolute-path]/dubbo-go-pixiu/samples/dubbo/simple/body/pixiu/conf.yaml
go run cmd/pixiu/*.go gateway start -c /[absolute-path]/dubbo-go-pixiu/samples/dubbogo/simple/body/pixiu/conf.yaml
```


Expand All @@ -74,6 +74,35 @@ curl -X POST 'localhost:8881/api/v1/test-dubbo/user' -d '{"id":"0003","code":3,"
./start.sh clean body
```

## Start Docker

####
```shell
docker pull phial3/dubbo-go-pixiu:latest
```
```
docker run --name pixiuname -p 8883:8883 \
-v /yourpath/conf.yaml:/etc/pixiu/conf.yaml \
-v /yourpath/log.yml:/etc/pixiu/log.yml \
apache/dubbo-go-pixiu:latest
```
#### http to dubbo samples
start provider, zookeeper be used register center.
```shell
cd samples/dubbogo/simple/resolve/server

export DUBBO_GO_CONFIG_PATH="../profiles/dev/server.yml"
export APP_LOG_CONF_FILE="../profiles/dev/log.yml"

go run server.go user.go
```
start http request
```shell
cd samples/dubbogo/simple/resolve/test

go test pixiu_test.go
```

## Features

- You can customize your own dubbo-go-pixiu with plugin.
Expand Down
34 changes: 32 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Dubbo-Go-Pixiu 网关支持调用Java的dubbo集群和golang的dubbo-go集群。
#### 进入示例代码目录

```
cd samples/dubbo/simple
cd samples/dubbogo/simple
```

可以使用 start.sh 脚本快速启动案例项目,可以执行如下命令来获得更多信息
Expand Down Expand Up @@ -54,7 +54,7 @@ cd samples/dubbo/simple
可以使用下列命令来手动启动 pixiu

```
go run cmd/pixiu/*.go gateway start -c /[absolute-path]/dubbo-go-pixiu/samples/dubbo/simple/body/pixiu/conf.yaml
go run cmd/pixiu/*.go gateway start -c /[absolute-path]/dubbo-go-pixiu/samples/dubbogo/simple/body/pixiu/conf.yaml
```


Expand All @@ -73,6 +73,36 @@ curl -X POST 'localhost:8881/api/v1/test-dubbo/user' -d '{"id":"0003","code":3,"
./start.sh clean body
```


## docker启动示例

####
```shell
docker pull phial3/dubbo-go-pixiu:latest
```
```
docker run --name pixiuname -p 8883:8883 \
-v /yourpath/conf.yaml:/etc/pixiu/conf.yaml \
-v /yourpath/log.yml:/etc/pixiu/log.yml \
apache/dubbo-go-pixiu:latest
```
#### http请求调用dubbo服务转换
首先启动provider,这里使用zookeeper作为注册中心
```shell
cd samples/dubbogo/simple/resolve/server

export DUBBO_GO_CONFIG_PATH="../profiles/dev/server.yml"
export APP_LOG_CONF_FILE="../profiles/dev/log.yml"

go run server.go user.go
```
进入到test目录下,启动test示例
```shell
cd samples/dubbogo/simple/resolve/test

go test pixiu_test.go
```

## 特性

- 多协议支持
Expand Down
4 changes: 2 additions & 2 deletions samples/dubbogo/simple/resolve/server/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const Version = "2.7.5"
var survivalTimeout = int(3e9)

// they are necessary:
// export CONF_PROVIDER_FILE_PATH="xxx"
// export APP_LOG_CONF_FILE="xxx"
// export DUBBO_GO_CONFIG_PATH="../profiles/dev/server.yml"
// export APP_LOG_CONF_FILE="../profiles/dev/log.yml"
func main() {
config.Load()
logger.Infof("dubbo version is: %s", Version)
Expand Down

0 comments on commit 19fa124

Please sign in to comment.