ftc45
ftc455mo ago

"kernel not found" when port forwarding

Hi! My labmates and I have created a Marimo notebook to accompany our paper. We are trying to deploy the notebook to AWS, but are facing some networking issues. I would like to be able to go to port 80 so that users don't have to specify a port number in their URL. I.e., the following link should work: http://ec2-3-19-54-159.us-east-2.compute.amazonaws.com/ However, it currently gives the error "kernel not found". I know the marimo notebook works because when I specify the port number directly I can access the notebook without issue: http://ec2-3-19-54-159.us-east-2.compute.amazonaws.com:8080/ Currently, I'm using pretty generic port forwarding configuration in Apache: <VirtualHost *:80> ProxyPreserveHost On ProxyRequests Off ServerName 3.19.54.159 ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ </VirtualHost> Do you know why this leads to a "kernel not found" error? FYI when I use a generic Hello World web application (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-container-image.html) the port forwarding works without issue, so I think it is something specific to Marimo.
lvof
a marimo app
lvof
a marimo app
Creating a container image for use on Amazon ECS - Amazon Elastic C...
Learn how to create a container image to use with Amazon ECS.
No description
No description
25 Replies
Akshay
Akshay5mo ago
Hey! Cool notebook. @dmad or @Myles Scolnick , any ideas? (Separately, we're starting a newsletter and social series where we spotlight work from the marimo community. Once this is up, we'd be happy to spotlight your notebook!)
dmad
dmad5mo ago
Cool! Nice to see @ftc45 how are you spinning up marimo? Through the FastAPI or directly with a background command / service? If it is the latter, you should be able to do
marimo run --proxy=userside.domain:80 --port=8080 myapp.py
marimo run --proxy=userside.domain:80 --port=8080 myapp.py
ftc45
ftc45OP5mo ago
I'm starting the process with the marimo run command in a Docker container. I didn't know about the --proxy flag so I'll try that and let you know if it works. Thanks! To be clear, the command I was running in the original post was: marimo run --port=8080 --host=0.0.0.0 lvof.py And I modified this command to be: marimo run --port=8080 --host=0.0.0.0 --proxy=0.0.0.0:80 lvof.py Since I didn't see any change in behavior, I also tried a couple variations of the domain (with and without the host flag) and none of the following made a difference: marimo run --port=8080 --proxy=0.0.0.0:80 lvof.py marimo run --port=8080 --host=3.19.54.159 --proxy=3.19.54.159:80 lvof.py marimo run --port=8080 --proxy=3.19.54.159:80 lvof.py marimo run --port=8080 --proxy=ec2-3-19-54-159.us-east-2.compute.amazonaws.com:80 lvof.py marimo run --port=8080 --host=ec2-3-19-54-159.us-east-2.compute.amazonaws.com --proxy=ec2-3-19-54-159.us-east-2.compute.amazonaws.com:80 lvof.py
dmad
dmad5mo ago
This one should work marimo run --port=8080 --proxy=ec2-3-19-54-159.us-east-2.compute.amazonaws.com:80 lvof.py What are your apache rules again?
Akshay
Akshay5mo ago
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName 3.19.54.159
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName 3.19.54.159
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>
We recently made our CORS allow origins policy much stricter. Idk if that's related. But marimo run lets you configure it:
--allow-origins TEXT Allowed origins for CORS. Can be repeated. Use * for all origins.
--allow-origins TEXT Allowed origins for CORS. Can be repeated. Use * for all origins.
Akshay
Akshay5mo ago
Streamlit
Configuring Apache 2.4 for proxy
update: loaded 2 extra proxy modules in apache fixed above issue. but drop to “please wait” for ever issue. LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so (enabled for streamlit) LoadModule proxy_module modules/mod_proxy.so (default loaded) LoadModule proxy_http_module modules/mod_proxy_http.so (enabled for streamlit) 8502 h...
ftc45
ftc45OP5mo ago
Thanks I’ll take a look at that link! I tried the allow-origins flag and that did not make a difference
Akshay
Akshay5mo ago
One of our users has successfully deployed their app on aws, without apache. I think they just used a load balancer, similar to https://medium.com/tfogo/how-to-serve-your-website-on-port-80-or-443-using-aws-load-balancers-a3b84781d730
Medium
How to serve your website on port 80 or 443 using AWS Load Balancers
Linux servers limit non-root processes from binding to ports less than 1024. That’s a problem if you want to serve a website over HTTP or…
Akshay
Akshay5mo ago
@ftc45 , any luck, or any new errors? If you still can't figure it out, I can take some time to try on my own
ftc45
ftc45OP5mo ago
I haven’t figured it out yet. I’m going to work on debugging a bit more tonight. After that if I can’t figure it out still I’ll share any more notes and it would be great if you could take a look. Thanks for being so responsive!
ftc45
ftc45OP5mo ago
I never got the port forwarding to work so I gave up on that. My original goal with the port forwarding was to containerize the application and then use a single EC2 instance to house multiple containers with different apps our lab creates and forward requests for each web app. This would still be great to do in the long run, but for now just hosting this notebook is sufficient. Since we didn't want to pay for a load balancer at the moment, for now I've just deployed the docker container directly to the EC2 instance by including the below script in user data. This way there's no manual work needed after deploying the VM.
#!/bin/bash
sudo yum install -y docker
sudo yum install git -y
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
cd /home/ec2-user
git clone https://github.com/we3lab/valuing-flexibility-from-water
cd ./valuing-flexibility-from-water
sudo service docker start
sudo docker build -t lvof .
sudo docker run --restart always -i -p 80:8080 lvof
#!/bin/bash
sudo yum install -y docker
sudo yum install git -y
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
cd /home/ec2-user
git clone https://github.com/we3lab/valuing-flexibility-from-water
cd ./valuing-flexibility-from-water
sudo service docker start
sudo docker build -t lvof .
sudo docker run --restart always -i -p 80:8080 lvof
We don't expect much traffic but I will see how robust it is by asking my colleagues to test it out. The result is here: http://ec2-18-119-106-207.us-east-2.compute.amazonaws.com/
lvof
a marimo app
Akshay
Akshay5mo ago
Thanks for the write-up! Glad you were able to get the notebook up in the end; hopefully it is scalable enough for your needs. We're compiling a list of awesome notebooks made by our community, and this one definitely makes the cut! We plan to post this list on our website or GitHub eventually. So if you have scalability problems, we can try to help. Finally, I should mention that we have an alpha "community cloud" that lets you host notebooks for free, with one caveat -- they have to work under WebAssembly. Taking a look at your notebook it's possible it would work. The community cloud is here: https://marimo.io/dashboard. I realize your lab may want to develop the capability of hosting notebooks on AWS, independent of this single notebook, but just thought I'd share in case it might be helpful!
ftc45
ftc45OP5mo ago
Thanks! We'd like to wait to spotlight the notebook until the accompanying paper is published, which should be sometime later this year. I will try to remember to reach out at that point so that you know we're ready, but if I forget feel free to reach out! In terms of scalability, one thing I noticed was that the notebooks occassionally crash with the exception ERROR: Exception in ASGI application Traceback. Since I set the Docker container to restart automatically this isn't a major issue, but I attached the full stack trace in case you're able to debug the issue.
Akshay
Akshay5mo ago
Thank you, that's helpful! And acknowledged on waiting for the spotlight
ftc45
ftc45OP3mo ago
Hi Akshay! I just wanted to reach back out and let you know the paper accompanying https://lvof.we3lab.tech should be published tomorrow, so if you'd like to spotlight our notebook at any point next week or later that would be great!
lvof
a marimo app
Akshay
Akshay3mo ago
Awesome, congratulations!! We'll spotlight it next week 🙂 @Fletch , let me know if there's any text you'd like me to include in describing the notebook/paper
ftc45
ftc45OP3mo ago
Thanks! Here's a blurb that my co-authors wrote: The Water Energy Efficiency & Environment (WE3) lab recently published a paper highlighting how ways we can operate water systems more effectively in a transitioning or decarbonizing electric grid. This paper featured many scenario analyses where the results were aggregated visualizations of high dimensional optimization problems. To help readers more closely interact with each data point, the authors deployed a web app with interactive visualizations using Marimo.
Akshay
Akshay3mo ago
@Fletch — we can share this tomorrow. Do you all have any social media presence, on Twitter/LinkedIn? Please let me know if you do and I'll make sure to tag you!
ftc45
ftc45OP3mo ago
Yeah our lab Twitter handle is @WE3Lab Thanks for spotlighting it!
Akshay
Akshay3mo ago
Yes of course! @Fletch , any personal handles you'd like me to tag as well, or just the lab handle? Additionally, it looks like the notebook site is down, I'm getting 504 Gateway Time-Out. If you like, you can host it on our community cloud and we can share that link (https://marimo.io/sign-in), or I can wait until the issue is resolved
ftc45
ftc45OP3mo ago
Whoops I took a look at the site and it should be back up now - thanks for letting me know! I’ll try to monitor it more closely once it’s spotlighted. Could you also tag the lead author Akshay Rao (@raodoesresearch)
Akshay
Akshay3mo ago
Will do! Will post shortly
Akshay
Akshay3mo ago
@Fletch , posted to Twitter: https://x.com/marimo_io/status/1841948653386399828 Had to shorten the blurb b/c Twitter. Hope it looks okay!
marimo (@marimo_io) on X
Spotlight on @WE3Lab 🌟 In Valuing Energy Flexibility from Water Systems, @Stanford researchers Rao (@raodoesresearch) and @WE3Lab coauthors study efficient operation of water systems in a decarbonizing grid Their accompanying marimo notebook brings their research to life💧⚡
From An unknown user
Twitter
ftc45
ftc45OP3mo ago
Looks great, thanks again!!
Akshay
Akshay3mo ago
of course! congrats on the paper 🙂