Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新Dockerfile,完善文档 #1

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
FROM debian:10-slim
MAINTAINER libsgh
ENV TZ=Asia/Shanghai
RUN apt-get update
RUN apt-get install -y curl
FROM alpine:latest
EXPOSE 5238
WORKDIR /app
COPY run.sh /app
RUN chmod +x /app/run.sh
CMD ["/app/run.sh"]
ENTRYPOINT ["/bin/bash"]

RUN apk update && \
apk add --no-cache tzdata curl && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone && \
curl -sOL https://github.com/px-org/PanIndex/releases/latest/download/PanIndex-linux-musl-amd64.tar.gz && \
tar -xvf PanIndex-linux-musl-amd64.tar.gz -C /app && \
mv PanIndex-linux-musl-amd64 PanIndex && \
chmod +x PanIndex && \
apk del curl && \
rm PanIndex-linux-musl-amd64.tar.gz LICENSE README.md && \
rm -rf /var/cache/apk/* && \
rm -rf /tmp/*

CMD /app/PanIndex
37 changes: 22 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
# PanIndex-fly

**如果想指定版本,请在`fly.toml`配置文件中设置环境变量`PAN_INDEX_VERSION`,为空将使用Release最新版。**
## 部署

1. 安装[fly cli](https://fly.io/docs/hands-on/install-flyctl/)
1. 安装 [Flyctl](https://fly.io/docs/hands-on/install-flyctl/)
2. 注册,绑卡(已有账号请跳过)`flyctl auth signup`
3. 登录`flyctl auth login`
4. Git拉取本仓库代码`git clone https://github.com/libsgh/PanIndex-fly.git`
4. Git 拉取本仓库代码`git clone https://github.com/libsgh/PanIndex-fly.git`
5. 进入代码根目录执行`flyctl launch`
6. 按照提示,输入你的应用名称
7. 创建postgres数据库,记住`DATABAST_URL`
8. 构建完成后,会询问是否部署(deploy),这里选否,因为我们要重新设置下postgres url
9. 重新设置下DATABAST_URL
```
flyctl secrets set DATABASE_URL=<第七步记下的url>?sslmode=disable
```
10. 步骤7,8,9是解决pg ssl错误, 会在后面的版本中优化
11. 最后执行`flyctl deploy`部署,地址:https://appName.fly.dev
12. 可以绑定自己的域名,会有一个ipv4地址,cname和a应该都可以请自行尝试

### 相关
6. 输入你的应用名称(留空回车则自动生成)
7. 选择部署区域
8. 根据提示创建 Postgres 数据库,创建完成后选择连接数据库
9. 询问创建 Redis 数据库,选择`N`
10. 选择立刻部署,完成后会出现类似`https://crimson-sea-4968.fly.dev/`的访问地址

## 其他事项

- 默认部署最新版本

- 自己的域名可在应用管理面板中的`Certificates`进行绑定

- 如需使用其他数据库,则部署时取消创建 Postgres 数据库,然后使用环境变量指定数据库链接

```shell
flyctl secrests set DATABASE_URL=<数据库链接>
```

## 相关
[PanIndex](https://github.com/libsgh/PanIndex)
34 changes: 15 additions & 19 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
app = "pan-index"
app = ""
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
kill_timeout = "5s"

[env]
DB_TYPE = "postgres"
DATABASE_SSL = "false"
[experimental]
allowed_public_ports = []
auto_rollback = true

[env]
DB_TYPE = "postgres"

[[services]]
http_checks = []
protocol = "tcp"
internal_port = 5238
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"

[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
handlers = ["http"]
force_https = true

[[services.ports]]
handlers = ["tls", "http"]
port = 443
handlers = ["tls", "http"]
[services.concurrency]
type = "connections"
hard_limit = 25
soft_limit = 20

[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
timeout = "2s"
grace_period = "1s"
restart_limit = 0
timeout = "2s"
15 changes: 0 additions & 15 deletions run.sh

This file was deleted.