screenshot-to-code icon indicating copy to clipboard operation
screenshot-to-code copied to clipboard

Add detailed self-hosting instructions

Open mritunjayagarwal opened this issue 1 year ago • 18 comments

Can anyone share me the steps to host this on my own domain? I am not very much familiar with docker and its deployments.

mritunjayagarwal avatar Dec 16 '23 21:12 mritunjayagarwal

You can use Docker to deploy this. But you can also just deploy it without Docker. The front-end is a simple react app, and the backend is a simple FastAPI Python server. I deployed it on Render for https://screenshottocode.com

If someone wants to write up more detailed instructions, please do, and I'll add it to the README.

abi avatar Dec 17 '23 02:12 abi

The server keeps crashing on Render

mritunjayagarwal avatar Dec 21 '23 14:12 mritunjayagarwal

Would Google the error

abi avatar Dec 21 '23 14:12 abi

Its not like that. It boots up and then stops the script I'll share my configurations

mritunjayagarwal avatar Dec 21 '23 14:12 mritunjayagarwal

Web capture_21-12-2023_201047_dashboard render com

mritunjayagarwal avatar Dec 21 '23 14:12 mritunjayagarwal

I'm just saying it's impossible to debug something if you don't share logs.

abi avatar Dec 21 '23 14:12 abi

==> Deploying... ==> Using Node version 20.10.0 (default) ==> Docs on specifying a Node version: https://render.com/docs/node-version ==> Running 'poetry run uvicorn main:app --reload --port 7001' INFO: Will watch for changes in these directories: ['/opt/render/project/src'] INFO: Uvicorn running on http://127.0.0.1:7001/ (Press CTRL+C to quit) INFO: Started reloader process [41] using StatReload ERROR: Error loading ASGI app. Could not import module "main". Deploy cancelled ==> Deploying... ==> Using Node version 20.10.0 (default) ==> Docs on specifying a Node version: https://render.com/docs/node-version ==> Running 'poetry run uvicorn main:app --reload --port 7001' INFO: Will watch for changes in these directories: ['/opt/render/project/src/backend'] INFO: Uvicorn running on http://127.0.0.1:7001/ (Press CTRL+C to quit) INFO: Started reloader process [43] using StatReload INFO: Started server process [47] INFO: Waiting for application startup. INFO: Application startup complete.

mritunjayagarwal avatar Dec 21 '23 14:12 mritunjayagarwal

ERROR: Error loading ASGI app. Could not import module "main".

mritunjayagarwal avatar Dec 21 '23 14:12 mritunjayagarwal

This is my backend deployment on Render

Screenshot 2023-12-21 at 2 01 21 PM

env var

Screenshot 2023-12-21 at 2 01 55 PM

abi avatar Dec 21 '23 19:12 abi

Why are you trying to deploy it on Render instead of just running it locally? The docker set up should be easy

abi avatar Dec 21 '23 19:12 abi

This is my backend deployment on Render

Screenshot 2023-12-21 at 2 01 21 PM env var Screenshot 2023-12-21 at 2 01 55 PM

All other fields are default?

mritunjayagarwal avatar Dec 21 '23 19:12 mritunjayagarwal

Yes, I think so. Make sure root dir is backend and then you'd deploy frontend separately.

abi avatar Dec 21 '23 19:12 abi

Sure. I am trying it

mritunjayagarwal avatar Dec 21 '23 19:12 mritunjayagarwal

Build succeeded.

==> Build uploaded in 9s ==> Build successful 🎉 ==> Using Node version 20.10.0 (default) ==> Docs on specifying a Node version: https://render.com/docs/node-version ==> Running 'poetry run uvicorn main:app --reload --port 7001' INFO: Will watch for changes in these directories: ['/opt/render/project/src'] INFO: Uvicorn running on http://127.0.0.1:7001/ (Press CTRL+C to quit) INFO: Started reloader process [41] using StatReload ERROR: Error loading ASGI app. Could not import module "main".

I am having this module missing error.

mritunjayagarwal avatar Dec 21 '23 19:12 mritunjayagarwal

Everything worked fine. @abi Only the timeout occurs after 15mins and deployment is automatically cancelled. Last log is application startup complete

I have used a web service instance on render

Is there any other setting to stop this timeout

mritunjayagarwal avatar Dec 22 '23 04:12 mritunjayagarwal

This issue is resolved

mritunjayagarwal avatar Dec 23 '23 17:12 mritunjayagarwal

Going to leave it open so someone can add in a doc with more detailed instructions.

Glad it's solved for you!

abi avatar Dec 23 '23 21:12 abi

Hi all!

I am using this tool internally at my company (thanks @abi and all the contributors). We are self-hosting and have access locked down to specific folks. Here is a comprehensive guide on how do it securely using Cloudflare on a generic VPS:

https://jonathanadly.com/guide-to-securing-your-self-hosted-open-source-ai-app

(happy to open a PR and put the recipe section somewhere in the docs. Just let me know - because this guide is probably a bit advanced)

Jonathan-Adly avatar Jul 07 '24 17:07 Jonathan-Adly