Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy an online demo website like “https://marimo.app/” on my own server #2153

Closed
1 of 4 tasks
Viper373 opened this issue Aug 29, 2024 · 9 comments
Closed
1 of 4 tasks
Labels
documentation Improvements or additions to documentation

Comments

@Viper373
Copy link

Documentation is

  • Missing
  • Outdated
  • Confusing
  • Not sure?

Explain in Detail

Dear marimo development team:

Hello, I'm a Chinese github user, I've read the marimo deployment docs, and I can't seem to find a suitable deployment method.

Your Suggestion for Changes

My requirement is to deploy an online demo website like “https://marimo.app/” on my own server (so that my friends can program online via my website , preferably via docker, so that I can bind a custom domain name via reverse proxy, it's okay if it's not docker).

Would you please provide me with a suitable deployment plan with detailed steps or other alternatives?

@Viper373 Viper373 added the documentation Improvements or additions to documentation label Aug 29, 2024
@mscolnick
Copy link
Contributor

Hi @Viper373 - would any of these deployment options work for you https://docs.marimo.io/guides/deploying/index.html#deploying

@Viper373
Copy link
Author

Forgive me for taking the liberty!

I've tried deploying with docker, is there any requirement for me to create my own app.py, such as importing certain modules or writing some code?

Also, does docker deployment only require dockerfile, app.py, requirements.txt?

Finally, is there any support for reverse proxy so I can bind marimo to my own domain?

A million thanks for your help!

@mscolnick
Copy link
Contributor

hey @Viper373 - yep dockerfile, app.py, requirements.txt, at a minimum. There is sample Dockerfile in the docs.

If you can set up a reverse proxy, we have a flag --proxy you may want to use for the reverse proxy.

@mscolnick
Copy link
Contributor

Going to close - let me know if you have more questions or hop in our discord https://marimo.io/discord

@Viper373
Copy link
Author

Viper373 commented Sep 5, 2024

hey @Viper373 - yep dockerfile, app.py, requirements.txt, at a minimum. There is sample Dockerfile in the docs.

If you can set up a reverse proxy, we have a flag --proxy you may want to use for the reverse proxy.

@mscolnick
I'm sorry to bother you again, unfortunately I'm having problems again.
I've got app.py, requirements.txt, dockerfile all ready to go!
below:

  • app.py
# -*- coding: utf-8 -*-
#
# 作者:Viper3
# 邮箱:[email protected]
# 文件:app.py
# 网址:viper3.top
#
# 版权所有(c)2023-2024 Viper3。保留所有权利。
#
# 此站点基于marimo docker 部署。有关详细信息,请参阅marimo.io。
#
# 说明:
# 这是一个基于marimo部署的未来化jupyter在线编辑器。
#
# 用途:
# 运行此脚本以执行应用程序。

def main():
    """
    主程序入口
    """
    print("Welcome Viper3's Marimo!")


if __name__ == "__main__":
    main()
  • requirements.txt
# 主框架
marimo

# 数据分析和科学计算
numpy
pandas
scipy
matplotlib
seaborn
dask
pyarrow
jupyter

# 机器学习
scikit-learn
xgboost
lightgbm
catboost
onnx
tensorflow-addons

# 网络请求
requests
httpx
beautifulsoup4
aiohttp

# API
fastapi
uvicorn

# 数据库操作
sqlalchemy
psycopg2-binary
mysql-connector-python
pymysql
pymongo
redis

# 安全和加密
cryptography
pyjwt

# 任务调度
celery

# 测试
pytest
coverage
hypothesis
tox

# 文件处理
pydantic
pyyaml

# 实用工具
click

# 爬虫
scrapy
DrissionPage
lxml
html5lib
pyquery
requests-html
parsel
fake-useragent

# 日志
loguru
rich
  • dockerfile
# syntax=docker/dockerfile:1.4

# Choose a python version that you know works with your application
FROM python:3.9-slim

WORKDIR /app

COPY --link requirements.txt .
# Install the requirements
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/

# You may copy more files like csv, images, data
COPY --link app.py .
# COPY . .



EXPOSE 7832

# Create a non-root user and switch to it
RUN useradd -m app_user
USER app_user

CMD [ "marimo", "run", "app.py", "--host", "0.0.0.0", "-p", "7832" ]

I've successfully pulled the image, which is about 2G in size, and then I start the container and error with the following log:

Traceback (most recent call last):
  File "/usr/local/bin/marimo", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/marimo/_cli/cli.py", line 582, in run
    codegen.get_app(name)
  File "/usr/local/lib/python3.9/site-packages/marimo/_ast/codegen.py", line 230, in get_app
    raise MarimoFileError(f"{filename} missing attribute `app`.")
marimo._ast.codegen.MarimoFileError: app.py missing attribute `app`.

The hints in the logs are clear, the problem is in app.py, it seems that no marimo related code is written, is this problem mentioned in the documentation?
Can you please give me a sample app.py?

@mscolnick
Copy link
Contributor

yes, app.py needs to be a marimo application. one that is created with marimo edit

@Viper373
Copy link
Author

Viper373 commented Sep 6, 2024

yes, app.py needs to be a marimo application. one that is created with marimo edit

I'd like to know what the sample app.py looks like.
Thanks!

@akshayka
Copy link
Contributor

akshayka commented Sep 6, 2024

I think maybe there is some confusion.

It seems like you don't have an existing marimo notebook.

Instead, you want to deploy an interactive code editor scratchpad - basically, you want to deploy something like marimo.app. Is that correct?

If you want to deploy a server that allows people to edit notebooks ("edit server"), there are some instructions here: https://docs.marimo.io/guides/deploying/index.html#deploying-an-edit-server. For this case there is no app.py.

In particular, you should not follow the instructions about deploying as read-only apps, because it doesn't seem like you want that functionality.

@Viper373
Copy link
Author

Viper373 commented Sep 6, 2024

I think maybe there is some confusion.

It seems like you don't have an existing marimo notebook.

Instead, you want to deploy an interactive code editor scratchpad - basically, you want to deploy something like marimo.app. Is that correct?

If you want to deploy a server that allows people to edit notebooks ("edit server"), there are some instructions here: https://docs.marimo.io/guides/deploying/index.html#deploying-an-edit-server. For this case there is no app.py.

In particular, you should not follow the instructions about deploying as read-only apps, because it doesn't seem like you want that functionality.

Much appreciated!

I've pulled the mirror “marimo-team/marimo:latest-sql” as deployed on railway, and then bound the domain “marimo.viper3.top” through a reverse proxy, could you please visit the site and help me check if the deployment is correct and complete!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants