R
Railway

βœ‹ο½œhelp

Litestar command not found

FFaolain8/25/2023
Hey all apologies for the possibly silly question. I am looking to deploy this repo: https://github.com/Faolain/mypy-monorepo specifically what is within the packages/backend folder which is a python litestar(https://github.com/litestar-org/litestar) application (a web framework like flask/django/fastapi) but I'm running into an issue where the build log appears to be fine but the deploy log states /bin/bash: line 1: litestar: command not found (wherein litestar is the start command).

This monorepo is a slight modification of this very same repo https://railway.app/template/KmHMvQ (just instead I have setup mine within a monorepo) however even when I tried to deploy this original template as is, I also see the /bin/bash: line 1: litestar: command not found issue. I was wondering what could be wrong and how this could be fixed? For reference running this start command locally does work within the folder.
Solution:
so wanna try passing 2 as the number of workers to --http-workers? you can just edit the start command in the nixpacks.toml file!
Jump to solution
FFaolain8/25/2023
a9d07b8e-7f49-495c-83b4-81779c722734
BBrody8/25/2023
does that template you linked even work?
FFaolain8/25/2023
It does not appear to but I am unable to confirm if it is experiencing the same litestar command not found error since the deploy logs tab stays loading but never displays the error (for that template) https://railway.app/project/cc97006c-2dc9-422d-9c8f-2ec9fff36fd3/service/119bc432-d70b-4f31-b886-24f2c5f89e86?id=830780ed-31ed-4506-b666-4ccbe62e1f4e
BBrody8/25/2023
you are not able to view logs for a public project
please try deploying that template yourself
FFaolain8/25/2023
yes I tried doing that already (deploying the template myself) and got the same Litestar command not found seen on the monorepo application as well (in the initial message) which is why I expect the original template has that issue too
BBrody8/25/2023
yeah it appears like that template creator did not know what they are doing, theres nothing wrong with that, but they shouldn't have published the template if they didnt know what they where doing
FFaolain8/25/2023
ah that's okay, any suggestions on how to solve the error re: command not being found?
BBrody8/25/2023
and i don't either, so i will have to do some research and get back to you on this, hopefully with a working litestar example
FFaolain8/25/2023
really appreciate it
If it's helpful their most up-to-date e2e example repo is here https://github.com/litestar-org/litestar-fullstack
BBrody8/25/2023
will see what i can do, no promises, im not even a python dev
FFaolain8/25/2023
if you need any assistance lmk!
BBrody8/25/2023
haha you came here for assistance
FFaolain8/25/2023
always down to help someone help me πŸ˜… , I can maybe message someone from the litestar team to also give a look if you need help as well.
BBrody8/25/2023
so do you prefer pyproject.toml over a requirements.txt file?
FFaolain8/25/2023
correct (preferring pyproject.toml)
BBrody8/26/2023
it deploys just fine, but please tell me if ive done something wrong
https://railway.app/template/Chc5nL
FFaolain8/26/2023
Really appreciate it Brody, amazing turnaround. Will send to litestar team, looking at the repo now seems like there have been some pretty significant changes/removals. Are those all necessary or is it just the nixpacks.toml, railway.json, and the .env changes?
BBrody8/26/2023
are you associated with the litestar team?
looking at the repo now seems like there have been some pretty significant changes/removals
yeah, there was too much junk
FFaolain8/27/2023
I am not but active in their discord, and looking to contribute where I can as it seems like one of the most promising python frameworks with an extremely active developer community
BBrody8/27/2023
well they probably wont like that i called some stuff in the repo junk lol
repo was just too cluttered imo
FFaolain8/27/2023
fair enough, I think the fullstack starter repo there is so that anyone can get setup in an opinionated fashion, to setup a production app. (for example the github actions, vscode settings for localized optimal development, among other commands)

