2 years ago
I am trying to deploy (1 node, and 1 go) service.
And I have aDockerfile for deploying the Node service.
But, now the go service is also using the same Dockerfile.
I prefer to use the Config As Code option, instead of using UI settings.
24 Replies
2 years ago
I saw the railway.json option, my question is that can I have two of them.
One for node and other for go service?
2 years ago
Project ID: 8fc2ad89-714b-4cb3-9778-cb64d1373409
2 years ago
you can have two yes, but first can you tell me about your file structure?
2 years ago
It's kind of messy structure, as of now.
/app
// all go code
/src
// all node code
/package.json
/pnpm-lock.yaml
/DockerfileDid I missed any file, which needs to be mentioned?
2 years ago
looks easy enough to deploy, do you already have two blank railway services
2 years ago
I have a node service already running on prod.
Now, I am trying to add a go service.
2 years ago
and that Dockerfile, that's for the go app right? it has nothing to do with node?
2 years ago
That Dockerfile is for the node
2 years ago
do you have a dockerfile for the go app, or are you going to let nixpacks try and build it?
2 years ago
It would be nice to use Docker.
2 years ago
What I can try is to have two railway.json file.
For example
railway.node.jsonin (src directory)railway.go.jsonin (app directory)
Will something like this work? Just a rough idea 🤷♂️
2 years ago
yes it can work, but I don't currently see a need for the difference of names, but one thing at a time here.
do you have a Dockerfile for the go app? or have you yet to write one?
2 years ago
I have yet to write one
2 years ago
in the mean time, do you think nixpacks would be able to build your go app?
2 years ago
I was able to run 2 different services from single repo, using railway.json file.
Thanks for the help. 🙂
2 years ago
no problem!
2 years ago
Continuing on the same ticket.
Now, I ran into similar issue. Where I have set the app sleep to disable for production, but how can I enable it for non-production environment.
Since I ham using railway.json file, I am not able to modify the settings manually for non-prod env.
2 years ago
I tried looking into the docs, for PR Environment Overrides
{
"environments": {
"pr": {
"deploy": {
"startCommand": "echo 'start command for all pull requests!'"
}
}
}
}But railway.json schema is not showing any linting for this object.
2 years ago
yeah it doesn't have schema validation for this, but it should still work.. does it not work?
2 years ago
I am getting this error in the railway dashboard.
Failed to parse JSON file railway.node.json: invalid character '}' looking for beginning of object key stringThe actual config, I used.
"environments": {
"testing": {
"deploy": {
"sleepApplication": true
}
}
}Here testing is an environment in railway not a PR branch name from git.
2 years ago
that's your full railway.json?
2 years ago
Here's the full json file.
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "DOCKERFILE",
"dockerfilePath": "node.Dockerfile",
"buildEnvironment": "V2"
},
"deploy": {
"runtime": "V2",
"numReplicas": 1,
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
},
"environments": {
"testing": {
"deploy": {
"sleepApplication": true
}
}
}
}2 years ago
I'll have to do some testing and get back to you
2 years ago
works as intended -

