cheran-senthil / TLE

🤖 Discord Bot for Competitive Programming
https://discordapp.com/invite/2CJ6qvY
MIT License
318 stars 202 forks source link

add requirements.txt and Aptfile, so that anybody can easily deploy this bot on heroku #458

Closed iampjeetsingh closed 3 years ago

iampjeetsingh commented 3 years ago

I tried to deploy this bot on heroku, I put all the apt dependencies listed in readme into Aptfile (apt community buildpack) and poetry in requirements.txt but it gives so many errors while deploying, I extracted some of them and listed them below

EnvCommandError
Command ['/app/.cache/pypoetry/virtualenvs/tle-9ds0h-py3.7/bin/pip', 'install', '--no-deps', '/app/.cache/pypoetry/artifacts/f1/06/a9/90e3e339cac8cb4c3ecdscewcewcewc23e4vfv9075d42ab/pycairo-1.20.0.tar.gz'] errored with the following return code 1, and output:
Building wheel for pycairo (PEP 517): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /app/.cache/pypoetry/virtualenvs/tle-9ds0h-py3.7/bin/python /app/.cache/pypoetry/virtualenvs/tle-9ds0h-py3.7/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpq3_fly8t
Package gobject-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing gobject-2.0.pc to the PKG_CONFIG_PATH environment variable
Package 'gobject-2.0', required by 'cairo', not found
ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly
import discord
ModuleNotFoundError: No module named 'discord'
fishy15 commented 3 years ago

I have been working on this, but I haven't had much time recently due to exams. In the mean time, you can use a limited version of the bot from here: https://github.com/fishy15/tle. The bot currently supports most features, but the commands related to duels and ratedvc do not work due to database issues. Once these issues are fixed, the database will likely need to be modified manually. For most other purposes, the bot works in its current state.

There is also an issue where the bot exceeds the Heroku memory limit in certain situations. This issue arises when the ratedList is queried from Codeforces since this plus the memory needed to run the bot exceeds the memory limit. Our solution to this was to host an API proxy that filters the result of the query, but due to the limitations on the bandwidth, it is better if each instance of the bot has its own proxy set up. I believe that this is not an issue if your server is small enough, so the bot should be safe to use in most servers currently. In any case, once the above repo reaches feature parity with the main TLE branch, I will include instructions on how to set up this proxy if needed.

If you have any questions about setting up the bot, you can message me on Discord on fishy15#6575.

iampjeetsingh commented 3 years ago

Docker file is sufficient to deploy it.