Using discord bot with railway
I'm running a discord bot off a github repo, however i feel like the issue is that since it's pushing off the github repository it's only updating changes locally. so whenevever settings change via the bot in json files or things like that which would normally save i dont think its quite working the way it should, any help would be cool
75 Replies
Project ID:
e973bf7d-52cf-4a8e-b30c-0829b7914a35
e973bf7d-52cf-4a8e-b30c-0829b7914a35
when running locally this does not happen
you would want to store those json files in a volume https://docs.railway.app/guides/volumes
otherwise changes to those json files that are made wont persist between deployments.
or in the most ideal scenario, use a database like postgres.
ahh shucklebutts ðŸ˜
yea im like running an sqlite db
same goes for that, you would need to store that sqlite database file in a volume
alright perfect ill see if that works and get back hold on
sounds good
ok i feel like im tripping
i added one for the json
but now hte option is no longer popping up
does that mean i can only have one vol
thats correct
alr\
@Brody
i love you
your a beautiful man
lol thanks
got everything working
awsome, that was fast
ok wait one more question
if i push something from the github repo
will it maintain the volume
no matter what
yes, unless you have done something wrong, like accidently wrote code that deleted files in the volume
alright perfect ty, you've been like genuinely sm help
happy to help 🙂
@Brody hello
im back
i need you
the bot is running, and it's checking through a script to see if a userid is in the sqlite db
if it isnt it adds it
if it is it resumes code that works fine
however i think the issue is that since the script is checking a volume and the script isnt it the volume, its bugging out
am i crazy
second question can i just put everything in a volume
the script not being in the same location as the database would pose no real issues provided everything was done right, so please show any errors you are getting
not quite how it works
thats the weird part
its just not running
like hold on
code issue then, but without any sort of logs there not too much I can help with
It runs whenever i dont host it on here
and logs properly
unfortunately that doesn't mean it's not a code issue
what's your volumes mount point
a folder with everything i need volumeifieid
i did a silly and i think i fucked it up
you aren't making much sense tbh
yea i know sorry im just like
running off a few hours of sleep give me like 1 sec
Okay sorry, so essentially i'm running a currency manager bot of railway. Whenever you want to add/give currency, it checks an sqlite db thats in the vol to see if the userid is there, if not it'll add the userid + the currency. however when i run it on railway, it just does nothing if it detects the user isnt in the sqlite db i was wondering if this has anything to do with volumes or is just a code issue
how do you know that the user is in the database? you created an empty volume and then your code would have created an empty database because one didn't exist
it turns the the target's @ into a userid and checks the entire thingy to see if it matches anything in the userid column
I'm not quite sure if that answers my question
if you are expecting the sqlite database in the volume to be the same as the one in github you are mistaken
yea no i get that fs
so the database in the volume would be a fresh empty database, unless your app is capable of importing data to it?
well yes, but it should persist the changes i do to it
how are you doing "the changes"
as in adding/removing
?
anything, how do you think you are making changes to the database
if thats what your asking for
not really, I'm asking for a more broad overview, because right now it seems like you're just interacting with an empty database
i probably am sounding very slow rn but i am so lost
or you aren't interacting with a database on the volume at all, because you have gotten your paths incorrect
what is the volumes mount point
well no
its /assets which is where the db, the functions that assist the db and anything else that needs to be in a volume is
whenever a id that is already in the sqlite db is pulled it works perfectly
what is the volumes mount point
show me the code that opens the sqlite database
ok
sorry but that's not at all what I asked for
oh my god yea sorry hold on
nixpacks or dockerfile?
nixpacks
then your mount point is wrong
it should be
/app/assets
uh okay hold on ill try that
uhh
idk i dont think so
your mount point is wrong, please read the docs I linked
it's not locating anything in the volume when i call it using the updated mountpoint
the volume is empty, therefore the assets folder is now going to be empty
your database being stored in the assets folder is not ideal anyway, it should be stored in a separate more applicably named folder
so.. what do i do? how do i make the assets folder.. not empty ðŸ˜
mount the volume somewhere else like
/app/data
then access the database from data/data.sqlite
so every time i call something from the original folder i have to add /app infront of it
no
because the db is not the only thing in a volume, so im confused
what else do you think is in the volume?
all of these is what i have persisting in the volume
i want*
none of those files are in the volume, what makes you say that
i think you may be misunderstanding the concept of a volume
i am ðŸ˜
do this please
ok
now im getting errors about no tables
in the sqlite db
yes because it's an empty database
empty volume, empty database
ok
it would be must simpler to just use postgres
im not sure how to use that
so with volumes to be sure, when i put it in a volume its gonna start off empty no matter
what
yes, empty volume, empty database
you can pre load stuff into the volume but it's not straightforward
ok, is there documentation for that
no it's more so I tell you how to do it, but I would like to avoid that if possible, and instead ask you to abandon sqlite and use postgres or mysql
ah
ok
ill come back in a bit i need a nap tysm