我有一个Next.js项目与Pocketbase作为其后端。该项目在localhost上运行良好,但当我上传到服务器时,两件事之一出错。或者:
- Next JS工作,但Pocketbase不工作(在Vercel上),或者
1.前端不工作,所以我不能判断Pocketbase是否工作。Fly.io
P.S.以下是我的docker和fly.toml文件: - Docker:
# 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
我尝试在上传项目到www.example.com之前集成docker并编辑fly.toml文件fly.io,但没有成功。
1条答案
按热度按时间tvokkenx1#
你需要把pocketbase托管在一个类似VPS的地方。Vercel正在托管您的Next.js应用程序,仅此而已。