R
Railway12mo ago
josh

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 advance
Solution:
Ok I found the solution facepalm 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...
Jump to solution
8 Replies
Percy
Percy12mo ago
Project ID: 0eb1d455-dd38-4e29-8eab-b4122d6e7b32
josh
josh12mo ago
Project ID 0eb1d455-dd38-4e29-8eab-b4122d6e7b32
Brody
Brody12mo ago
have you tried setting the root directory in the service settings and leaving the build and start commands blank (their defaults)
josh
josh12mo ago
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"
Brody
Brody12mo ago
well thats about where my knowledge of rust runs out, hopefully someone will come around that knows whats going wrong
josh
josh12mo ago
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
josh
josh12mo ago
Ok I found the solution facepalm 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
Brody
Brody12mo ago
awesome, I'm glad you figured it out, I would have never came to that conclusion in a million years lol