Skip to content

Commit

Permalink
chore: Use docker-compose to start minIO and layotto (#648)
Browse files Browse the repository at this point in the history
* add docker compose

* modify the minio quickstart doc

* Unified naming style
  • Loading branch information
bxiiiiii authored Jun 14, 2022
1 parent f3e0110 commit 1576bc7
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 4 deletions.
53 changes: 53 additions & 0 deletions docker/layotto-minio/config_minio.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"servers": [
{
"default_log_path": "stdout",
"default_log_level": "DEBUG",
"listeners": [
{
"name": "grpc",
"address": "0.0.0.0:34904",
"bind_port": true,
"filter_chains": [
{
"filters": [
{
"type": "grpc",
"config": {
"server_name": "runtime",
"grpc_config": {
"hellos": {
"quick_start_demo": {
"type": "helloworld",
"hello": "greeting"
}
},
"file": {
"file_demo": {
"type": "minioOSS",
"metadata": [
{
"endpoint": "minio:9000",
"accessKeyID": "layotto",
"accessKeySecret": "layotto_secret",
"SSL":false,
"region":"us-east-1"
}
]
}
}
}
}
}
]
}
]
}
]
}
],
"pprof": {
"debug": true,
"port_value": 34902
}
}
44 changes: 44 additions & 0 deletions docker/layotto-minio/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#Licensed to the Apache Software Foundation (ASF) under one or more
#contributor license agreements. See the NOTICE file distributed with
#this work for additional information regarding copyright ownership.
#The ASF licenses this file to You under the Apache License, Version 2.0
#(the "License"); you may not use this file except in compliance with
#the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.

version: '3.3'
services:
layotto:
image: layotto/layotto:latest
container_name: layotto
command:
- 'start'
volumes:
- ./config_minio.json:/runtime/configs/config.json
ports:
- 34904:34904
- 34903:34903
- 34902:34902
- 34999:34999
depends_on:
- minio

minio:
image: minio/minio
container_name: minio
environment:
MINIO_ROOT_USER: layotto
MINIO_ROOT_PASSWORD: layotto_secret
command: server /data --console-address ':9090'
ports:
- 9000:9000
- 9090:9090
privileged: true
restart: always
41 changes: 37 additions & 4 deletions docs/zh/start/file/minio.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,23 @@

Layotto提供了访问文件的示例 [demo](https://github.com/mosn/layotto/blob/main/demo/file/client.go) ,该示例实现了文件的增删改查操作。

### 第一步:启动 MinIO 服务
### step 1. 启动 MinIO 和 Layotto
<!-- tabs:start -->
#### **使用 Docker Compose**
您可以使用 docker-compose 启动 MinIO 和 Layotto

```bash
cd docker/layotto-minio
# Start MinIO and layotto with docker-compose
docker-compose up -d
```

#### **本地编译(不适合 Windows)**
您可以使用 Docker 运行 MinIO,然后本地编译、运行 Layotto。

> [!TIP|label: 不适合 Windows 用户]
> Layotto 在 Windows 下会编译失败。建议 Windows 用户使用 docker-compose 部署
#### step 1.1. 启动 MinIO 服务

您可以使用 Docker 启动本地MinIO服务, 参考[官方文档](http://docs.minio.org.cn/docs/master/minio-docker-quickstart-guide)
```shell
Expand All @@ -15,8 +31,7 @@ docker run -d -p 9000:9000 -p 9090:9090 --name minio \
minio/minio server /data --console-address ':9090'
```


### 第二步:启动layotto
#### step 1.2. 启动layotto

layotto提供了minio的配置文件[oss配置](https://github.com/mosn/layotto/blob/main/configs/config_file.json) ,如下所示

Expand Down Expand Up @@ -56,8 +71,9 @@ go build -o layotto
```shell @background
./layotto start -c ../../configs/config_file.json
```
<!-- tabs:end -->

### 第三步:启动测试demo
### step 2. 启动测试demo

Layotto提供了访问文件的示例 [demo](https://github.com/mosn/layotto/blob/main/demo/file/client.go)

Expand All @@ -79,6 +95,23 @@ go build client.go
./client del test/hello/layotto.txt
```

### step 3. 销毁容器,释放资源
<!-- tabs:start -->
#### **关闭 Docker Compose**
如果您是用 docker-compose 启动的 MinIO 和 Layotto,可以按以下方式关闭:

```bash
cd ${project_path}/docker/layotto-minio
docker-compose stop
```
#### **销毁 MinIO Docker 容器**
如果您是用 Docker 启动的 MinIO,可以按以下方式销毁 MinIO 容器:

```shell
docker rm -f minio
```
<!-- tabs:end -->

#### 细节以后再说,继续体验其他API
通过左侧的导航栏,继续体验别的API吧!

Expand Down

0 comments on commit 1576bc7

Please sign in to comment.