In any case last question while I get familiarized with this setup, really appreciate it all again, was just wondering how railway knows to setup redis or postgres? I see that railway doesn't support docker-compose yet and was under the impression it was originally doing that
BBrody8/27/2023
ah I just clicked the postgres and redis options while making the template
then railway will auto add the reference variables to the service when you deploy the template
FFaolain8/27/2023
hmm I see, appreciate it brody! The only reason I ask is that it seemed a bit like "magic" wherein I thought it would be a bit more declarative looking at the codebase, railway would "know" what services to deploy as is, without template interaction. Along these lines in the original litestar template they have a worker also deploy alongside via docker-compose. Is there any suggested way to do this with railway?
BBrody8/27/2023
yeah I used run-all, but if you wanted another service you just make another service and update the start command accordingly
question for you now, did I remove anything crucial to the apps functionality?
FFaolain8/27/2023
Not that I'm aware of, just poking around at the moment! Really great stuff here πŸ™‚ fwiw this repo is sort of like the reference repo where litestar apps are deployed so if this is done correctly then it's likely to get pushed upstream and lead to a lot of litestar app deployments on railway (good for both)
Ah yeah was just gonna type that I saw you made it a run-all in order to group both. Sorry for being annoying just getting familiarized, are there any plans to make the service creation (or maybe already exists) more declarative via code itself? The equivalent to a docker-compose
BBrody8/27/2023
also, it used a lot of memory? is that normal?
FFaolain8/27/2023
how much memory?
BBrody8/27/2023
railway wants to support docker compose at some point, but it's complicated, and as far as I know none of the other top railway competitors support docker compose either
until railway supports it, template creators will just deconstruct the compose file and manually translate it into railway services
FFaolain8/27/2023
Yeah gotcha just having something whether it's docker compose or something else (though ofc docker-compose is preferable due to cross-compatibility and support to deploy outside of PaaS) removes some of the "magic" in setup and makes things a bit more expected/auomated in deployments
yep fair enough!
btw happen to have a number on this?
BBrody8/27/2023
let me check
2.98gb
FFaolain8/27/2023
that seems extremely high/out of the ordinary, this is on the litestar service itself that you deployed as is?
BBrody8/27/2023
well its not as is, I did remove a bunch of stuff, and added the nixpacks.toml and railway.json file
you've read both those config files right?
FFaolain8/27/2023
yep!
BBrody8/27/2023
I'm not doing anything out of the ordinary right?
FFaolain8/27/2023
not that I can see at face value no
I will dig in a bit more on this tomorrow/ask the litestar team as well if this is normal
BBrody8/27/2023
and I'm just doing a run-all with a host and port so railway can proxy to it
FFaolain8/27/2023
really really appreciate all this again!
BBrody8/27/2023
thank you, I can't publish this template as it stands if it uses 3gb of memory lol
that's 30$
FFaolain8/27/2023
understood
BBrody8/27/2023
have you tried running litestar run-all locally? because I haven't ran litestar locally at all, curious to see how much ram it uses locally
FFaolain8/27/2023
Just ran it locally ~100-200mb, do you happen to see anything going on in the logging? / do you see an increase in memory usage over time which could indicate a memory leak?
BMBad Messages8/27/2023
Following
BBrody8/27/2023
will do some testing later tonight, I'm away from the computer for today
FFaolain8/27/2023
Thanks Brody!
FFaolain8/28/2023
Can confirm I launched the same template and see ~3gb of memory usage
FFaolain8/28/2023
BBrody8/28/2023
I wasn't able to test locally yesterday, was out all day
if you have any ideas why that could be so high I'm all ears
FFaolain8/28/2023
@Coffee anything come to mind here?
BBrody8/28/2023
that's a lot of workers?
BMBad Messages8/28/2023
Be default the worker count is equal to the number of cores available iirc.. you maybe want to pass 1-2 instead.
https://github.com/litestar-org/litestar-fullstack/blob/0ef30d73d4c5622ce2da94b882ba82935b0c284e/src/app/cli.py#L87-L94
BBrody8/28/2023
that function may actually return 33
https://utilities.up.railway.app/stats
note: I am not on the pro plan
FFaolain8/28/2023
and there are indeed 33 'Started server process logs in the deploy logs (also on the hobby plan not pro)
So I guess @Brody multiprocessing.cpu_count() returns 32 on railway? (even for hobby instances)
FFaolain8/28/2023
BBrody8/28/2023
indeed it would, that's why railway calls it vcpu and not vcores
but of course your app would get a sigterm if it tried to use more resources than allowed
Solution
BBrody8/28/2023
so wanna try passing 2 as the number of workers to --http-workers? you can just edit the start command in the nixpacks.toml file!
FFaolain8/28/2023
maybe this could be made clearer on the railway docs page? as it seems from hobby only 8 are available (and both of our accounts are on hobby but it's seemingly using 32 no?)
doing so now, however I think you mean railway.json right? (Since that's what has the start command)
FFaolain8/28/2023
FFaolain8/28/2023
looks like that did it πŸ™‚
BBrody8/28/2023
while my code can see 32 vcpus, I would not be able to use more than 8 vcpu without my app getting killed, prompting me to upgrade to pro
yeah my bad, did mean railway.json
so 309mb is acceptable, correct?
FFaolain8/28/2023
yep far more normal! haha
interesting so if it were launched as such what would trigger/prompt the killing? is there any way railway can make this more obvious to the end user? Since it seems at face value only 8vcpu would ever be available just from the hobby plan page
BBrody8/28/2023
I really don't know why my app can see 32vcpu and well over 250gb of ram, I was just surprised as you are, and I'm sure some kind of docker deamon would watch for and kill any containers that use more resources than their plan allows
FFaolain8/28/2023
amazing detective work nevertheless, maybe something to pass along to the rest of the team? Probably can trip up other noobies who are onboarding onto railway
BBrody8/28/2023
I asked the team directly in our chat, I will let you know what they say if they get back to me
FFaolain8/28/2023
appreciate it thanks so much again for everything Brody!
BBrody8/28/2023
no problem, I would have never come to a solution if coffee didn't send that code snippet!!
I mean coffee said the solution, I just said why so many threads spawn lol
FFaolain8/28/2023
well you did after all create the nixpacks template in order to get it launched in the first place! would have never got to that point without it. But yeah I can imagine this won't be just a litestar thing, good for railway to know I guess to prevent overprovisioning of instances
see how great the litestar team is (I promise not being paid to shill haha)
BBrody8/28/2023
so would you two say that the template is public ready? and should I add back the stuff I removed?
FFaolain8/28/2023
I think adding back the stuff removed would be good, I think the community/litestar team could also update the repo upstream so that new devs can quickly get started also deploying an app on the "free" hobby instance
BBrody8/28/2023
will do, i will rebase my repo and add only the stuff needed to get it running on railway
FFaolain8/28/2023
amazing thanks so much Brody, maybe you can make a PR as well upstream too once you do?
BBrody8/28/2023
if thats something the litestar team would be interested in, i can for sure do that
FFaolain8/28/2023
just figured if it was already done why not make the PR but figure up to you haha
BBrody8/28/2023
will do!
ill have to ask fp to remove the current litestar template as its now clear to us they made no attempt to run the template on railway
wait
Jacob Coffee = @Coffee ??
@Coffee would you be interested in removing your templates for now until your base repo supports deploying directly to railway?
BMBad Messages8/28/2023
templates plural? What do you mean directly, sorry. afaik both templates have base repos with railway deployment in mind
BBrody8/28/2023
neither of these templates will deploy
BBrody8/28/2023
their repo lacks a proper build plan, and most of your template variables are incorrect/not ideal
BBrody8/28/2023
specifically the DB_URL and REDIS_URL variables
BBrody8/28/2023
using app.gov is also not the best idea, you should let the user fill those kinds of variables out themselves
LitestarRocks! as the secret key is not ideal either, you should use the ${{secret()}} template function
https://docs.railway.app/reference/templates#template-variable-functions
BMBad Messages8/28/2023
Sorry 😬 I don't think I am following on the build plan
What do you mean dont deploy? I deployed the Litestar w/ Tailwind one without issue (https://litestar-production-872f.up.railway.app/) https://railway.app/project/f126396d-42ac-4fea-90d4-5ad2e27a027a/service/ffc06993-a0d9-48c6-99bd-fd2a4092b65b
I know the Fullstack one has the issue of requiring users to change the url vars to match the service urls of the railway-deployed redis/postgres instances, but I wasnt 100% sure if there was a dynamic way to do this
to me build plan means adding the railway.json, but I am still learning this system/nixpacks/etc. so happy to do whatever you recommend
BBrody8/28/2023
okay let me ask you this, have you tried to deploy your litestar fullstack template? if you have, it wouldnt work
https://discord.com/channels/713503345364697088/1144691393357434980/1144698950583070862
this file is required to build the fullstack litestar app
https://github.com/brody192/litestar-fullstack-template/blob/main/nixpacks.toml
would you mind taking down your fullstack template in favor of my template? i would set everything up properly
with the dynamic database variables
BMBad Messages8/28/2023
ohh i see
neat
Sure, could you use the same template overview i have? just want to make sure i give credit to the original author before it was transfered into our org repo and we have the project links and usch
BBrody8/28/2023
of course, id only add the stuff required to run it on railway
you would accept a pr for this nixpacks stuff right?
BMBad Messages8/28/2023
Well
We actually have an open issue to add native railway support, but i'd like to instead move from my personal repo to the newly-transfered-into-org litestar-fullstack repo
https://github.com/litestar-org/litestar-fullstack/issues/58
So yes in that repo, we could just do all of that
and then write some docs (optionally for you, or we could later idc)
BBrody8/28/2023
you just give me a link to the base repo and ill pr it πŸ‘
BBrody8/28/2023
great, after my pr gets merged, i will create a template from that repo instead of my own repo
also, are you aware you are displaying the vue logo for both vite and vue links?
https://github.com/litestar-org/litestar-fullstack/blob/main/src/app/domain/web/resources/App.vue#L8-L11
BMBad Messages8/28/2023
I think he is yes
FFaolain8/28/2023
amazing!
BBrody8/28/2023
@Coffee https://github.com/litestar-org/litestar-fullstack/pull/67
let me know if i did anything wrong lol
FFaolain9/26/2023
Brody do you happen to have this template available somewhere? Looks like the link is now dead
FFaolain9/26/2023
thank you
BBrody9/26/2023
no problem

Looking for more? Join the community!

R
Railway

βœ‹ο½œhelp

Join Server
Recommended Posts
save temporary archivesCan i save temporary pdfs to a back-end host ? I'm trying to save a pdf file from a client upload bHow to host websockets?This is my first time hosting socket server, how can i do that on railway? I docs there are only webI cannot use opencv2 and received ImportError: libgl.so.1 cannot open shared object file no such filCan anyone help me with that ??LibreofficeHi I need libreoffice installed to use in my code. I attempted using the below nixpacks.toml ``` [Random app crash, no logs or other indicatorWhen trying my healtcheck I get random crashes, no recent deploy was made, I don't see any logs on mModify build commandHow would I modify the build command so it does a pip install of `psycopg2` ? I was told to remove tPayment method removalHey, how do I remove my payment method? I opted in for a credit subscriptions but still see my crediDeploying crashedHello, i'm facing a problem when deploying my spring boot application to railway, my application worInternal server error when accessing TypebotI noticed that since yesterday the new installations with the Typebot template present the error IntRAILWAY_PUBLIC_DOMAIN replaces RAILWAY_STATIC_URLHi team, we've been hunting down a bug with our app today, occurring on many PR Environments and it'My Subscription issueHello dear support guys: I found that I have been downgraded to No Subscription.. If my memory is rIs it normal for hello world json to return in 600ms? - GO FIBERHelp setting up a monorepoI'm getting this error when deploying my project. I made sure no other deployments are running, but Deployment and logging issues (Maven)Hello, My program is running fine locally, but when I deploy it with Railway, I start seeing issuesIssues with Postgres DBI don't really understand why I am not seeing any tables in my DB. Seeding works, but the database sversion 'GLIBC 2.29' not foundweird error that seems to be because of my code, but it works on my computer <:bing_shrug:5837915814Use rust nightlyidk how docker works but i cant use the nightly rust dockerfile image for some reasonFix Missing libuuid LibraryHey, I am currently runnig into problems deploying my FastAPI backend after adding a new dependency I can no longer connect to my MySQL database, even after restarting the databaseI'm not sure what my project id is. My link is this: https://railway.app/project/31b9ee92-06cc-44c1-RPC showing forbidden access 403Hi. I've got some crypto related script which pings an RPC server - it works fine locally but on rai