R
Railwayā€¢10mo 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ā€¢10mo ago
Project ID: ed084bf3-fd73-4163-a606-254021daaf02
XxGunnery
XxGunneryā€¢10mo ago
ed084bf3-fd73-4163-a606-254021daaf02
Brody
Brodyā€¢10mo ago
try adding libgssapi-krb5-2 to your aptPkgs array
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo 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
XxGunneryā€¢10mo ago
right which should come if I have that dependency
Brody
Brodyā€¢10mo ago
yeah keyword, should
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo ago
your nixpacks.toml file is correct
XxGunnery
XxGunneryā€¢10mo ago
ok yeah the delete + redeploy gives the same problem
Brody
Brodyā€¢10mo ago
[phases.setup]
aptPkgs = ["...", "libpq-dev"]
nixPkgs = ["...", "libkrb5"]
[phases.setup]
aptPkgs = ["...", "libpq-dev"]
nixPkgs = ["...", "libkrb5"]
try that
XxGunnery
XxGunneryā€¢10mo ago
yessir
Brody
Brodyā€¢10mo ago
of course it would
XxGunnery
XxGunneryā€¢10mo ago
šŸ¤ž im super impressed with railway btw you guys are amazing
Brody
Brodyā€¢10mo ago
i dont work for railway, but i still appreciate that
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo ago
ive seen so many problems with rust just wanting random libs installed
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo 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
XxGunneryā€¢10mo 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ā€¢10mo ago
i could maybe help? ive never done rust before
XxGunnery
XxGunneryā€¢10mo ago
yeah lemme see what I have i can paste longer files in here right?
Brody
Brodyā€¢10mo ago
you can send the file as a file?
XxGunnery
XxGunneryā€¢10mo 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
XxGunneryā€¢10mo 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
XxGunneryā€¢10mo ago
im going to go through and delete all the android related stuff
Brody
Brodyā€¢10mo ago
yeah that does a whole lot of things you dont need to do
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo ago
i do not, sorry
XxGunnery
XxGunneryā€¢10mo ago
XxGunnery
XxGunneryā€¢10mo ago
i trimmed it down a bit
Brody
Brodyā€¢10mo ago
its installing node?
XxGunnery
XxGunneryā€¢10mo ago
ooh right this is just my server LOL thank you
Brody
Brodyā€¢10mo ago
it also is manually downloading rust, just use a rust image
XxGunnery
XxGunneryā€¢10mo ago
ooh would i include a link to some public image?
Brody
Brodyā€¢10mo ago
im sure rust has published an image on the docker hub
XxGunnery
XxGunneryā€¢10mo ago
you are indeed correct
Brody
Brodyā€¢10mo ago
what version of rust do you have installed locally?
XxGunnery
XxGunneryā€¢10mo 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
XxGunneryā€¢10mo ago
rust - Official Image | Docker Hub
Rust is a systems programming language focused on safety, speed, and concurrency.
Brody
Brodyā€¢10mo ago
then use this image rust:1.71.0-slim
XxGunnery
XxGunneryā€¢10mo ago
so id say like FROM rust:1.71.0-slim
Brody
Brodyā€¢10mo ago
yep!
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo ago
well youd need to add the run the commands to build your rust app and then run it
XxGunnery
XxGunneryā€¢10mo ago
ohh so with docker i go away from nixpacks
Brody
Brodyā€¢10mo ago
correct
XxGunnery
XxGunneryā€¢10mo ago
and i wont get to use the command in the railway setup i see thank you!
Brody
Brodyā€¢10mo 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
XxGunneryā€¢10mo 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ā€¢10mo ago
nah WORKDIR /app
XxGunnery
XxGunneryā€¢10mo ago
oh i see app would be the name of my folder?
Brody
Brodyā€¢10mo 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
XxGunneryā€¢10mo ago
oh alright theyre handling some of the for me
Brody
Brodyā€¢10mo ago
whos "theyre"
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo 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
XxGunneryā€¢10mo ago
oh wow
Brody
Brodyā€¢10mo ago
and this dockerfile would be in your /server folder in the repo
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo ago
well what does cargo run do
XxGunnery
XxGunneryā€¢10mo ago
it runs my app if youre in the server folder
Brody
Brodyā€¢10mo ago
then no that wont work you need to build the app into a binary file
XxGunnery
XxGunneryā€¢10mo ago
ok sorry it it builds and then runs it
Brody
Brodyā€¢10mo ago
still wont work ^ without running it we do not want to run it during build
XxGunnery
XxGunneryā€¢10mo ago
ok i havent built a binary before i think its pretty easy though
Brody
Brodyā€¢10mo 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
XxGunneryā€¢10mo ago
i have a .exe from cargo build bin... hmm
Brody
Brodyā€¢10mo ago
yeah thats fine, in the image youd get a bin since its linux
XxGunnery
XxGunneryā€¢10mo ago
oh great
Brody
Brodyā€¢10mo ago
make sure *.exe is in your gitignore file
XxGunnery
XxGunneryā€¢10mo ago
yeah it creates a target folder with a ton of stuff in it including the .exe, which is gitignored
Brody
Brodyā€¢10mo ago
does cargo build also install the crates?
XxGunnery
XxGunneryā€¢10mo ago
yes
Brody
Brodyā€¢10mo 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
XxGunneryā€¢10mo ago
ok thats all set
Brody
Brodyā€¢10mo ago
send dockerfile
XxGunnery
XxGunneryā€¢10mo ago
sure
XxGunnery
XxGunneryā€¢10mo ago
Brody
Brodyā€¢10mo ago
you still got a crap ton of stuff fron node and tauri?
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo 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
XxGunneryā€¢10mo ago
i think you need a few of those for rust ok i have been keeping it local for now
Brody
Brodyā€¢10mo ago
give me the path to the exe when you run cargo build --release
XxGunnery
XxGunneryā€¢10mo ago
one sec i gotta run it locally with release flag nearly there
Brody
Brodyā€¢10mo ago
damn rust takes that long to build??
XxGunnery
XxGunneryā€¢10mo ago
it does lol
Brody
Brodyā€¢10mo ago
yikes
XxGunnery
XxGunneryā€¢10mo ago
especially release builds
Brody
Brodyā€¢10mo ago
bruh go takes 15 seconds tops.. uncached
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo ago
type annotations?
XxGunnery
XxGunneryā€¢10mo ago
i could have assumed it would be that
XxGunnery
XxGunneryā€¢10mo ago
XxGunnery
XxGunneryā€¢10mo ago
lol
Brody
Brodyā€¢10mo ago
what ide?
XxGunnery
XxGunneryā€¢10mo ago
vscode it only happens when i use rust
Brody
Brodyā€¢10mo ago
is that an extension? ive edited rust with vscode and it didnt do that lol
XxGunnery
XxGunneryā€¢10mo ago
i think its the rust-analyzer extension haha
Brody
Brodyā€¢10mo ago
i had that installed at the time
XxGunnery
XxGunneryā€¢10mo ago
oh interesting
Brody
Brodyā€¢10mo 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
XxGunneryā€¢10mo ago
should I still keep any of the other stuff or is that literally all I need?
Brody
Brodyā€¢10mo ago
your dockerfile had too much stuff, if we need apt packages, we can add that back later all you need for now
XxGunnery
XxGunneryā€¢10mo ago
wow
Brody
Brodyā€¢10mo ago
you can now push that to railway yeah you can see what i meant by "ton of crap" lol
XxGunnery
XxGunneryā€¢10mo ago
COPY . ./ does that get the code from github or something?
Brody
Brodyā€¢10mo ago
yeah how else are you gonna get your code into the image
XxGunnery
XxGunneryā€¢10mo ago
ah yes it wants apt packages
Brody
Brodyā€¢10mo 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
XxGunneryā€¢10mo ago
libssl-dev, pkg-config screenshot better
Brody
Brodyā€¢10mo ago
pictures are worth 1000 words
XxGunnery
XxGunneryā€¢10mo ago
itd be a few screenshots would you want text?
XxGunnery
XxGunneryā€¢10mo ago
holy shit what
Brody
Brodyā€¢10mo ago
what?
XxGunnery
XxGunneryā€¢10mo ago
thats so cool
Brody
Brodyā€¢10mo ago
i made that šŸ™‚
XxGunnery
XxGunneryā€¢10mo ago
damn dude they need to hire you what are they doing
Brody
Brodyā€¢10mo ago
railway wouldn't do it, so i had to im not qualified
XxGunnery
XxGunneryā€¢10mo ago
šŸ¤£ maybe soon
Brody
Brodyā€¢10mo 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
XxGunneryā€¢10mo ago
its beautiful ryuko_bot_discord? or the exe haha
Brody
Brodyā€¢10mo ago
would be even nicer looking if we used an alpine image linux bins dont have an extension lol
XxGunnery
XxGunneryā€¢10mo ago
alpine?
Brody
Brodyā€¢10mo ago
dont worry about alpine out of the scope lol
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo 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
XxGunneryā€¢10mo ago
oh i see you are too helpful
Brody
Brodyā€¢10mo ago
omfg
Brody
Brodyā€¢10mo ago
i have two dockerfiles open and i sent you the wrong one
XxGunnery
XxGunneryā€¢10mo ago
hilarious the only thing i thought was messed up was the entrypoint
Brody
Brodyā€¢10mo ago
thats the only thing that was different lol
XxGunnery
XxGunneryā€¢10mo ago
and the copy line COPY . .
Brody
Brodyā€¢10mo ago
true
XxGunnery
XxGunneryā€¢10mo ago
it was COPY . ./ but maybe thats ok
Brody
Brodyā€¢10mo ago
same thing, its just semantics
XxGunnery
XxGunneryā€¢10mo ago
im going to laugh very hard if we end up having the same list of apt dependencies as the original lol
Brody
Brodyā€¢10mo ago
its possibly
XxGunnery
XxGunneryā€¢10mo ago
well its also good to go incrementally to be lean
Brody
Brodyā€¢10mo 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
XxGunneryā€¢10mo ago
getting fancy!
Brody
Brodyā€¢10mo ago
alpine
XxGunnery
XxGunneryā€¢10mo ago
it seems to be running much longer than the other tries
Brody
Brodyā€¢10mo ago
awesome
XxGunnery
XxGunneryā€¢10mo ago
the rust is building
Brody
Brodyā€¢10mo ago
pog
XxGunnery
XxGunneryā€¢10mo ago
how long have you been writing software?
Brody
Brodyā€¢10mo ago
writing software is a stretch I just play around
XxGunnery
XxGunneryā€¢10mo ago
haha you are getting deep into rusts scary side
XxGunnery
XxGunneryā€¢10mo ago
XxGunnery
XxGunneryā€¢10mo ago
heres that msg + another look at a similar error msg
XxGunnery
XxGunneryā€¢10mo ago
ive seen that before
Brody
Brodyā€¢10mo ago
use the bookmarklet please
XxGunnery
XxGunneryā€¢10mo ago
oh ok
XxGunnery
XxGunneryā€¢10mo ago
looks like min we need libpq-dev
Brody
Brodyā€¢10mo ago
yeah but that's an apt package apt isn't applicable with alpine
XxGunnery
XxGunneryā€¢10mo ago
ohh
Brody
Brodyā€¢10mo ago
alpine uses apk (not to be confused with android .apk files)
Brody
Brodyā€¢10mo ago
cool though we will probably need that, the error we see isn't caused by not having that
XxGunnery
XxGunneryā€¢10mo ago
yeah curious what you think about that ive seen the linking with cc before
Brody
Brodyā€¢10mo ago
I'm in the process of thinking, but what have you done in the past to fix it
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo 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
XxGunneryā€¢10mo ago
legend i wonder if we can look at what nixpacks is doing for rust
Brody
Brodyā€¢10mo ago
something cringe probably
XxGunnery
XxGunneryā€¢10mo ago
cringepacks
Brody
Brodyā€¢10mo ago
real
XxGunnery
XxGunneryā€¢10mo ago
not a fan of nix dudeee the image is publishing poggers
Brody
Brodyā€¢10mo ago
build worked!
XxGunnery
XxGunneryā€¢10mo ago
yesss i think its gonna work i think it was a nixpacks problem
Brody
Brodyā€¢10mo 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
XxGunneryā€¢10mo ago
yeah i want to share a stackoverflow post i wonder if it highlights the problem somehow
Brody
Brodyā€¢10mo ago
a stackoverflow post for what?
XxGunnery
XxGunneryā€¢10mo ago
regarding the error i had on nixpacks build
Brody
Brodyā€¢10mo ago
that's what your here for right now, stackoverflow can't help lol
XxGunnery
XxGunneryā€¢10mo ago
omg it deployed now for your satisfaction this is what you got online
Brody
Brodyā€¢10mo ago
now does it work though, my money's on you forgot some environment variable
Brody
Brodyā€¢10mo ago
haha awesome even got a custom domain but yuck www
XxGunnery
XxGunneryā€¢10mo ago
ohhh yeah i havent done the domain right
Brody
Brodyā€¢10mo ago
what's your provider
XxGunnery
XxGunneryā€¢10mo ago
google domains šŸ™‚ lol
Brody
Brodyā€¢10mo ago
oof
XxGunnery
XxGunneryā€¢10mo ago
well i think they got bought
Brody
Brodyā€¢10mo ago
Google domains doesn't support root level cnames or whoever bought them out doesn't either
XxGunnery
XxGunneryā€¢10mo ago
cryingman
Brody
Brodyā€¢10mo ago
you can just use cloudflare's nameservers, no need to do a domain transfer
XxGunnery
XxGunneryā€¢10mo ago
im down to check that out for sure oh wait shit it crashed
Brody
Brodyā€¢10mo ago
it's simple, run through the setup process in cloudflare and they will transfer everything over
XxGunnery
XxGunneryā€¢10mo ago
odd it doesnt say much in the deploy logs
Brody
Brodyā€¢10mo ago
sadge
Brody
Brodyā€¢10mo ago
why does it say compiling?
XxGunnery
XxGunneryā€¢10mo ago
i wonder if my cargo run in the railway setup is conflicting
Brody
Brodyā€¢10mo ago
yes it is remove please
XxGunnery
XxGunneryā€¢10mo ago
son of a so no start command
Brody
Brodyā€¢10mo ago
correct
XxGunnery
XxGunneryā€¢10mo ago
everything else should be good and now i can just hit redeploy
Brody
Brodyā€¢10mo ago
for you, the ENTRYPOINT is like a start command
XxGunnery
XxGunneryā€¢10mo ago
yeah i saw the compiling and was like o shit well you did good catch lol
Brody
Brodyā€¢10mo ago
also, dont log your database connection string youll want to go and regen that
XxGunnery
XxGunneryā€¢10mo ago
yeah i might want to remove that
Brody
Brodyā€¢10mo ago
free database
XxGunnery
XxGunneryā€¢10mo ago
dumbass database anyone? huahuaha
Brody
Brodyā€¢10mo ago
in the plugins settings
XxGunnery
XxGunneryā€¢10mo ago
ok im good on the db im guessing that was it on the deployment as well it was running
Brody
Brodyā€¢10mo ago
so has it crashed?
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo ago
how many crates are you using
XxGunnery
XxGunneryā€¢10mo 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
XxGunneryā€¢10mo ago
ah got another failed one i didnt push code just updated the db string and removed cargo run
Brody
Brodyā€¢10mo ago
updated the db string?
XxGunnery
XxGunneryā€¢10mo ago
well in my env after i had to change it
Brody
Brodyā€¢10mo ago
oh no, you arent using variable references like you should be, are you?
XxGunnery
XxGunneryā€¢10mo ago
LOL they even say that.... yeah im not
Brody
Brodyā€¢10mo ago
they do you should be
XxGunnery
XxGunneryā€¢10mo ago
well thats very convenient isnt it interesting the build fails 'failed to create task for container'
Brody
Brodyā€¢10mo ago
it sure it "/apptarget/release/battle-plains-server" that doesnt look right
XxGunnery
XxGunneryā€¢10mo ago
oh snap should be target
Brody
Brodyā€¢10mo ago
send the dockerfile back please
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo 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
XxGunneryā€¢10mo 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ā€¢10mo ago
railway will restart if your app exits or crashes
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo ago
sounds good
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo ago
let me know how it goes when you pick this back up
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo ago
makes sense go into the service settings and disable private networking
XxGunnery
XxGunneryā€¢10mo ago
I think it's disabled already Says 'enable private networking' in the UI
Brody
Brodyā€¢10mo ago
okay then let's see a screenshot of your service variables
XxGunnery
XxGunneryā€¢10mo ago
XxGunnery
XxGunneryā€¢10mo ago
here you go kind sir
Brody
Brodyā€¢10mo ago
okay, let's see the error message
XxGunnery
XxGunneryā€¢10mo ago
It doesn't have an error msg per se It crashes after it fails connecting
Brody
Brodyā€¢10mo ago
ya gotta log your errors can't do much debugging without error logs
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo ago
yeah we need an error message to proceed and an actual error message, not just "there was an error"
XxGunnery
XxGunneryā€¢10mo ago
Yeah
Brody
Brodyā€¢10mo ago
let me know when you have an error message
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo 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
XxGunneryā€¢10mo 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
XxGunneryā€¢10mo ago
explains that the code exits without any message or log then suggests a fix installing some dll
Brody
Brodyā€¢10mo ago
thats a solution for windows
XxGunnery
XxGunneryā€¢10mo ago
yeah i cant get it to spit any error msg
Brody
Brodyā€¢10mo ago
that's very likely your issue, you just need to find a solution for linux
XxGunnery
XxGunneryā€¢10mo ago
and then its all about adding this process to the dockerfile somehow?
Brody
Brodyā€¢10mo ago
perslaps
XxGunnery
XxGunneryā€¢10mo ago
perslaps ma naps
Brody
Brodyā€¢10mo ago
well cross that bridge when we get to it
XxGunnery
XxGunneryā€¢10mo ago
diesel makes me sadge and cringe
Brody
Brodyā€¢10mo 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
XxGunneryā€¢10mo 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ā€¢10mo ago
no --release?
XxGunnery
XxGunneryā€¢10mo 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ā€¢10mo ago
something like that yeah
XxGunnery
XxGunneryā€¢10mo ago
now my game is multiplayer šŸ™‚ so tldr worth trying go? hahaha
Brody
Brodyā€¢10mo ago
YES!
XxGunnery
XxGunneryā€¢10mo ago
ily brody thanks so much i would tip u if i could absolute chad
Brody
Brodyā€¢10mo ago
haha thanks!