Problems deploying Discord Bot written in Rust in Railway
Hi, I'm new to Railway and it's the first time I use Railway, I tried to deploy my Discord Bot from my GitHub repository and I got this error stating that Cmake is not installed but I don't understand what I should do to fix that problem. I leave the build log below (the text is very long, so I have to send it as one file):
thank you very much in advance
proyect id: 142f2800-5554-446f-a489-23797460545a
Solution:Jump to solution
```dockerfile
FROM rust:1.71.0-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential ...
107 Replies
Project ID:
142f2800-5554-446f-a489-23797460545a
add a nixpacks.toml file with this to your project
I just added the file but it still gives the same problem ;-;
well I'm out of ideas
seems like its the crate audiopus is upset
it probs has a c/c++ api so it needs cmake to build
the problem is how to install cmake on railway? 😅 in my PC works perfectly
i think u shoudl use a dockerfile
lets try installing with apt instead of nix
the same thing happens ;-;
I have a dockerfile although I'm new to Docker so I'm not sure if it's right. 😅
then im going with eirk's recommendation
bruh
that would have been good to know
😅
these nixpacks.toml files would have done nothing
send the dockerfile please
its not doing anything special, delete it
now i have this error:
show me a screenshot of your service variables
enviorment variables?
service variables
Where can I get them? 😅
from the service
on railway
bruh what is that
what is .env for
ohh, I think the token did not go there 😅 😭
delete it
ok
now i have this error:
yes now
i have this error:
I guess it goes like this now right?
try this
I tried it this way and it gave me the error I just posted. I have not yet upgraded with "openssl-sys".
ohh, nixpgs
i understand now
the same
you may need to add openssl-sys
openssl-sys is not a nix package
maybe it is libssl-dev
thats also not a nix packages
did you code this bot
you can try them as apt packages though
yes, locally on mi PC works perfectly
ok
now i have this error:
ahh, I don't know why copying copies incompletely ;-;
skill issue?
maybe it's a bug in my Arch Linux, sometimes these things happen to me.
common linux L
dockerfile time
now is cmake 😭
well get there, hopefully
Solution
that worked 😄
now put your discord bot token in the service variables
ok, thank you very so much and i sorry for the inconvenience with me 😅
no worries
ups
=========================
Container failed to start
=========================
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/bin/ryuko_bot_discord": stat /bin/ryuko_bot_discord: no such file or directory: unknown
😅
the same error, maybe it is in the target folder. the last line is supposed to execute the binary, right?
when you run cargo build --release locally, where does the bin end up and what's the name of it
a moment please, I compiling with release
target/release/ryuko_bot_discord
cool
now it works
are you sure
now I just have to add my token and the ytp-dl and FFmpeg dependencies.
thread 'main' panicked at 'Missing
DISCORD_TOKEN
env var, see README for more information.: NotPresent', src/main.rs:69:18
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
it worksdownloading YouTube videos is very much not allowed on railway
ohh
you don't be able to host your bot on railway
all this just for me to end up telling you that you can't host the bot on railway
Well, never mind, that was just for the music commands but I can do without that.
yep remove functionality that downloads from YouTube, or any other functionality that does things you're not supposed to, and then you're fine
ok, thank you very much for the help
add your token to the service variables
with " " or without " "?
without quotes
send me a screenshot just to make sure
I added the token without quotes
screenshot please
to clarify, I am not asking to see the token itself, please keep that hidden
why are you calling it .env
I don't understand
I thought that was to create the file and that it would give the name assigned there. 😅 sorry i am a bit new to deploys.
it's a bot token, so the name should be
DISCORD_TOKEN
like the error message told youI just realized and fixed it 😅
now it works
remove any build or start commands you may have set in the service settings
no compile or start command in the configuration 👍🏻
your screenshot said otherwise
ohh
maybe it's the nixpacks because I haven't removed it yet. 😅
or you have set a build command in the service settings
well delete your nixpacks.toml and see if that warning goes away
ok
did not disappear, maybe it is because of the RUN cargo build --release
not because of that
show me your current railway.json please
that's in the service? because I don't have a railway.json in my project 😅
you can see this in the details tab
JSON
now save that as a railway.json file in your project
the strange thing is that it keeps on giving this warning but it already recognizes the json
and for some reason the run charge is added on its own
does the JSON in the details tab have a cargo run build command?
the "cargo run" is added by itself.
GitHub
RyukoBot/railway.json at main · CrawKatt/RyukoBot
Bot de Discord con funciones y características similares a TeloxBot y mucho más - CrawKatt/RyukoBot
odd
but it works, so all good, it's just a warning and has no effect on anything at all
ok, thank you very much and i sorry for the problems with me 😅
no worries!