9 months ago
projectID: 171d055d-0855-415c-8f03-8b52fb322141
Hey, I am getting 502 bad gateway for my sveltekit application, I am using node adaptor.
I believe I followed all instructions as in https://railway.app/template/cf-tunnel
only place I think there is chance of not working out is IPV6 but still not sure as added --host ::
for running
dockerfile```# Build stage
FROM node:lts-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
ENV
ARG GOOGLECLIENTID
ENV VITEGOOGLECLIENTID=${GOOGLECLIENT_ID}
… other env removed because of word limit of post
RUN npm run build
RUN npx drizzle-kit generate
Remove source files and keep only the built app and necessary runtime files
RUN rm -rf src tests scripts && \
npm prune --production
Production stage
FROM node:lts-alpine
A small line inside the image to show who made it
LABEL Developers="Suryapratap-R"
ENV NODEENV=production RUN addgroup -S nodegroup && adduser -S nodeuser -G nodegroup WORKDIR /app COPY --from=builder /app/build ./build COPY --from=builder /app/nodemodules ./node_modules
COPY --from=builder /app/package.json ./package.json
Copy Drizzle migration files if needed
COPY --from=builder /app/migrations ./migrations
RUN chown -R nodeuser:nodegroup /app
USER nodeuser
Expose both development and production ports
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD node -e "require('http').request('http://localhost:3000/healthz', (r) => {if (r.statusCode !== 200) throw new Error()})"
CMD ["sh", "-c", "sleep 3 && node build --host :: --port 3000"]```
my site is https://faqsense.com/ if thats relevant.
0 Replies
9 months ago
any reason you are using the tunnel to begin with?
9 months ago
why not just put your domain behind cloudflare
I thought this is recommended setup, seen it on web dev cody's channel on youtube
9 months ago
massively overcomplex, simply add your custom domain to your service
please do let me know if this is not required / recommended way to do this.
9 months ago
its not required for your usecase