我有一个以Pocketbase为后端的Next JS项目。项目在本地主机上运行良好,但当我上传到服务器时,有两件事会出错。:
- Next JS工作,但Pocketbase不(在Vercel上),或
- 前端不工作,所以我不能告诉是否Pocketbase工作。(on Fly.io)
注:这是我的码头和飞机。toml文件:
- 码头工人:
# Install dependencies only when needed
FROM node:16-alpine AS deps
#RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json ./
RUN apk add --no-cache
unzip
ca-certificates
RUN npm install
COPY . .
# RUN yarn build
RUN npm run dev
#RUN pocketbase serve
EXPOSE 3000
ENV PORT 3000
CMD ["/pocketbase", "serve"]
- fly.toml:
# fly.toml file generated for ebesa on 2023-04-05T20:15:31+03:00
app = "ebesa"
kill_signal = "SIGINT"
kill_timeout = 5
primary_region = "lax"
[experimental]
auto_rollback = true
[build]
[build.args]
PB_VERSION = "0.7.7"
[env]
PORT = "3000"
[mounts]
source = "pb_data"
destination = "/pb_data"
[[services]]
protocol = "tcp"
internal_port = 3000
processes = ["app"]
[[services.ports]]
port = 80
handlers = ["http"]
force_https = true
[[services.ports]]
port = 443
handlers = ["tls", "http"]
[services.concurrency]
type = "connections"
hard_limit = 25
soft_limit = 20
[[services.tcp_checks]]
interval = "15s"
timeout = "2s"
grace_period = "1s"
restart_limit = 0
我尝试集成docker和编辑fly。Toml文件上传到飞行项目之前。
你需要在像VPS这样的地方托管pocketbase。Vercel正在托管您的Next.js应用程序,不多不少。