trieb-work / strapi-neon-tech-db-branches

Strapi plugin to connect the neon.tech Postgres database using the neon API 💾
https://trieb.work/blog/article/neontech-serverless-postgres-db-strapi-auto-branching-plugin
MIT License
6 stars 2 forks source link

v5 compatibility #3

Open JannikZed opened 2 months ago

JannikZed commented 2 months ago

The plugin needs to be tested against the most recent v5 strapi version and we need to check first, what changes might need to be done to support v5. This issue should also log all progress that we make to release a new version that is v5 compatible

davenpos commented 2 weeks ago

Yeah, I'm using Strapi version 5.1.1 and I need a version of this plugin compatible with my version of Strapi, especially since I'm following along with a video tutorial and I'm kind of at a dead end right now. If anyone does fork the plugin and modify it so that it works with version 5.1.1, please let me know! I can't wait around for the developers to update it, especially since it doesn't seem to be maintained anymore. It was last updated 463 days ago.

JannikZed commented 2 weeks ago

@davenpos sorry for the delay. We have a PR ready already and will release it soon. We are still maintaining it.

davenpos commented 2 weeks ago

@JannikZed When will it be released exactly? Also, why is it taking more than a year for an updated version of the plugin to be released?

JannikZed commented 1 week ago

So it seems like the plugin is no longer working for v5. The database URI that the plugin propagates gets overwritten somewhere. As Strapi is a really bad piece of software and breaking changes like these are just happening without any feedback from the developers, we are kind of stuck here and kind spend too much effort on it.

@davenpos furthermore, you should really work on your attitude towards open source projects. I'm updating the current v5 PR and you are welcomed to try it out on your own and make it run. But just pushing without paying a cent or contributing to open source projects on your own is really not working out.

davenpos commented 1 week ago

@JannikZed I'm sorry, I didn't mean to sound rude. I was just hoping that there would be a v5 compatible version of this plugin released soon. As I previously mentioned, I'm currently following an online tutorial of how to put Strapi's database onto Neon, which uses this plugin. And unfortunately, since I'm using version 5.1.1 of Strapi and the plugin doesn't work with version 5, I'm kind of at a dead end.

The reason I want to push my Strapi database to Neon is so that my database will persist and I won't have to pay any money for Render's disks. You see, I'm currently working on an online portfolio (link to the code is on my GitHub page) that utilizes Next.js and Strapi as the CMS, which it pulls all the info from. This online tutorial I found uses the Neon plugin to put the Strapi database onto Neon, that way I can have the data persist there and I won't have to pay for one of Render's disks. That way I won't have to pay any money to push my Strapi application, which my portfolio pulls data from, onto Render. I'm hoping this portfolio will finally help get me a job in my field. I've been job searching for months, and literally applied to hundreds of positions, and I have still not gotten a job. I'm really not comfortable paying money for Render's disks before I even get hired. Also, this is my first time creating a portfolio. I've never had one before now, and I'm hoping finally pushing a portfolio online will help get me a job, since having a portfolio seems to be a necessity in the web development world.

Unfortunately, I'm not familiar enough with Strapi's code to help with this update, so I'm afraid I won't be able to contribute. This portfolio is actually my first time ever using Strapi. I'm kind of in a frustrating position right now. My hope was that a v5 compatible version of the plugin would become available relatively soon. But if there's difficulties with making it v5 compatible and it may not be ready to release for awhile, my only two options left are either downgrade to a v4 version of Strapi so that I can use the Neon plugin or bite the bullet and pay for one of Render's disks.

Again, sorry if I sounded rude in my last comment and sorry if you weren't really interested in my sob story, but that's the position I'm in and that's why I was feeling eager/impatient about a v5 compatible version of this plugin to be released soon. Also, yeah, I agree with you that Strapi isn't a great piece of software. In working on my portfolio, I have encountered a number of issues with it, like the application no longer working when you try to save changes to a content type and having to press the back button, or not being able to go to the settings page and getting an error message, and having to stop and restart the application. So I definitely sympathize with encountering bugs with it. I do hope you can get the bugs for your v5 version fixed soon. Unfortunately, I can't wait around for that, so it looks like I'm going to have to make a decision on how to get my portfolio online right now. Thanks for understanding, and wish me luck in my months'-long job search. And if you have any other ideas on what I can do, I'm all ears!

JannikZed commented 1 week ago

@davenpos alright, got it. No problem! Following idea for you to get your page online - as your page is small and you are working alone, you might not even need this plugin, as this is anyways more focused on people that make many changes in teams and need the advanced branching functionality. How about if you deploy strapi just with the main branch and set the database URL as environment variable?

Screenshot 2024-11-09 at 18 05 07

So you can just use the standard config from Strapi and just set the DATABASE_URL env variable:

postgres: {
      connection: {
        connectionString: env('DATABASE_URL'),
        schema: env('DATABASE_SCHEMA', 'public'),
      },
      pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
    },

For the best performance, make sure, that the database is located in the same region as strapi in render. Let me know, if that works for you until we found a solution for the plugin

davenpos commented 1 week ago

@JannikZed Okay. I'll try this. I have three more questions though.

  1. So I just go get my connection string from Neon, go into my Strapi's .env file, add a DATABASE_URL environment variable and set it to the connection string?
  2. Do I need to install the pg NPM package, or is that not necessary?
  3. In that code snippet you showed, the connection object only contains the connectionString and schema properties. In the database.js file of my Strapi application's config folder, the connection object contains a few more properties. Do I just leave those be? Or do I delete them so it matches your code snippet exactly?

Thanks for your suggestion. Just clarify these 3 things for me and I'll try it out and let you know if I got it working.

davenpos commented 1 day ago

@JannikZed Hey, not sure if you saw, but I had 3 more questions about pushing my Strapi application to the Neon database without the plugin and I was waiting for you to answer them.