inlinegamesbot icon indicating copy to clipboard operation
inlinegamesbot copied to clipboard

Help deploying to fly.io

Open junaidookay opened this issue 1 year ago • 7 comments

Hi,

First of all thank you so much for this amazing repository, wouldn't have been able to build something like this on my own. So, I started playing around with it. I started by deploying this app to Google cloud but it didn't work with telegram even though everything else was working fine. I could run *.appspot.com/admin?a=install and *.appspot.com/admin?a=set etc but I think I am missing something which links the app with telegram.

Now, I am trying to deploy it using fly.io. The app has been deployed and is running. Whenever I visit the app on my browser, it takes me to your Github repository like it should with index.php. But it doesn't work with telegram bot. I have followed your instructions to deploy the app to fly.io. I have been trying so hard to figure out what's wrong but all in vain so far. Any help would be greatly appreciated.

P.s. I am new to Php, fly.io and Google Cloud. Trying something new as normally I work with react apps as a hobby.

Any help would be greatly appreciated. Thank you.

junaidookay avatar Jan 10 '24 18:01 junaidookay

Perhaps you skipped the steps where you define secret variables or set them to empty values.

Maybe something changed since the last time I used their service and there is extra step to be done...

jacklul avatar Jan 11 '24 08:01 jacklul

I followed this guide exactly for fly.io with a few changes as I did not understand the Procfile line and Bot_Secret is foreign for me. Maybe this is where I messed up. If you can help then it would be great.

flyctl apps create flyctl volumes create data --size=1 flyctl secrets set BOT_TOKEN= flyctl secrets set BOT_USERNAME= flyctl secrets set BOT_WEBHOOK=YOUR-APP-NAME.fly.dev flyctl secrets set BOT_SECRET= (Set to null) If you want to use web+worker setup you have to replace web: line in Procfile (Skipped) flyctl deploy

junaidookay avatar Jan 11 '24 09:01 junaidookay

If I remember correctly you have to set BOT_SECRET to something otherwise it will not reply to telegram updates. It has to be some kind of random string and must be kept private. The Profile modification enables scheduled cleanup of games to not exhaust storage or database space. Recommended to not skip that step - just do what it says - comment the other line while uncommenting the commented one in that file.

jacklul avatar Jan 11 '24 13:01 jacklul

Thank you for that. It worked.

Will the bot work just fine without the database setup? It's mentioned as optional inside .env. If not then let me know do I just need to edit the .env file for the database or not. And is there anything that I can skip inside the .env? Thanks once again.

junaidookay avatar Jan 11 '24 18:01 junaidookay

In fly.io it will use that 1GB volume drive you added, files will be used as database. Without the step about Procfile modification you will eventually run out of space

jacklul avatar Jan 11 '24 19:01 jacklul

Understood. The bot is working but when I invite myself from other phone.. it just keeps loading and the games never show up to select from. Anything I can do to fix it? I am guessing this is the last thing stopping me from successfully marking this adventure as complete.

junaidookay avatar Jan 11 '24 20:01 junaidookay

Pretty sure you gotta enable inline mode in the BotFather

jacklul avatar Jan 11 '24 20:01 jacklul