Skip to content

Commit

Permalink
doc: add instructions for pika docker image (OpenAtomFoundation#1557)
Browse files Browse the repository at this point in the history
* doc: add docker Dockerization info on readme

* doc: doc: add docker Dockerization info on readme_cn

* doc: make the readme more

* doc: make doc works better
  • Loading branch information
machinly authored May 28, 2023
1 parent 83cad14 commit 47a7e64
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 2 deletions.
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ By default the compilation process is in 'release' mode. If you wanna debug this
```
rm -fr output
cmake -B output -DCMAKE_BUILD_TYPE=Debug
cd ouput && make
cd output && make
```

## Usage
Expand All @@ -139,6 +139,47 @@ By default the compilation process is in 'release' mode. If you wanna debug this
2. exec `rm -fr output` rebuild cmake (for complete recompilation)
```

## Dockerization

### Run with docker

```bash
docker run -d \
--restart=always \
-p 9221:9221 \
-v <log_dir>:/pika/log \
-v <db_dir>:/pika/db \
-v <dump_dir>:/pika/dump \
-v <dbsync_dir>:/pika/dbsync \
pikadb/pika:v3.3.6

redis-cli -p 9221 "info"

```

Meaning of dirs:
- log_dir: Directory to store log files of Pika.
- db_dir: Directory to store the data of Pika.
- dump_dir: Directory to stored dump files that generated by command "bgsave".
- dbsync_dir: Pika db sync path.


### Build Image
If you want to build the image yourself, we have provided a script `build_docker.sh` to simplify this process.

The script accepts several optional arguments:

- `-t tag`: Specify the Docker tag for the image. By default, the tag is `pikadb/pika:<git tag>`.
- `-p platform`: Specify the platform for the Docker image. By default is current docker's platform. `all`, `linux/amd64`, `linux/arm`, `linux/arm64`.
- `--proxy`: Use a proxy to download packages to speed up the build process. This is particularly useful if you are in China.
- `--help`: Display help information.

Here is an example usage of the script:

```bash
./build_docker.sh -p linux/amd64 -t private_registry/pika:latest
```

## Performance

More details on [Performance](docs/benchmark/performance.md).
Expand Down
35 changes: 34 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pika 默认使用`release`模式编译,不能调试,如果需要调试,需
```
rm -fr output
cmake -B output -DCMAKE_BUILD_TYPE=Debug
cd ouput && make
cd output && make
```

## 使用
Expand All @@ -126,6 +126,39 @@ pika 默认使用`release`模式编译,不能调试,如果需要调试,需
2. 执行 rm -fr output 重新生成cmkae(一般用于彻底重新编译)
```

## 容器化

### 使用docker运行

```bash
docker run -d \
--restart=always \
-p 9221:9221 \
-v <log_dir>:/pika/log \
-v <db_dir>:/pika/db \
-v <dump_dir>:/pika/dump \
-v <dbsync_dir>:/pika/dbsync \
pikadb/pika:v3.3.6

redis-cli -p 9221 "info"
```

### 构建镜像
如果你想自己构建镜像,我们提供了一个脚本 `build_docker.sh` 来简化这个过程。

脚本接受几个可选参数:

- `-t tag`: 指定镜像的Docker标签。默认情况下,标签是 `pikadb/pika:<git tag>`
- `-p platform`: 指定Docker镜像的平台。默认使用当前 docker 的 platform 设置 `all`, `linux/amd64`, `linux/arm`, `linux/arm64`.
- `--proxy`: 使用代理下载 package 以加快构建过程,构建时会使用阿里云的镜像源。
- `--help`: 显示帮助信息。

这是脚本的一个示例使用:

```bash
./build_docker.sh -p linux/amd64 -t private_registry/pika:latest
```

## 性能 (感谢[deep011](https://github.com/deep011)提供性能测试结果)
### 注!!!
本测试结果是在特定环境特定场景下得出的,不能够代表所有环境及场景下的表现,__仅供参考__
Expand Down

0 comments on commit 47a7e64

Please sign in to comment.