Ramin
Ramin
RRailway
Created by Ramin on 7/18/2024 in #✋|help
How best to configure Railway services for coast to coast (us-east & us-west) load balancing?
We currently have a Railway project with an Express API service hosted on US East (Virginia, USA) region. This service also has 3 replicas. We are thinking of spinning up a duplicate setup, but on the US West (Oregon, USA) region. What is the best way to configure this? Is it as simple as creating a new service and pointing it to the same GH repo? But instead of selecting US East as the region, select US West? We have most of this config in a railway.json file.. so I am thinking we will probably need a railway-us-east.json and railway-us-west.json config file, right? And then I would imagine we need some new domains, ie us-east-api.service.com and us-west-api.service.com ... and finally a load balancer like Cloudflare to direct traffic accordingly based on geo. Am I missing anything?
16 replies
RRailway
Created by Ramin on 6/24/2024 in #✋|help
dashboard keeps showing 404 during normal use
I am trying to add a shared variable and every time I open up the "production" environment to add my shared ENV var, the whole dashboard displays the 404 page. I see a lot of (38) errors in the web console .. having to do with CORS policy. Not sure if related.
variables:1 Access to fetch at 'https://backboard.railway.app/graphql/internal?q=variables' from origin 'https://railway.app' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
variables:1 Access to fetch at 'https://backboard.railway.app/graphql/internal?q=variables' from origin 'https://railway.app' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I also see tons of requests being constantly made to https://backboard.railway.app/graphql/internal?q=eventBatchTrack .. most succeed, but some fail. and as soon as I attempt to enter a new shared ENV var, I see a bunch of failed requests to that url and the 404 page shows. I'll record a Loom and attach to this ticket.
11 replies
RRailway
Created by Ramin on 5/28/2024 in #✋|help
has anyone successfully deployed a node+express server using bun+pm2 on Railway?
have a bun+express server running and trying to incorporate pm2 into the mix. I am able to get it working locally, but when I try to push the changes to Railway, it does not want to play nice. This is what I see in the Railway Deploy Logs:
$ turbo run start --filter={apps/api} --log-prefix=none
• Packages in scope: api
• Running start in 1 packages
• Remote caching disabled
cache bypass, force executing b341b82a7158b9fd
$ pm2 start ecosystem.config.js
[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2 I/O] Using: Public key: ********** | Private key: ********* | Machine name: railway-1a6d
[PM2] PM2 Successfully daemonized
[PM2][WARN] Applications api not running, starting...
[PM2] App [api] launched (1 instances)
┌────┬────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ api │ default │ 0.0.0 │ fork │ 120 │ 0s │ 0 │ online │ 0% │ 69.7mb │ root │ disabled │
└────┴────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Tasks: 1 successful, 1 total
Cached: 0 cached, 1 total
Time: 5.505s
$ turbo run start --filter={apps/api} --log-prefix=none
• Packages in scope: api
• Running start in 1 packages
• Remote caching disabled
cache bypass, force executing b341b82a7158b9fd
$ pm2 start ecosystem.config.js
[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2 I/O] Using: Public key: ********** | Private key: ********* | Machine name: railway-1a6d
[PM2] PM2 Successfully daemonized
[PM2][WARN] Applications api not running, starting...
[PM2] App [api] launched (1 instances)
┌────┬────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ api │ default │ 0.0.0 │ fork │ 120 │ 0s │ 0 │ online │ 0% │ 69.7mb │ root │ disabled │
└────┴────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Tasks: 1 successful, 1 total
Cached: 0 cached, 1 total
Time: 5.505s
The contents of my ecosystem.config.js
module.exports = {
apps: [
{
name: 'api',
script: './dist/api',
max_memory_restart: '2G',
max_restarts: 5,
min_uptime: 10000, // 10s
},
],
}
module.exports = {
apps: [
{
name: 'api',
script: './dist/api',
max_memory_restart: '2G',
max_restarts: 5,
min_uptime: 10000, // 10s
},
],
}
My api package.json build and start commands:
"scripts": {
"build": "bun build --compile --sourcemap --target node ./src/index.ts --outfile dist/api",
"start": "pm2 start ecosystem.config.js",
},
"scripts": {
"build": "bun build --compile --sourcemap --target node ./src/index.ts --outfile dist/api",
"start": "pm2 start ecosystem.config.js",
},
25 replies