Skip to content

Commit 1576bc7

Browse files
authored
chore: Use docker-compose to start minIO and layotto (#648)
* add docker compose * modify the minio quickstart doc * Unified naming style
1 parent f3e0110 commit 1576bc7

File tree

3 files changed

+134
-4
lines changed

3 files changed

+134
-4
lines changed
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"servers": [
3+
{
4+
"default_log_path": "stdout",
5+
"default_log_level": "DEBUG",
6+
"listeners": [
7+
{
8+
"name": "grpc",
9+
"address": "0.0.0.0:34904",
10+
"bind_port": true,
11+
"filter_chains": [
12+
{
13+
"filters": [
14+
{
15+
"type": "grpc",
16+
"config": {
17+
"server_name": "runtime",
18+
"grpc_config": {
19+
"hellos": {
20+
"quick_start_demo": {
21+
"type": "helloworld",
22+
"hello": "greeting"
23+
}
24+
},
25+
"file": {
26+
"file_demo": {
27+
"type": "minioOSS",
28+
"metadata": [
29+
{
30+
"endpoint": "minio:9000",
31+
"accessKeyID": "layotto",
32+
"accessKeySecret": "layotto_secret",
33+
"SSL":false,
34+
"region":"us-east-1"
35+
}
36+
]
37+
}
38+
}
39+
}
40+
}
41+
}
42+
]
43+
}
44+
]
45+
}
46+
]
47+
}
48+
],
49+
"pprof": {
50+
"debug": true,
51+
"port_value": 34902
52+
}
53+
}
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#Licensed to the Apache Software Foundation (ASF) under one or more
2+
#contributor license agreements. See the NOTICE file distributed with
3+
#this work for additional information regarding copyright ownership.
4+
#The ASF licenses this file to You under the Apache License, Version 2.0
5+
#(the "License"); you may not use this file except in compliance with
6+
#the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
#Unless required by applicable law or agreed to in writing, software
11+
#distributed under the License is distributed on an "AS IS" BASIS,
12+
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
#See the License for the specific language governing permissions and
14+
#limitations under the License.
15+
16+
version: '3.3'
17+
services:
18+
layotto:
19+
image: layotto/layotto:latest
20+
container_name: layotto
21+
command:
22+
- 'start'
23+
volumes:
24+
- ./config_minio.json:/runtime/configs/config.json
25+
ports:
26+
- 34904:34904
27+
- 34903:34903
28+
- 34902:34902
29+
- 34999:34999
30+
depends_on:
31+
- minio
32+
33+
minio:
34+
image: minio/minio
35+
container_name: minio
36+
environment:
37+
MINIO_ROOT_USER: layotto
38+
MINIO_ROOT_PASSWORD: layotto_secret
39+
command: server /data --console-address ':9090'
40+
ports:
41+
- 9000:9000
42+
- 9090:9090
43+
privileged: true
44+
restart: always

docs/zh/start/file/minio.md

+37-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,23 @@
44

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

7-
### 第一步:启动 MinIO 服务
7+
### step 1. 启动 MinIO 和 Layotto
8+
<!-- tabs:start -->
9+
#### **使用 Docker Compose**
10+
您可以使用 docker-compose 启动 MinIO 和 Layotto
11+
12+
```bash
13+
cd docker/layotto-minio
14+
# Start MinIO and layotto with docker-compose
15+
docker-compose up -d
16+
```
17+
18+
#### **本地编译(不适合 Windows)**
19+
您可以使用 Docker 运行 MinIO,然后本地编译、运行 Layotto。
20+
21+
> [!TIP|label: 不适合 Windows 用户]
22+
> Layotto 在 Windows 下会编译失败。建议 Windows 用户使用 docker-compose 部署
23+
#### step 1.1. 启动 MinIO 服务
824

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

18-
19-
### 第二步:启动layotto
34+
#### step 1.2. 启动layotto
2035

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

@@ -56,8 +71,9 @@ go build -o layotto
5671
```shell @background
5772
./layotto start -c ../../configs/config_file.json
5873
```
74+
<!-- tabs:end -->
5975

60-
### 第三步:启动测试demo
76+
### step 2. 启动测试demo
6177

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

@@ -79,6 +95,23 @@ go build client.go
7995
./client del test/hello/layotto.txt
8096
```
8197

98+
### step 3. 销毁容器,释放资源
99+
<!-- tabs:start -->
100+
#### **关闭 Docker Compose**
101+
如果您是用 docker-compose 启动的 MinIO 和 Layotto,可以按以下方式关闭:
102+
103+
```bash
104+
cd ${project_path}/docker/layotto-minio
105+
docker-compose stop
106+
```
107+
#### **销毁 MinIO Docker 容器**
108+
如果您是用 Docker 启动的 MinIO,可以按以下方式销毁 MinIO 容器:
109+
110+
```shell
111+
docker rm -f minio
112+
```
113+
<!-- tabs:end -->
114+
82115
#### 细节以后再说,继续体验其他API
83116
通过左侧的导航栏,继续体验别的API吧!
84117

0 commit comments

Comments
 (0)