Skip to content

Commit

Permalink
📝 docs: Add midjourney-proxy setup guide (#4)
Browse files Browse the repository at this point in the history
* 📝 docs: Add guides to set up midjourney-proxy

* 📝 docs: Raname guide file name

* 📝 docs: update README to add set-up guide for midjourney-proxy
  • Loading branch information
ifsheldon committed Jan 20, 2024
1 parent 7f082b2 commit 694cc33
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ This plugin can integrate with [Midjourney](https://www.midjourney.com/)

### Deploy midjourney-proxy

This plugin relies on [midjourney-proxy](https://github.com/novicezk/midjourney-proxy/) as the provider for Midjourney services. You will need to deploy a midjourney-proxy service. Please refer to the [📘 midjourney-proxy Deployment Documentation](https://github.com/novicezk/midjourney-proxy/?tab=readme-ov-file#prerequisites) for deployment instructions.
This plugin relies on [midjourney-proxy](https://github.com/novicezk/midjourney-proxy/) as the provider for Midjourney services. You will need to deploy a midjourney-proxy service. Please refer to the [📘 midjourney-proxy Deployment Documentation](https://github.com/novicezk/midjourney-proxy/?tab=readme-ov-file#prerequisites) or [Set up Guide](./setup_midjourney_proxy/README.md) for deployment instructions.

### Standalone Use in Web

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

### 部署 midjourney-proxy

本插件基于 [midjourney-proxy](https://github.com/novicezk/midjourney-proxy/) 作为 Midjourney 服务的提供方,你需要自行部署一个 midjourney-proxy 服务。部署方法请参考 [📘 midjourney-proxy 部署文档](https://github.com/novicezk/midjourney-proxy/?tab=readme-ov-file#%E4%BD%BF%E7%94%A8%E5%89%8D%E6%8F%90)
本插件基于 [midjourney-proxy](https://github.com/novicezk/midjourney-proxy/) 作为 Midjourney 服务的提供方,你需要自行部署一个 midjourney-proxy 服务。部署方法请参考 [📘 midjourney-proxy 部署文档](https://github.com/novicezk/midjourney-proxy/?tab=readme-ov-file#%E4%BD%BF%E7%94%A8%E5%89%8D%E6%8F%90) 或者 [指南](./setup_midjourney_proxy/README.zh-CN.md)

### 在 Web 中独立使用

Expand Down
62 changes: 62 additions & 0 deletions setup_midjourney_proxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Set up `midjourney-proxy`

This is an opinionated guide to setting up `midjourney-proxy`. It is not the only way to set up Midjourney-Proxy. For
more information, please refer to [midjourney-proxy](https://github.com/novicezk/midjourney-proxy/) repo.

## Prerequisites

You need to have `docker` on you machine. Please refer
to [docker installation guide](https://docs.docker.com/get-docker/) for installation instructions.

## Steps

1. Pull the docker image from docker hub. You can check the latest version
on [docker hub](https://hub.docker.com/r/novicezk/midjourney-proxy).
```bash
$ docker pull novicezk/midjourney-proxy:2.5.5
```
2. Create a directory for `midjourney-proxy` configuration files and show the path.
```bash
$ mkdir midjourney-proxy-configs
$ cd midjourney-proxy-configs
$ pwd
/path/to/midjourney-proxy-configs
```
3. Create `application.yml` file in the directory. For example:
```yaml
mj:
task-store:
type: in_memory # OPTIONAL
timeout: 60d # OPTIONAL
translate-way: null # OPTIONAL
accounts:
- guild-id: 12345 # guild id of your discord server
channel-id: 12345 # channel id of your discord channel
user-token: abcde # user token of your discord bot
user-agent: user agent # OPTIONAL: like "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
timeout-minutes: 10 # OPTIONAL
queue-size: 15 # OPTIONAL
core-size: 5 # OPTIONAL
proxy:
host: host.docker.internal # OPTIONAL. DON'T change this if you want to use proxy in docker.
port: 12345 # OPTIONAL
```
Check [Configuration Documentation](https://github.com/novicezk/midjourney-proxy/blob/main/docs/config.md) for more
information. Check [the README](https://github.com/novicezk/midjourney-proxy/tree/main#使用前提) to learn how to get
the guild id, channel id, user token and user agent.
4. Run the docker image.
```bash
$ docker run -d --name midjourney-proxy -p 123:456 -v /path/to/midjourney-proxy-configs:/home/spring/config --add-host=host.docker.internal:host-gateway novicezk/midjourney-proxy:2.5.5
```
This will:
- publish the port 456 of the container to the port 123 of the host machine. You can change the port number as you
like.
- mount the `/path/to/midjourney-proxy-configs` directory to `/home/spring/config` directory in the container.
- add `host.docker.internal` to the container's `/etc/hosts` file. This is necessary if you want to use proxy in
docker.
5. Check the logs of the container. If everything goes well, you should see no errors or warnings in the logs.
```bash
$ docker logs midjourney-proxy
```
6. Once all the steps are done, you can check `http://<YOUR-MIDJOURNEY-PROXY-IP>:<PORT>/mj` to see all the APIs served
by `midjourney-proxy`.
57 changes: 57 additions & 0 deletions setup_midjourney_proxy/README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 设置 `midjourney-proxy`

这是设置 Midjourney-Proxy 的指南,但不是设置`midjourney-proxy`
的唯一方法。更多信息请参考 [midjourney-proxy](https://github.com/novicezk/midjourney-proxy/)仓库。

## 先决条件

你需要在你的机器上安装 `docker`。请参考 [docker 安装指南](https://docs.docker.com/get-docker/) 获取安装说明。

## 步骤

1. 从 docker hub 拉取 docker 镜像。你可以在 [docker hub](https://hub.docker.com/r/novicezk/midjourney-proxy) 查看最新版本。
```bash
$ docker pull novicezk/midjourney-proxy:2.5.5
```
2. 创建一个目录用于存放`midjourney-proxy`配置文件,并显示路径。
```bash
$ mkdir midjourney-proxy-configs
$ cd midjourney-proxy-configs
$ pwd
/path/to/midjourney-proxy-configs
```
3. 在该目录中创建 `application.yml` 文件。例如:
```yaml
mj:
task-store:
type: in_memory # 可选
timeout: 60d # 可选
translate-way: null # 可选
accounts:
- guild-id: 12345 # 你的discord服务器的guild id
channel-id: 12345 # 你的discord频道的channel id
user-token: abcde # 你的discord机器人的user token
user-agent: user agent # 可选:比如 "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
timeout-minutes: 10 # 可选
queue-size: 15 # 可选
core-size: 5 # 可选
proxy:
host: host.docker.internal # 可选。如果你想在docker中使用代理,不要更改此项。
port: 12345 # 可选
```
查看 [配置文档](https://github.com/novicezk/midjourney-proxy/blob/main/docs/config.md)
获取更多信息。查看 [README](https://github.com/novicezk/midjourney-proxy/tree/main#使用前提) 看获取 guild id, channel
id, user token 和 user agent 的方法。
4. 运行 docker 镜像。
```bash
$ docker run -d --name midjourney-proxy -p 123:456 -v /path/to/midjourney-proxy-configs:/home/spring/config --add-host=host.docker.internal:host-gateway novicezk/midjourney-proxy:2.5.5
```
这会:
- 将容器的 456 端口发布到宿主机的 123 端口。你可以根据需要更改端口号。
-`/path/to/midjourney-proxy-configs` 目录挂载到容器中的 `/home/spring/config` 目录。
- 在容器的 `/etc/hosts` 文件中添加 `host.docker.internal`。如果你想在 docker 中使用代理,这是必要的。
5. 检查容器的日志。如果一切顺利,你应该在日志中看不到错误或警告。
```bash
$ docker logs midjourney-proxy
```
6. 完成所有步骤后,你可以检查 `http://<YOUR-MIDJOURNEY-PROXY-IP>:<PORT>/mj` 来查看 `midjourney-proxy` 提供的所有 API。

0 comments on commit 694cc33

Please sign in to comment.