Unable to deploy Rust project successfully
Hey there! I'm trying to deploy a Rust app where the actual app is in a subfolder of the main directory, project name
craven-oranges
on Railway.
I've tried setting my root directory to the backend folder, using cargo build --manifest-path backend/Cargo.toml
but no matter what I do the platform just tells me it can't find the binary to run. Am I doing something wrong or do I need to deploy from a Dockerfile?
Thanks in advanceSolution:Jump to solution
Ok I found the solution
I was trying to use dotenvy (dotenv) in a .env file but I didn't realise I actually needed to use
std::env::var
. What a doozy...8 Replies
Project ID:
0eb1d455-dd38-4e29-8eab-b4122d6e7b32
Project ID 0eb1d455-dd38-4e29-8eab-b4122d6e7b32
have you tried setting the root directory in the service settings and leaving the build and start commands blank (their defaults)
I think I have. I'll just do it again now as a sanity check
Okay it looks like it deployed successfully but now just returns "Error: path not found
Caused by:
path not found"
well thats about where my knowledge of rust runs out, hopefully someone will come around that knows whats going wrong
Normally it looks like what should happen is that rust compiles the binary then runs it - it looks like what's happened here is that it's built the image but then either I need to run a build command or it can't find the binary
Solution
Ok I found the solution
I was trying to use dotenvy (dotenv) in a .env file but I didn't realise I actually needed to use
std::env::var
. What a doozyawesome, I'm glad you figured it out, I would have never came to that conclusion in a million years lol