Litestar command not found
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
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
(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.GitHub
GitHub - Faolain/mypy-monorepo
Contribute to Faolain/mypy-monorepo development by creating an account on GitHub.
GitHub
GitHub - litestar-org/litestar: Light, Flexible and Extensible ASGI...
Light, Flexible and Extensible ASGI API framework | Effortlessly Build Performant APIs - GitHub - litestar-org/litestar: Light, Flexible and Extensible ASGI API framework | Effortlessly Build Perfo...
Solution:Jump to 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!
97 Replies
Project ID:
a9d07b8e-7f49-495c-83b4-81779c722734
a9d07b8e-7f49-495c-83b4-81779c722734
does that template you linked even work?
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-4ccbe62e1f4eyou are not able to view logs for a public project
please try deploying that template yourself
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 tooyeah 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
ah that's okay, any suggestions on how to solve the error re: command not being found?
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
really appreciate it
If it's helpful their most up-to-date e2e example repo is here https://github.com/litestar-org/litestar-fullstack
GitHub
GitHub - litestar-org/litestar-fullstack: Litestar Fullstack Refere...
Litestar Fullstack Reference Application with Vue, Vite, and SQLAlchemy, Docker, Task Queues, and more! - GitHub - litestar-org/litestar-fullstack: Litestar Fullstack Reference Application with Vue...
will see what i can do, no promises, im not even a python dev
if you need any assistance lmk!
haha you came here for assistance
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.
so do you prefer
pyproject.toml
over a requirements.txt
file?correct (preferring pyproject.toml)
it deploys just fine, but please tell me if ive done something wrong
https://railway.app/template/Chc5nL
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?
are you associated with the litestar team?
looking at the repo now seems like there have been some pretty significant changes/removalsyeah, there was too much junk
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
well they probably wont like that i called some stuff in the repo junk lol
repo was just too cluttered imo
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
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
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?
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?
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-composealso, it used a lot of memory? is that normal?
how much memory?
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
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?
let me check
2.98gb
that seems extremely high/out of the ordinary, this is on the litestar service itself that you deployed as is?
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?
yep!
I'm not doing anything out of the ordinary right?
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
and I'm just doing a run-all with a host and port so railway can proxy to it
really really appreciate all this again!
thank you, I can't publish this template as it stands if it uses 3gb of memory lol
that's 30$
understood
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
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?
Following
will do some testing later tonight, I'm away from the computer for today
Thanks Brody!
Can confirm I launched the same template and see ~3gb of memory usage
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
@Coffee anything come to mind here?
that's a lot of workers?
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
GitHub
litestar-fullstack/src/app/cli.py at 0ef30d73d4c5622ce2da94b882ba82...
Litestar Fullstack Reference Application with Vue, Vite, and SQLAlchemy, Docker, Task Queues, and more! - litestar-org/litestar-fullstack
that function may actually return 33
https://utilities.up.railway.app/stats
note: I am not on the pro plan
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)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
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!
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)
looks like that did it ๐
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?
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
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
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
I asked the team directly in our chat, I will let you know what they say if they get back to me
appreciate it thanks so much again for everything Brody!
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
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)
so would you two say that the template is public ready? and should I add back the stuff I removed?
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
will do, i will rebase my repo and add only the stuff needed to get it running on railway
amazing thanks so much Brody, maybe you can make a PR as well upstream too once you do?
if thats something the litestar team would be interested in, i can for sure do that
just figured if it was already done why not make the PR but figure up to you haha
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?
templates plural? What do you mean directly, sorry. afaik both templates have base repos with railway deployment in mind
neither of these templates will deploy
their repo lacks a proper build plan, and most of your template variables are incorrect/not ideal
specifically the
DB_URL
and REDIS_URL
variablesusing
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-functionsSorry ๐ฌ 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
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
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
of course, id only add the stuff required to run it on railway
you would accept a pr for this nixpacks stuff right?
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
GitHub
Enhancement: Deployment Guide for Railway ยท Issue #58 ยท litestar-or...
Summary Deployment Guide for Railway Basic Example No response Drawbacks and Impact No response Unresolved questions No response
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)
you just give me a link to the base repo and ill pr it ๐
GitHub
GitHub - litestar-org/litestar-fullstack: Litestar Fullstack Refere...
Litestar Fullstack Reference Application with Vue, Vite, and SQLAlchemy, Docker, Task Queues, and more! - GitHub - litestar-org/litestar-fullstack: Litestar Fullstack Reference Application with Vue...
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
I think he is yes
amazing!
@Coffee https://github.com/litestar-org/litestar-fullstack/pull/67
let me know if i did anything wrong lol
Brody do you happen to have this template available somewhere? Looks like the link is now dead
thank you
no problem