Skip to content

Commit

Permalink
完善railway文档
Browse files Browse the repository at this point in the history
  • Loading branch information
zhukai committed Jun 11, 2023
1 parent fc4adb5 commit 9e538e6
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 37 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ RUN groupadd -g 1000 ${group} \
&& mkdir -p $SPRING_HOME/logs \
&& chown -R ${user}:${group} $SPRING_HOME/config $SPRING_HOME/logs

# Railway 不支持使用 VOLUME, 本地需要构建时,取消下一行的注释
# VOLUME ["$SPRING_HOME/config", "$SPRING_HOME/logs"]

USER ${user}
WORKDIR $SPRING_HOME

Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@
- [ ] 修复相关Bug,[Wiki / 已知问题](https://github.com/novicezk/midjourney-proxy/wiki/%E5%B7%B2%E7%9F%A5%E9%97%AE%E9%A2%98)

## 使用前提
1. 科学上网
2. docker环境
3. 注册 MidJourney,创建自己的频道,参考 https://docs.midjourney.com/docs/quick-start
4. 获取用户Token、服务器ID、频道ID:[获取方式](./docs/discord-params.md)
1. 注册 MidJourney,创建自己的频道,参考 https://docs.midjourney.com/docs/quick-start
2. 获取用户Token、服务器ID、频道ID:[获取方式](./docs/discord-params.md)

## 风险须知
1. 作图频繁等行为,触发midjourney验证码后,需尽快人工验证
2. 默认使用user-wss方式,可以获取midjourney的错误信息、图片变换进度等,但可能会增加账号风险
3. 支持设置mj.discord.user-wss为false,使用bot-token连接wss,需添加自定义机器人:[流程说明](./docs/discord-bot.md)

## 快速启动
## Railway 部署
基于Railway平台免费部署,不需要自己的服务器: [部署方式](./docs/railway-start.md)

## Docker 部署
1. /xxx/xxx/config目录下创建 application.yml(mj配置项)、banned-words.txt(可选,覆盖默认的敏感词文件);参考src/main/resources下的文件
2. 启动容器,映射config目录
```shell
Expand Down Expand Up @@ -81,7 +82,7 @@ docker run -d --name midjourney-proxy \
- 依赖java17和maven
- 更改配置项: 修改src/main/application.yml
- 项目运行: 启动ProxyApplication的main函数
- 更改代码后,构建镜像: `docker build . -t midjourney-proxy`
- 更改代码后,构建镜像: Dockerfile取消VOLUME的注释,执行 `docker build . -t midjourney-proxy`

## 应用项目
- [wechat-midjourney](https://github.com/novicezk/wechat-midjourney) : 代理微信客户端,接入MidJourney,仅示例应用场景,不再更新
Expand Down
59 changes: 28 additions & 31 deletions docs/railway-start.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
## Railway 部署教程

### 0. Railway是什么
Railway是一个提供了弹性部署方案的平台,基于Dockerfile可以方便地一键部署。而且服务就架设在海外,方便了Midjourney的调用。

### 1. fork仓库
理论上直接用公开仓库的网址就可以,但是实测发现,如果直接用原仓库而不是自己的仓库,Railway可能会识别不到Dockerfile。

### 2. Railway绑定Github

可以直接用Github账号登录Railway

新建一个Project,然后添加Railway对Github刚才fork的仓库的权限

![image-20230610210512637](./railway1.png)

### 3. Start the Service

进入刚才的Project,它应该已经在自动deploy了。这里先别管它的deploy,我们还需要配置变量。

要配置bot-token,channel-id等容器要求的变量,注意这里还需要配置`PORT`为8080,和docker内设置的一致。

配置之后会自动redeploy

![image-20230610211543718](./railway2.png)

### 4. Enjoy

基于docker启动的应该没什么问题,然后在这里配置网址,之后就可以通过这个网址访问啦。比如

`https://midjourney-proxy-***.app/mj`

![image-20230610211055608](./railway3.png)
### 1. Railway是什么
Railway是一个提供了弹性部署方案的平台,支持免费部署。而且服务就架设在海外,方便了Midjourney的调用。

### 2. Fork本仓库
### 3. Railway使用github账号登录
进入 [railway官网](https://railway.app) 选择 `Login` -> `Github`,登录github账号

### 4. [New Project](https://railway.app/new) 添加对fork仓库的授权
![railway_img_1](./railway_img_1.png)
![railway_img_2](./railway_img_2.png)
![railway_img_3](./railway_img_3.png)

### 5. 选择该fork仓库,新建项目,设置环境变量
![railway_img_4](./railway_img_4.png)
![railway_img_5](./railway_img_5.png)
![railway_img_6](./railway_img_6.png)
![railway_img_7](./railway_img_7.png)
此处配置项参考 [Wiki / 配置项](https://github.com/novicezk/midjourney-proxy/wiki/%E9%85%8D%E7%BD%AE%E9%A1%B9) ,建议配置api密钥启用鉴权,接口调用时需添加请求头 `mj-api-secret`

### 6. 启动服务
进入刚才的Project,它应该已经在自动部署了。后续更新配置之后会自动重新部署
![railway_img_8](./railway_img_8.png)

### 7. 开始使用
等待部署成功后,配置网址
![railway_img_9](./railway_img_9.png)

访问 `https://midjourney-proxy-***.app/mj`
Binary file removed docs/railway1.png
Binary file not shown.
Binary file added docs/railway_img_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/railway_img_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/railway_img_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/railway_img_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/railway_img_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/railway_img_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/railway_img_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes

0 comments on commit 9e538e6

Please sign in to comment.