R
Railwayā€¢16mo ago
XxGunnery

Unexpected crash - Rust crashes after building with libgssapi-krb5 reference

Hey, first time posting an error - my Railway deployment is crashing with the following error: error while loading shared libraries: libgssapi_krb5.so.2: cannot open shared object file: No such file or directory The deployment for this code was working fine until I added the diesel dependency in my Cargo.toml. I first needed to add libpq-dev as an apt dependency (expected this one) to fix build errors, and then I got it to build and deploy, and ran into the crash error mentioned earlier. Here is my Cargo.toml for the project: [dependencies] actix-web = "4" actix-cors = "0.6.4" actix = "0.13.0" actix-web-actors = "4.2.0" reqwest = { version = "0.11.14", features = ["json"] } dotenv = "0.15.0" serde_json = "1.0.94" serde = { version = "1.0.155", features = ["derive"] } diesel = { version = "2.0.4", features = [ "postgres", "chrono", "uuid", "r2d2", "serde_json", ] } env_logger = "0.10.0" rand = "0.8.4" Here is my nixpacks.toml (need libpq-dev for Diesel's postgres feature): [phases.setup] aptPkgs = ["...", "libpq-dev"] Thank you, any help would be appreciated!
270 Replies
Percy
Percyā€¢16mo ago
Project ID: ed084bf3-fd73-4163-a606-254021daaf02
XxGunnery
XxGunneryOPā€¢16mo ago
ed084bf3-fd73-4163-a606-254021daaf02
Brody
Brodyā€¢16mo ago
try adding libgssapi-krb5-2 to your aptPkgs array
XxGunnery
XxGunneryOPā€¢16mo ago
oh thank you for the suggestion @Brody I will try that ok heres what I have now [phases.setup] aptPkgs = ["...", "libpq-dev", "libgssapi-krb5-2"] just pushed! have you ever seen this error before? any idea where it comes from? curious what I've done right on my local windows machine to make this work well lol also i just got the project redeployed and im getting the same error i wonder if there is potentially a cache I need to clear or if the dependency is not the root of the problem? i just removed the deployment and I am trying again
Brody
Brodyā€¢16mo ago
i have not seen it, error comes from a package not finding libgssapi_krb5.so.2 the issue is the final deployment is missing libgssapi_krb5.so.2
XxGunnery
XxGunneryOPā€¢16mo ago
right which should come if I have that dependency
Brody
Brodyā€¢16mo ago
yeah keyword, should
XxGunnery
XxGunneryOPā€¢16mo ago
hmmm i was looking for a way to verify it is running the apt-get commands for the packages it looks like in build logs it is saying layer already exists
Brody
Brodyā€¢16mo ago
your nixpacks.toml file is correct
XxGunnery
XxGunneryOPā€¢16mo ago
ok yeah the delete + redeploy gives the same problem
Brody
Brodyā€¢16mo ago
[phases.setup]
aptPkgs = ["...", "libpq-dev"]
nixPkgs = ["...", "libkrb5"]
[phases.setup]
aptPkgs = ["...", "libpq-dev"]
nixPkgs = ["...", "libkrb5"]
try that
XxGunnery
XxGunneryOPā€¢16mo ago
yessir
Brody
Brodyā€¢16mo ago
of course it would
XxGunnery
XxGunneryOPā€¢16mo ago
šŸ¤ž im super impressed with railway btw you guys are amazing
Brody
Brodyā€¢16mo ago
i dont work for railway, but i still appreciate that
XxGunnery
XxGunneryOPā€¢16mo ago
damn same problem im tempted to stop using diesel and just write sql queries ive had so many problems with this ORM
Brody
Brodyā€¢16mo ago
ive seen so many problems with rust just wanting random libs installed
XxGunnery
XxGunneryOPā€¢16mo ago
it seems that way sometimes yeah i did have to completely remove diesel trying to build an android app with tauri rust runs into some problems, but with diesel its a whole other level
Brody
Brodyā€¢16mo ago
the only other solution i can think of would be move to a dockerfile, but im not confident in my ability to write a dockerfile for rust
XxGunnery
XxGunneryOPā€¢16mo ago
i have one that was written by a tauri dev i can probably modify it would be good to get to know docker better anyways
Brody
Brodyā€¢16mo ago
i could maybe help? ive never done rust before
XxGunnery
XxGunneryOPā€¢16mo ago
yeah lemme see what I have i can paste longer files in here right?
Brody
Brodyā€¢16mo ago
you can send the file as a file?
XxGunnery
XxGunneryOPā€¢16mo ago
like text oh sure still looking I think I already worked on removing android portions of the file cus the dockerfile was originally set up to cross compile to android ill just share the repo i found it on cus im not able find my modified file i think i figured i didnt need docker
XxGunnery
XxGunneryOPā€¢16mo ago
GitHub
GitHub - simonhyll/devcontainer: Tauri + Android + Mold + Rust + No...
Tauri + Android + Mold + Rust + Node.js + Trunk + Wasm - GitHub - simonhyll/devcontainer: Tauri + Android + Mold + Rust + Node.js + Trunk + Wasm
XxGunnery
XxGunneryOPā€¢16mo ago
im going to go through and delete all the android related stuff
Brody
Brodyā€¢16mo ago
yeah that does a whole lot of things you dont need to do
XxGunnery
XxGunneryOPā€¢16mo ago
right right dont need pnpm dont need java/tauri/mold do you know what the devcontainer.json file does? doesnt look like i will need anything there
Brody
Brodyā€¢16mo ago
i do not, sorry
XxGunnery
XxGunneryOPā€¢16mo ago
XxGunnery
XxGunneryOPā€¢16mo ago
i trimmed it down a bit
Brody
Brodyā€¢16mo ago
its installing node?
XxGunnery
XxGunneryOPā€¢16mo ago
ooh right this is just my server LOL thank you
Brody
Brodyā€¢16mo ago
it also is manually downloading rust, just use a rust image
XxGunnery
XxGunneryOPā€¢16mo ago
ooh would i include a link to some public image?
Brody
Brodyā€¢16mo ago
im sure rust has published an image on the docker hub
XxGunnery
XxGunneryOPā€¢16mo ago
you are indeed correct
Brody
Brodyā€¢16mo ago
what version of rust do you have installed locally?
XxGunnery
XxGunneryOPā€¢16mo ago
rustup 1.26.0 (5af9b9484 2023-04-05) info: This is the version for the rustup toolchain manager, not the rustc compiler. info: The currently active rustc version is rustc 1.71.0 (8ede3aae2 2023-07-12)
XxGunnery
XxGunneryOPā€¢16mo ago
rust - Official Image | Docker Hub
Rust is a systems programming language focused on safety, speed, and concurrency.
Brody
Brodyā€¢16mo ago
then use this image rust:1.71.0-slim
XxGunnery
XxGunneryOPā€¢16mo ago
so id say like FROM rust:1.71.0-slim
Brody
Brodyā€¢16mo ago
yep!
XxGunnery
XxGunneryOPā€¢16mo ago
sorry is that it? ive never added my own new like to a dockerfile šŸ˜„ just delete and change things in a line lol
Brody
Brodyā€¢16mo ago
well youd need to add the run the commands to build your rust app and then run it
XxGunnery
XxGunneryOPā€¢16mo ago
ohh so with docker i go away from nixpacks
Brody
Brodyā€¢16mo ago
correct
XxGunnery
XxGunneryOPā€¢16mo ago
and i wont get to use the command in the railway setup i see thank you!
Brody
Brodyā€¢16mo ago
think of a dockerfile as a bunch of commands that you would run to download the dependencies, build the app, and run the app from scratch of course you dont need to download rust because thats what that rust image has already done for you
XxGunnery
XxGunneryOPā€¢16mo ago
yeah that makes sense im not sure where my working directory would be should i just run the container and get a feel for the environment?
Brody
Brodyā€¢16mo ago
nah WORKDIR /app
XxGunnery
XxGunneryOPā€¢16mo ago
oh i see app would be the name of my folder?
Brody
Brodyā€¢16mo ago
the workdir has nothing to do with your project folder, its just simply where files will be worked on and copied to when in the docker image keep it /app
XxGunnery
XxGunneryOPā€¢16mo ago
oh alright theyre handling some of the for me
Brody
Brodyā€¢16mo ago
whos "theyre"
XxGunnery
XxGunneryOPā€¢16mo ago
docker i guess if its a monorepo and my server is in a folder called server relative to parent directory i should do WORKDIR /app/server and then run the commands?
Brody
Brodyā€¢16mo ago
workdir has nothing to do with your project folders or structures, its just the folder withing the docker image that you will be working on files you would have set your root directory as /server in railway already
XxGunnery
XxGunneryOPā€¢16mo ago
oh wow
Brody
Brodyā€¢16mo ago
and this dockerfile would be in your /server folder in the repo
XxGunnery
XxGunneryOPā€¢16mo ago
ok that is great ok im just going to see what railways got WORKDIR /app RUN cargo run should be good right? šŸ¤£
Brody
Brodyā€¢16mo ago
well what does cargo run do
XxGunnery
XxGunneryOPā€¢16mo ago
it runs my app if youre in the server folder
Brody
Brodyā€¢16mo ago
then no that wont work you need to build the app into a binary file
XxGunnery
XxGunneryOPā€¢16mo ago
ok sorry it it builds and then runs it
Brody
Brodyā€¢16mo ago
still wont work ^ without running it we do not want to run it during build
XxGunnery
XxGunneryOPā€¢16mo ago
ok i havent built a binary before i think its pretty easy though
Brody
Brodyā€¢16mo ago
youd know the command to do that better than me i know how to write dockerfiles, but i cant if i dont know the commands to build a rust bin
XxGunnery
XxGunneryOPā€¢16mo ago
i have a .exe from cargo build bin... hmm
Brody
Brodyā€¢16mo ago
yeah thats fine, in the image youd get a bin since its linux
XxGunnery
XxGunneryOPā€¢16mo ago
oh great
Brody
Brodyā€¢16mo ago
make sure *.exe is in your gitignore file
XxGunnery
XxGunneryOPā€¢16mo ago
yeah it creates a target folder with a ton of stuff in it including the .exe, which is gitignored
Brody
Brodyā€¢16mo ago
does cargo build also install the crates?
XxGunnery
XxGunneryOPā€¢16mo ago
yes
Brody
Brodyā€¢16mo ago
keep that target folder in your .gitignore too that target folder is platform dependent, and we dont put platform dependent stuff in the repo
XxGunnery
XxGunneryOPā€¢16mo ago
ok thats all set
Brody
Brodyā€¢16mo ago
send dockerfile
XxGunnery
XxGunneryOPā€¢16mo ago
sure
XxGunnery
XxGunneryOPā€¢16mo ago
Brody
Brodyā€¢16mo ago
you still got a crap ton of stuff fron node and tauri?
XxGunnery
XxGunneryOPā€¢16mo ago
oh you mean the apt stuff? i am paranoid i dont have enough dependencies LOL i know it doesnt work like that
Brody
Brodyā€¢16mo ago
also, please dont be pushing every little change you make on the dockerfile to railway, ill let you know when i think the dockerfile has a chance of running
XxGunnery
XxGunneryOPā€¢16mo ago
i think you need a few of those for rust ok i have been keeping it local for now
Brody
Brodyā€¢16mo ago
give me the path to the exe when you run cargo build --release
XxGunnery
XxGunneryOPā€¢16mo ago
one sec i gotta run it locally with release flag nearly there
Brody
Brodyā€¢16mo ago
damn rust takes that long to build??
XxGunnery
XxGunneryOPā€¢16mo ago
it does lol
Brody
Brodyā€¢16mo ago
yikes
XxGunnery
XxGunneryOPā€¢16mo ago
especially release builds
Brody
Brodyā€¢16mo ago
bruh go takes 15 seconds tops.. uncached
XxGunnery
XxGunneryOPā€¢16mo ago
when its cached and there are only small changes it is quick but i havent run release build LOL i was considering learning go, but i just like the orange highlighted type annotations in my IDE you know how it is target/release/battle-plains-server.exe
Brody
Brodyā€¢16mo ago
type annotations?
XxGunnery
XxGunneryOPā€¢16mo ago
i could have assumed it would be that
XxGunnery
XxGunneryOPā€¢16mo ago
XxGunnery
XxGunneryOPā€¢16mo ago
lol
Brody
Brodyā€¢16mo ago
what ide?
XxGunnery
XxGunneryOPā€¢16mo ago
vscode it only happens when i use rust
Brody
Brodyā€¢16mo ago
is that an extension? ive edited rust with vscode and it didnt do that lol
XxGunnery
XxGunneryOPā€¢16mo ago
i think its the rust-analyzer extension haha
Brody
Brodyā€¢16mo ago
i had that installed at the time
XxGunnery
XxGunneryOPā€¢16mo ago
oh interesting
Brody
Brodyā€¢16mo ago
getting off track though use this
FROM rust:1.71.0-slim

WORKDIR /app

COPY . ./

RUN cargo build --release

ENTRYPOINT ["/apptarget/release/battle-plains-server"]
FROM rust:1.71.0-slim

WORKDIR /app

COPY . ./

RUN cargo build --release

ENTRYPOINT ["/apptarget/release/battle-plains-server"]
XxGunnery
XxGunneryOPā€¢16mo ago
should I still keep any of the other stuff or is that literally all I need?
Brody
Brodyā€¢16mo ago
your dockerfile had too much stuff, if we need apt packages, we can add that back later all you need for now
XxGunnery
XxGunneryOPā€¢16mo ago
wow
Brody
Brodyā€¢16mo ago
you can now push that to railway yeah you can see what i meant by "ton of crap" lol
XxGunnery
XxGunneryOPā€¢16mo ago
COPY . ./ does that get the code from github or something?
Brody
Brodyā€¢16mo ago
yeah how else are you gonna get your code into the image
XxGunnery
XxGunneryOPā€¢16mo ago
ah yes it wants apt packages
Brody
Brodyā€¢16mo ago
well railway will pull your repo into a temp folder, so COPY just copys the code from the same directory as the dockerfile do tell screenshot
XxGunnery
XxGunneryOPā€¢16mo ago
libssl-dev, pkg-config screenshot better
Brody
Brodyā€¢16mo ago
pictures are worth 1000 words
XxGunnery
XxGunneryOPā€¢16mo ago
itd be a few screenshots would you want text?
XxGunnery
XxGunneryOPā€¢16mo ago
holy shit what
Brody
Brodyā€¢16mo ago
what?
XxGunnery
XxGunneryOPā€¢16mo ago
thats so cool
Brody
Brodyā€¢16mo ago
i made that šŸ™‚
XxGunnery
XxGunneryOPā€¢16mo ago
damn dude they need to hire you what are they doing
Brody
Brodyā€¢16mo ago
railway wouldn't do it, so i had to im not qualified
XxGunnery
XxGunneryOPā€¢16mo ago
šŸ¤£ maybe soon
Brody
Brodyā€¢16mo ago
FROM rust:1.71.0-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
openssl \
libpq-dev \
pkg-config

WORKDIR /app

COPY . .

RUN cargo build --release

ENTRYPOINT ["/app/target/release/ryuko_bot_discord"]
FROM rust:1.71.0-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
openssl \
libpq-dev \
pkg-config

WORKDIR /app

COPY . .

RUN cargo build --release

ENTRYPOINT ["/app/target/release/ryuko_bot_discord"]
XxGunnery
XxGunneryOPā€¢16mo ago
its beautiful ryuko_bot_discord? or the exe haha
Brody
Brodyā€¢16mo ago
would be even nicer looking if we used an alpine image linux bins dont have an extension lol
XxGunnery
XxGunneryOPā€¢16mo ago
alpine?
Brody
Brodyā€¢16mo ago
dont worry about alpine out of the scope lol
XxGunnery
XxGunneryOPā€¢16mo ago
i am worried about alpine but later I changed it to ENTRYPOINT ["/app/target/release/battle-plains-server"] i assumed ryuko_bot_discord was something else
Brody
Brodyā€¢16mo ago
fine, the image you are currently using is based on debian, the rust image with alpine in the name is based on alpine, just a different linux distro
XxGunnery
XxGunneryOPā€¢16mo ago
oh i see you are too helpful
Brody
Brodyā€¢16mo ago
omfg
Brody
Brodyā€¢16mo ago
i have two dockerfiles open and i sent you the wrong one
XxGunnery
XxGunneryOPā€¢16mo ago
hilarious the only thing i thought was messed up was the entrypoint
Brody
Brodyā€¢16mo ago
thats the only thing that was different lol
XxGunnery
XxGunneryOPā€¢16mo ago
and the copy line COPY . .
Brody
Brodyā€¢16mo ago
true
XxGunnery
XxGunneryOPā€¢16mo ago
it was COPY . ./ but maybe thats ok
Brody
Brodyā€¢16mo ago
same thing, its just semantics
XxGunnery
XxGunneryOPā€¢16mo ago
im going to laugh very hard if we end up having the same list of apt dependencies as the original lol
Brody
Brodyā€¢16mo ago
its possibly
XxGunnery
XxGunneryOPā€¢16mo ago
well its also good to go incrementally to be lean
Brody
Brodyā€¢16mo ago
FROM rust:1.71.0-alpine3.18

RUN apk add openssl-dev musl-dev

WORKDIR /app

COPY . ./

RUN cargo build --release

ENTRYPOINT ["/apptarget/release/battle-plains-server"]
FROM rust:1.71.0-alpine3.18

RUN apk add openssl-dev musl-dev

WORKDIR /app

COPY . ./

RUN cargo build --release

ENTRYPOINT ["/apptarget/release/battle-plains-server"]
XxGunnery
XxGunneryOPā€¢16mo ago
getting fancy!
Brody
Brodyā€¢16mo ago
alpine
XxGunnery
XxGunneryOPā€¢16mo ago
it seems to be running much longer than the other tries
Brody
Brodyā€¢16mo ago
awesome
XxGunnery
XxGunneryOPā€¢16mo ago
the rust is building
Brody
Brodyā€¢16mo ago
pog
XxGunnery
XxGunneryOPā€¢16mo ago
how long have you been writing software?
Brody
Brodyā€¢16mo ago
writing software is a stretch I just play around
XxGunnery
XxGunneryOPā€¢16mo ago
haha you are getting deep into rusts scary side
XxGunnery
XxGunneryOPā€¢16mo ago
XxGunnery
XxGunneryOPā€¢16mo ago
heres that msg + another look at a similar error msg
XxGunnery
XxGunneryOPā€¢16mo ago
ive seen that before
Brody
Brodyā€¢16mo ago
use the bookmarklet please
XxGunnery
XxGunneryOPā€¢16mo ago
oh ok
XxGunnery
XxGunneryOPā€¢16mo ago
looks like min we need libpq-dev
Brody
Brodyā€¢16mo ago
yeah but that's an apt package apt isn't applicable with alpine
XxGunnery
XxGunneryOPā€¢16mo ago
ohh
Brody
Brodyā€¢16mo ago
alpine uses apk (not to be confused with android .apk files)
Brody
Brodyā€¢16mo ago
cool though we will probably need that, the error we see isn't caused by not having that
XxGunnery
XxGunneryOPā€¢16mo ago
yeah curious what you think about that ive seen the linking with cc before
Brody
Brodyā€¢16mo ago
I'm in the process of thinking, but what have you done in the past to fix it
XxGunnery
XxGunneryOPā€¢16mo ago
it mentions -lpq on the second note (after linking with 'cc' failed) so i looked that up and thats where people mention postgres i think thats where i added libpq-dev
Brody
Brodyā€¢16mo ago
FROM rust:1.71.0-alpine3.18

RUN apk add libpq-dev openssl-dev musl-dev

WORKDIR /app

COPY . ./

RUN cargo build --release

ENTRYPOINT ["/apptarget/release/battle-plains-server"]
FROM rust:1.71.0-alpine3.18

RUN apk add libpq-dev openssl-dev musl-dev

WORKDIR /app

COPY . ./

RUN cargo build --release

ENTRYPOINT ["/apptarget/release/battle-plains-server"]
let's try it, I have a backup plan if that doesn't change anything
XxGunnery
XxGunneryOPā€¢16mo ago
legend i wonder if we can look at what nixpacks is doing for rust
Brody
Brodyā€¢16mo ago
something cringe probably
XxGunnery
XxGunneryOPā€¢16mo ago
cringepacks
Brody
Brodyā€¢16mo ago
real
XxGunnery
XxGunneryOPā€¢16mo ago
not a fan of nix dudeee the image is publishing poggers
Brody
Brodyā€¢16mo ago
build worked!
XxGunnery
XxGunneryOPā€¢16mo ago
yesss i think its gonna work i think it was a nixpacks problem
Brody
Brodyā€¢16mo ago
it's fine until you ask it to install an apt package that would normally fix the build in a dockerfile there's 100% a way to get it working with nixpacks, I just don't know that way
XxGunnery
XxGunneryOPā€¢16mo ago
yeah i want to share a stackoverflow post i wonder if it highlights the problem somehow
Brody
Brodyā€¢16mo ago
a stackoverflow post for what?
XxGunnery
XxGunneryOPā€¢16mo ago
regarding the error i had on nixpacks build
Brody
Brodyā€¢16mo ago
that's what your here for right now, stackoverflow can't help lol
XxGunnery
XxGunneryOPā€¢16mo ago
omg it deployed now for your satisfaction this is what you got online
Brody
Brodyā€¢16mo ago
now does it work though, my money's on you forgot some environment variable
Brody
Brodyā€¢16mo ago
haha awesome even got a custom domain but yuck www
XxGunnery
XxGunneryOPā€¢16mo ago
ohhh yeah i havent done the domain right
Brody
Brodyā€¢16mo ago
what's your provider
XxGunnery
XxGunneryOPā€¢16mo ago
google domains šŸ™‚ lol
Brody
Brodyā€¢16mo ago
oof
XxGunnery
XxGunneryOPā€¢16mo ago
well i think they got bought
Brody
Brodyā€¢16mo ago
Google domains doesn't support root level cnames or whoever bought them out doesn't either
XxGunnery
XxGunneryOPā€¢16mo ago
cryingman
Brody
Brodyā€¢16mo ago
you can just use cloudflare's nameservers, no need to do a domain transfer
XxGunnery
XxGunneryOPā€¢16mo ago
im down to check that out for sure oh wait shit it crashed
Brody
Brodyā€¢16mo ago
it's simple, run through the setup process in cloudflare and they will transfer everything over
XxGunnery
XxGunneryOPā€¢16mo ago
odd it doesnt say much in the deploy logs
Brody
Brodyā€¢16mo ago
sadge
Brody
Brodyā€¢16mo ago
why does it say compiling?
XxGunnery
XxGunneryOPā€¢16mo ago
i wonder if my cargo run in the railway setup is conflicting
Brody
Brodyā€¢16mo ago
yes it is remove please
XxGunnery
XxGunneryOPā€¢16mo ago
son of a so no start command
Brody
Brodyā€¢16mo ago
correct
XxGunnery
XxGunneryOPā€¢16mo ago
everything else should be good and now i can just hit redeploy
Brody
Brodyā€¢16mo ago
for you, the ENTRYPOINT is like a start command
XxGunnery
XxGunneryOPā€¢16mo ago
yeah i saw the compiling and was like o shit well you did good catch lol
Brody
Brodyā€¢16mo ago
also, dont log your database connection string youll want to go and regen that
XxGunnery
XxGunneryOPā€¢16mo ago
yeah i might want to remove that
Brody
Brodyā€¢16mo ago
free database
XxGunnery
XxGunneryOPā€¢16mo ago
dumbass database anyone? huahuaha
Brody
Brodyā€¢16mo ago
in the plugins settings
XxGunnery
XxGunneryOPā€¢16mo ago
ok im good on the db im guessing that was it on the deployment as well it was running
Brody
Brodyā€¢16mo ago
so has it crashed?
XxGunnery
XxGunneryOPā€¢16mo ago
well sometimes you forget to hit the save button then you gotta run the rust build again ill know in another couple minutes lol
Brody
Brodyā€¢16mo ago
how many crates are you using
XxGunnery
XxGunneryOPā€¢16mo ago
[dependencies] actix-web = "4" actix-cors = "0.6.4" actix = "0.13.0" actix-web-actors = "4.2.0" reqwest = { version = "0.11.14", features = ["json"] } dotenv = "0.15.0" serde_json = "1.0.94" serde = { version = "1.0.155", features = ["derive"] } diesel = { version = "2.1.0", features = [ "postgres", "chrono", "uuid", "r2d2", "serde_json", ] } env_logger = "0.10.0" rand = "0.8.4" isnt that wild
XxGunnery
XxGunneryOPā€¢16mo ago
ah got another failed one i didnt push code just updated the db string and removed cargo run
Brody
Brodyā€¢16mo ago
updated the db string?
XxGunnery
XxGunneryOPā€¢16mo ago
well in my env after i had to change it
Brody
Brodyā€¢16mo ago
oh no, you arent using variable references like you should be, are you?
XxGunnery
XxGunneryOPā€¢16mo ago
LOL they even say that.... yeah im not
Brody
Brodyā€¢16mo ago
they do you should be
XxGunnery
XxGunneryOPā€¢16mo ago
well thats very convenient isnt it interesting the build fails 'failed to create task for container'
Brody
Brodyā€¢16mo ago
it sure it "/apptarget/release/battle-plains-server" that doesnt look right
XxGunnery
XxGunneryOPā€¢16mo ago
oh snap should be target
Brody
Brodyā€¢16mo ago
send the dockerfile back please
XxGunnery
XxGunneryOPā€¢16mo ago
FROM rust:1.71.0-alpine3.18 RUN apk add libpq-dev openssl-dev musl-dev WORKDIR /app COPY . ./ RUN cargo build --release ENTRYPOINT ["/apptarget/release/battle-plains-server"]
Brody
Brodyā€¢16mo ago
FROM rust:1.71.0-alpine3.18

RUN apk add libpq-dev openssl-dev musl-dev

WORKDIR /app

COPY . ./

RUN cargo build --release

ENTRYPOINT ["/app/target/release/battle-plains-server"]
FROM rust:1.71.0-alpine3.18

RUN apk add libpq-dev openssl-dev musl-dev

WORKDIR /app

COPY . ./

RUN cargo build --release

ENTRYPOINT ["/app/target/release/battle-plains-server"]
XxGunnery
XxGunneryOPā€¢16mo ago
ok were deployed again! it seems to be spamming like its running the app over and over again like running my init logic every 5 seconds or so
Brody
Brodyā€¢16mo ago
railway will restart if your app exits or crashes
XxGunnery
XxGunneryOPā€¢16mo ago
rust are you crashing quietly? lol dude you are a champion im going to go to bed, this is a great point to be at
Brody
Brodyā€¢16mo ago
sounds good
XxGunnery
XxGunneryOPā€¢16mo ago
thank you so much again ā¤ļø ā¤ļø peace bro btw it is crashing on my db connection for sure im not sure why but i have a place to debug which is almost def on my side
Brody
Brodyā€¢16mo ago
let me know how it goes when you pick this back up
XxGunnery
XxGunneryOPā€¢16mo ago
Hey @Brody I ended up working more on it and got stuck, seems like the deployment is having trouble connecting to the DB I tried it local with the same connection string and it worked
Brody
Brodyā€¢16mo ago
makes sense go into the service settings and disable private networking
XxGunnery
XxGunneryOPā€¢16mo ago
I think it's disabled already Says 'enable private networking' in the UI
Brody
Brodyā€¢16mo ago
okay then let's see a screenshot of your service variables
XxGunnery
XxGunneryOPā€¢16mo ago
XxGunnery
XxGunneryOPā€¢16mo ago
here you go kind sir
Brody
Brodyā€¢16mo ago
okay, let's see the error message
XxGunnery
XxGunneryOPā€¢16mo ago
It doesn't have an error msg per se It crashes after it fails connecting
Brody
Brodyā€¢16mo ago
ya gotta log your errors can't do much debugging without error logs
XxGunnery
XxGunneryOPā€¢16mo ago
I am actually not sure how to log this error, I have tried and ended up settling with a msg after that says 'no error yet...' lol I can spend some more time trying to get an error
Brody
Brodyā€¢16mo ago
yeah we need an error message to proceed and an actual error message, not just "there was an error"
XxGunnery
XxGunneryOPā€¢16mo ago
Yeah
Brody
Brodyā€¢16mo ago
let me know when you have an error message
XxGunnery
XxGunneryOPā€¢16mo ago
idk if this helps but im using a connection pool to try and share the db connection around my app let pool = Pool::builder() .max_lifetime(Some(Duration::new(1800, 0))) .connection_timeout(Duration::new(30, 0)) .max_size(15) .build(manager) .map_err(|err| { println!("Error: {}", err); Box::new(err) as Box<dyn Error> }); println!("No error yet..."); im at work rn will have to wait til after to get the error msg worked on and the map_err portion seems to do nothing on error lol
Brody
Brodyā€¢16mo ago
looks fine, the pool builder just creates the pool and doesnt connect to the database, so its understandable that its not causing the crash sounds good, ill be around
XxGunnery
XxGunneryOPā€¢16mo ago
hey @Brody for whenever you are online next I found this https://github.com/diesel-rs/diesel/discussions/2947
GitHub
Exit code 3 after adding Diesel r2d2 on Rocket Ā· diesel-rs diesel Ā·...
Hi all! I have an issue with the r2d2 module (I think). My rocket app is exiting with code 3, without any message or log on Windows 10. I found that this is occurred by the r2d2 module of the diese...
XxGunnery
XxGunneryOPā€¢16mo ago
explains that the code exits without any message or log then suggests a fix installing some dll
Brody
Brodyā€¢16mo ago
thats a solution for windows
XxGunnery
XxGunneryOPā€¢16mo ago
yeah i cant get it to spit any error msg
Brody
Brodyā€¢16mo ago
that's very likely your issue, you just need to find a solution for linux
XxGunnery
XxGunneryOPā€¢16mo ago
and then its all about adding this process to the dockerfile somehow?
Brody
Brodyā€¢16mo ago
perslaps
XxGunnery
XxGunneryOPā€¢16mo ago
perslaps ma naps
Brody
Brodyā€¢16mo ago
well cross that bridge when we get to it
XxGunnery
XxGunneryOPā€¢16mo ago
diesel makes me sadge and cringe
Brody
Brodyā€¢16mo ago
same, but for rust every rust help thread is a missing lib if rust is so good why does it rely on so many c libs?
XxGunnery
XxGunneryOPā€¢16mo ago
lol you do speak the truth but! i managed to get it to work I decided to try the non-alpine dockerfile i added a couple more deps that it was asking for heres the final file FROM rust:1.71.0-slim RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ openssl \ libpq-dev \ libssl-dev \ pkg-config WORKDIR /app COPY . ./ RUN cargo build ENTRYPOINT ["/app/target/debug/battle-plains-server"]
Brody
Brodyā€¢16mo ago
no --release?
XxGunnery
XxGunneryOPā€¢16mo ago
WELL oops caps well its slower i think i will probably update to --release after i think --release just does some optimizations for runtime but its the same program basically
Brody
Brodyā€¢16mo ago
something like that yeah
XxGunnery
XxGunneryOPā€¢16mo ago
now my game is multiplayer šŸ™‚ so tldr worth trying go? hahaha
Brody
Brodyā€¢16mo ago
YES!
XxGunnery
XxGunneryOPā€¢16mo ago
ily brody thanks so much i would tip u if i could absolute chad
Brody
Brodyā€¢16mo ago
haha thanks!
Want results from more Discord servers?
Add your server