If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Heroku Hosting & Database

Started by cpaoutsourcing, Mar 10, 2023, 02:42 AM

Previous topic - Next topic

cpaoutsourcingTopic starter

For my Discord bot development on Heroku, I require a database. I have a few queries:

    Which database options are available?
    Is the chosen DB compatible with Heroku?
    Will the data in the database persist after restarting the project on Heroku?

Additionally, I plan to experiment with file system storage, but I have doubts about its success. (
I kindly request your assistance and would appreciate information about the database you have used in a similar scenario.
  •  


KelpyMson

To develop my bot for Discord, I utilize MySQL (which can be connected to Heroku for free by linking a bank card). However, it is also possible to establish a database connection without the plugin if you have an alternative service available.
  •  

anupriya

1. For python, I opt for MongoDB or pymongo.
2. Affirmative.
3. I choose Mongo because Heroku does not support file saving and modification.

In case of light bot workload, sqlite3 can be considered as an alternative. However, it is crucial to note that the database should not be hosted on Heroku. Each day, files on Heroku are reset, causing the loss of all database progress within a day.
  •  

anilkh7058

Can anyone explain me difference between Heroku Hosting and Database and Python.
software development company.
  •  

takomer

There are several database options available for integration with Heroku, including PostgreSQL, MySQL, MongoDB, and Redis. These databases are all compatible with Heroku, but it's important to carefully consider your specific requirements and the nature of your Discord bot application before making a decision.

If you are looking for a relational database, PostgreSQL and MySQL are excellent choices. They are widely used, well-supported, and offer strong performance. Both PostgreSQL and MySQL are fully compatible with Heroku's platform, and you can easily provision and manage them using Heroku's add-ons.

On the other hand, if your Discord bot application requires a NoSQL database, MongoDB is a popular option. It is a scalable, flexible, and high-performance document-oriented database that is fully compatible with Heroku. Additionally, if you need an in-memory data structure store for caching, session management, and real-time analytics, Redis is a great choice. Heroku supports Redis as well, making it a suitable option for your needs.

When it comes to the persistence of data in the chosen database after restarting the project on Heroku, it's important to note that Heroku's dynos have an ephemeral file system. This means that any changes to the file system while the dyno is running only last until that dyno is restarted or moved. Therefore, it's imperative to use a separate database to ensure that your data persist even after restarting the project on Heroku. This is where PostgreSQL, MySQL, MongoDB, or Redis shines as they all provide data persistence and can handle your application's data storage needs effectively.

In regards to experiment with file system storage, while it's possible to use the file system for storage on Heroku, it's not recommended for persistent or critical data. The ephemeral nature of the dyno's file system means that you should consider alternative storage solutions, such as cloud storage services like Amazon S3 or a third-party database with associated file storage options.

In my experience, for similar scenarios with Discord bot development on Heroku, I have found PostgreSQL to be a reliable and well-supported choice for database integration. Its compatibility with Heroku and the ability to persist data even after project restarts make it a robust option for storing and managing application data. Additionally, supplementary file storage solutions, such as Amazon S3, can be seamlessly integrated to handle file uploads and storage requirements.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...