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 to Netlify or similar alternative #40

Open
gamberoillecito opened this issue Feb 19, 2024 · 3 comments
Open

Deploy to Netlify or similar alternative #40

gamberoillecito opened this issue Feb 19, 2024 · 3 comments

Comments

@gamberoillecito
Copy link

Hi, I've been trying to deploy the bot and web app on netlify but I'm having a hard time making everything work.
Do you think that this can be done easily?

I think what is currently missing is a way to configure the variables in .env. I have no experience with netlify but it looks like it is possible to do something similar with a netlify.toml file. I used this guide as a reference. Could it just be just a matter of swapping the .env with netlify.toml?

The other thing I currently do not understand is wether I can host both the bot and the webapp at the same time.

I think it could be really useful to be able to easily deploy you app with such a service and I might be happy to take a look into it if it's not too difficult.

Is there any easier solution available or something else that I'm missing?

@gamberoillecito
Copy link
Author

@deptyped good news, I was able to deploy to Netlify without needing to edit anything but I don't know what to set the webhook url to, how can everything still work? What is the webhook for?

Loose steps I followed (let me know if you need precise steps):

  1. Follow steps 1 to 3 in the readme as if you wanted to setup everything locally
  2. In your main Netlify page add a new site with "Deploy manually", this will be the web app
    immagine
  3. Drag and drop the dist (web-app/dist) folder when asked to do so by netlify
  4. Copy the url of the created website, if everything went well opening the website in the browser should show a blank page
  5. Edit the .env file and as WEB_APP_URL use the url from step 4.
  6. Create another website in netlify in the same way as before but this time drag and drop the bot folder (src/bot), this will host the bot

@deptyped
Copy link
Owner

Thanks for sharing! Unfortunately I don't have enough experience with Netlify. As far as I know, Netlify requires some Netlify-specific code to handle requests, and the bot will not work without code changes.

What is the webhook for?

To receive and process updates from Telegram. This is necessary for processing commands in the chat interface, such as /start. If web app that can be launched with menu button is enough for you, you can skip the bot deployment.

In the case of Netlify, in BOT_WEBHOOK you need to set url to the Netlify Function that runs the bot (not the web app).

6. Create another website in netlify in the same way as before but this time drag and drop the bot folder (src/bot), this will host the bot

src/bot is not enough, you need to deploy the entire repository (except web-app/ directory) to host the bot.

@gamberoillecito
Copy link
Author

src/bot is not enough, you need to deploy the entire repository (except web-app/ directory) to host the bot.

Ok so basically the bot does not work in my case 🤣. I was a bit suspicious that everything worked without any intervention but I wasn't bothered to investigate more. I thought that since the button was working the bot had to work as well.
I don't really need anything more than this.

Thank you very much again for you help

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

No branches or pull requests

2 participants