Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyucode committed Oct 3, 2024
1 parent d647c7b commit 999e002
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
19 changes: 12 additions & 7 deletions README.Zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ Crane 是一个使用 Rust 编写的简单、快速且安全的工具,用于

## 安装说明

Crane 会将 `.tar.gz` 文件解压到 `/dist/` 目录下。所以在使用docker时,挂在你需要部署的host目录到容器的 `/dist/` 目录下即可。

1. 使用 Docker

```bash
docker run -e API_KEY={YOUR_SUPER_SECURE_API_KEY} -p 8594:8594 -v /dist_path_on_host/:/dist/ wangyucode/crane:0.1.0
docker run -e API_KEY={YOUR_SUPER_SECURE_API_KEY} -p 8594:8594 -v /dist_path_on_host/:/dist/ wangyucode/crane:0.1.2
```

2. 使用 docker-compose

```yaml
services:
crane:
image: wangyucode/crane:0.1.0
image: wangyucode/crane:0.1.2
environment:
- API_KEY={YOUR_SUPER_SECURE_API_KEY}
ports:
Expand All @@ -39,7 +40,7 @@ services:
- /dist_path_on_host/:/dist/
```
3. 使用二进制文件
3. 从源码构建
```
git clone https://github.com/wangyucode/crane
cargo build --release
Expand All @@ -50,7 +51,7 @@ cargo build --release
## 使用方法

```bash
curl -H "X-Api-Key: {YOUR_SUPER_SECURE_API_KEY}" http://{your_server_address}:8594/?url=https://example.com/file.tar.gz
curl -H "X-Api-Key: {YOUR_SUPER_SECURE_API_KEY}" http://{your_server_address}:8594/deploy?url=https://example.com/file.tar.gz
```

因此,您可以在 CI/CD 管道中使用它。
Expand All @@ -64,13 +65,17 @@ jobs:
...
- name: use Crane to deploy
run: |
curl -H "X-Api-Key: ${{secrets.CRANE_API_KEY}}" http://${secrets.SERVER_ADDRESS}:8594/?url=https://github.com/your-repo/your-repo/releases/download/v1.0.0/dist.tar.gz
curl -H "X-Api-Key: ${{secrets.CRANE_API_KEY}}" http://${secrets.SERVER_ADDRESS}:8594/deploy?url=https://github.com/your-repo/your-repo/releases/download/v1.0.0/dist.tar.gz
...
```

> **Waring**: 警告: API_KEY 是必需的,如果未设置,Crane 将无法启动。请将使用强密码
> **Waring**: 警告: `API_KEY` 是必需的,如果未设置,Crane 将无法启动。请使用强密码
## 路线图

- [ ] 当新的部署被触发时,取消上一个部署
- [ ] 支持选项,覆盖标志
- [ ] 支持选项,覆盖标志

## 其它选项

如果你正在寻找一个github actions, 来使用服务器密钥通过 `sftp` 部署文件,你可以尝试 [wangyucode/sftp-upload-action](https://github.com/wangyucode/sftp-upload-action)
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Crane - Fast and Secure .tar.gz Deployment
<div align="center">
<img src="logo.jpg" width=256></img>
<p><strong>Crane - Fast and Secure .tar.gz Deployment</strong></p>

![Crane](logo.jpg)
English | [简体中文](README_Zh-CN.md)

English | [简体中文](README_Zh-CN.md)
</div>

Crane is a simple, fast, and secure tool write in Rust for downloading and deploying your `.tar.gz` archive files without the need for server passwords or keys. It was designed to provide a quick and convenient way to deploy your software or files to a server without the usual complexities of authentication and authorization.

Expand All @@ -15,18 +17,20 @@ Crane is a simple, fast, and secure tool write in Rust for downloading and deplo

## Installation

Crane will decompress the `.tar.gz` file to the `/dist/` directory. So when using Docker, just mount the host directory you want to deploy to the `/dist/` directory of the container.

1. use Docker

```bash
docker run -e API_KEY={YOUR_SUPER_SECURE_API_KEY} -p 8594:8594 -v /dist_path_on_host/:/dist/ wangyucode/crane:0.1.0
docker run -e API_KEY={YOUR_SUPER_SECURE_API_KEY} -p 8594:8594 -v /dist_path_on_host/:/dist/ wangyucode/crane:0.1.2
```

2. use docker-compose

```yaml
services:
crane:
image: wangyucode/crane:0.1.0
image: wangyucode/crane:0.1.2
environment:
- API_KEY={YOUR_SUPER_SECURE_API_KEY}
ports:
Expand All @@ -46,7 +50,7 @@ cargo build --release
## Usage

```bash
curl -H "X-Api-Key: {YOUR_SUPER_SECURE_API_KEY}" http://{your_server_address}:8594/?url=https://example.com/file.tar.gz
curl -H "X-Api-Key: {YOUR_SUPER_SECURE_API_KEY}" http://{your_server_address}:8594/deploy?url=https://example.com/file.tar.gz
```

so you can use it in your CI/CD pipeline.
Expand All @@ -60,7 +64,7 @@ jobs:
...
- name: use Crane to deploy
run: |
curl -H "X-Api-Key: ${{secrets.CRANE_API_KEY}}" http://${secrets.SERVER_ADDRESS}:8594/?url=https://github.com/your-repo/your-repo/releases/download/v1.0.0/dist.tar.gz
curl -H "X-Api-Key: ${{secrets.CRANE_API_KEY}}" http://${secrets.SERVER_ADDRESS}:8594/deploy?url=https://github.com/your-repo/your-repo/releases/download/v1.0.0/dist.tar.gz
...
```

Expand All @@ -70,3 +74,7 @@ jobs:

- [ ] Cancel last deployment when new deployment is triggered.
- [ ] Support options, override flag.

## Other Options

If you're looking for a GitHub action to deploy files via `sftp` using server keys, you can try [wangyucode/sftp-upload-action](https://github.com/wangyucode/sftp-upload-action)

0 comments on commit 999e002

Please sign in to comment.