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