Skip to content

Commit

Permalink
Update use docker-compose to start etcd and layotto (#635)
Browse files Browse the repository at this point in the history
* Update docs/en/start/configuration/start.md

* Update docs/zh/start/sequencer/start.md

* Update docs/en/start/sequencer/start.md
  • Loading branch information
YoungMa962 committed Jun 17, 2022
1 parent 67cb53c commit 496dab3
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 9 deletions.
21 changes: 18 additions & 3 deletions docs/en/start/configuration/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,22 @@ The architecture of this demo is shown in the figure below. The processes starte
![](https://gw.alipayobjects.com/mdn/rms_5891a1/afts/img/A*dzGaSb78UCoAAAAAAAAAAAAAARQnAQ)

[Then config file](https://github.com/mosn/layotto/blob/main/configs/runtime_config.json) claims `etcd` in the `config_store` section, but users can change it to other configuration center they want (currently only support etcd and apollo).
### step 1. Deploy etcd and Layotto
<!-- tabs:start -->
#### **with Docker Compose**
You can start etcd and Layotto with docker-compose

## Start etcd
```bash
cd docker/layotto-etcd
# Start etcd and layotto with docker-compose
docker-compose up -d
```
#### **Compile locally (not for Windows)**
You can run etcd with Docker, then compile and run Layotto locally.

> [!TIP|label: Not for Windows users]
> Layotto fails to compile under Windows. Windows users are recommended to deploy using docker-compose
#### step 1.1 Start etcd
If you want to run this demo, you need to start a etcd server first.

You can download etcd from `https://github.com/etcd-io/etcd/releases` (You can also use docker.)
Expand All @@ -20,7 +34,7 @@ start it:

Then you can access etcd with the address `localhost:2379`.

## Start Layotto
#### step 1.2 Start Layotto
Build Layotto:

```shell
Expand All @@ -35,8 +49,9 @@ Run it:
```shell @background
./layotto start -c ../../configs/runtime_config.json
```
<!-- tabs:end -->

## Start client APP
### step 2. Start client APP

```shell
cd ${project_path}/demo/configuration/common
Expand Down
21 changes: 18 additions & 3 deletions docs/en/start/sequencer/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,22 @@ This example shows how to call Etcd through Layotto to generate a distributed un
The architecture of this example is shown in the figure below, and the processes started are: Etcd, Layotto, and client programs

![img.png](../../../img/sequencer/etcd/img.png)
### step 1. Deploy etcd and Layotto
<!-- tabs:start -->
#### **with Docker Compose**
You can start etcd and Layotto with docker-compose

### Step 1: Deploy the storage system (Etcd)
```bash
cd docker/layotto-etcd
# Start etcd and layotto with docker-compose
docker-compose up -d
```
#### **Compile locally (not for Windows)**
You can run etcd with Docker, then compile and run Layotto locally.

> [!TIP|label: Not for Windows users]
> Layotto fails to compile under Windows. Windows users are recommended to deploy using docker-compose
#### step 1.1 Deploy the storage system (Etcd)

For the deployment of etcd, please refer to etcd's [Official Document](https://etcd.io/docs/v3.5/quickstart/)

Expand All @@ -27,7 +41,7 @@ Once the download is finished,execute the command to start:
```

The default listening address is `localhost:2379`
### Step 2: Run Layotto
#### step 1.2 Run Layotto

After downloading the project code to the local, switch the code directory and compile:

Expand All @@ -44,8 +58,9 @@ Once finished, the layotto file will be generated in the directory, run it:
```shell @background
./layotto start -c ../../configs/runtime_config.json
```
<!-- tabs:end -->

### Step 3: Run the client program and call Layotto to generate a unique id
### step 2. Run the client program and call Layotto to generate a unique id

```shell
cd ${project_path}/demo/sequencer/common/
Expand Down
22 changes: 19 additions & 3 deletions docs/zh/start/sequencer/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,22 @@ Sequencer API支持声明对自增的需求,包括趋势递增(WEAK)和严格

![img.png](../../../img/sequencer/etcd/img.png)

### 第一步:部署存储系统(Etcd)
### step 1. 启动 etcd 和 Layotto
<!-- tabs:start -->
#### **使用 Docker Compose**
您可以使用 docker-compose 启动 etcd 和 Layotto

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

#### **本地编译(不适合 Windows)**
您可以使用 Docker 运行 etcd,然后本地编译、运行 Layotto。
> [!TIP|label: 不适合 Windows 用户]
> Layotto 在 Windows 下会编译失败。建议 Windows 用户使用 docker-compose 部署
### step 1.1:部署存储系统(Etcd)

etcd的启动方式可以参考etcd的[官方文档](https://etcd.io/docs/v3.5/quickstart/)

Expand All @@ -28,7 +43,7 @@ etcd的启动方式可以参考etcd的[官方文档](https://etcd.io/docs/v3.5/q

默认监听地址为 `localhost:2379`

### 第二步:运行Layotto
### step 1.2:运行Layotto

将项目代码下载到本地后,切换代码目录:

Expand All @@ -47,8 +62,9 @@ go build -o layotto
```shell @background
./layotto start -c ../../configs/runtime_config.json
```
<!-- tabs:end -->

### 第三步:运行客户端程序,调用Layotto生成唯一id
### step 2. 运行客户端程序,调用Layotto生成唯一id

```shell
cd ${project_path}/demo/sequencer/common/
Expand Down

0 comments on commit 496dab3

Please sign in to comment.