jimmy
jimmy
RRailway
Created by jimmy on 8/14/2024 in #✋|help
Cloudflare Tunnel with Postgres DB
@Brody thanks very much i didnt know about tailscale! That is exactly what i need. Do you think cloudflare tunnels and tailscale play well together?
13 replies
RRailway
Created by jimmy on 8/14/2024 in #✋|help
Cloudflare Tunnel with Postgres DB
@Dane thanks for the hint, unfortunately just using postgres:5432 in the public hostname configuration does not work. Also i don't see how Cloudflare WARP can help me out on this. All i need is just to access the db hosted on Railway without exposing it to the public, it seems i can't find a solution to this 😭
13 replies
RRailway
Created by jimmy on 8/14/2024 in #✋|help
Cloudflare Tunnel with Postgres DB
N/A
13 replies
RRailway
Created by jimmy on 4/29/2023 in #✋|help
Github Actions deploy - Show build logs
project ID: f1160a79-f9d7-4c6b-8101-2a878b87e3be
4 replies
RRailway
Created by jimmy on 9/14/2022 in #✋|help
React + Vite + React Router - 404 on page reload.
basically the fix for the issue you have is that nginx does not resolves the reload path and you are required to change the server configuration for nginx. unfortunately this is not something Railway supports (for now). the fix is to wrap the whole react app withing a docker container and run nginx into that container. STEP 1: Create a Dockerfile at the root of your project and add in it the following code:
FROM node:14-alpine AS builder

ARG API_URL
ARG COGNITO_REGION
ARG COGNITO_USER_POOL_ID
ARG COGNITO_WEB_CLIENT_ID

# Add a work directory
WORKDIR /app

COPY package.json .

RUN yarn install

COPY . /app/

RUN yarn build

FROM nginx:alpine

# Set working directory to nginx asset directory
WORKDIR /usr/share/nginx/html

# Remove default nginx static assets
RUN rm -rf ./*

COPY --from=builder /app/dist .

COPY .nginx/nginx.conf /etc/nginx/conf.d/default.conf

ENTRYPOINT ["nginx", "-g", "daemon off;"]
FROM node:14-alpine AS builder

ARG API_URL
ARG COGNITO_REGION
ARG COGNITO_USER_POOL_ID
ARG COGNITO_WEB_CLIENT_ID

# Add a work directory
WORKDIR /app

COPY package.json .

RUN yarn install

COPY . /app/

RUN yarn build

FROM nginx:alpine

# Set working directory to nginx asset directory
WORKDIR /usr/share/nginx/html

# Remove default nginx static assets
RUN rm -rf ./*

COPY --from=builder /app/dist .

COPY .nginx/nginx.conf /etc/nginx/conf.d/default.conf

ENTRYPOINT ["nginx", "-g", "daemon off;"]
Replace those ARG with your env variables and if you use npm replace where im using yarn STEP 2: Create .nginx/nginx.conf file at the root of your project and add the following code:
server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
}
server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
}
STEP 3: Add a .dockerignore file at the root of your project and add the following code:
node_modules
node_modules
then all you have to do is to push repo to master and trigger deploy on Railway and the builder will automatically detect you have a Dockerfile at the root of your project and will run the app with it. Make sure to remove from Railway UI any start command (leave it empty). NOTE: if you have setup a PORT env variable in Railway UI please change the value to 80 so it matches with your nginx config file. And it should work fine!
7 replies