Postgres Addon
-
I am interested in using the Postgres Addon for an app I am building, but I would like to understand how it works first.
- Specifically, for setting it up, I would set it up with environment variables and in the cloudron manifest, right?
- Then, I suppose, I can find it under "Services" and assign it more memory if needed? Can I also tweak the CPU usage?
- If I remove my app, would the database including its data be removed as well? What if for some reason updating doesn't work, but re-installing does? I have had that before actually, but it seems like I would face a complete data loss in that case.
- How is the data being backed up? I suppose it is included in the main backup, but can I somehow restore the backup separately from all other apps, e.g. in case of data loss inside my app?
I'd appreciate some help with this!
-
@ekevu123 said in Postgres Addon:
Specifically, for setting it up, I would set it up with environment variables and in the cloudron manifest, right?
yes, correct.
Then, I suppose, I can find it under "Services" and assign it more memory if needed? Can I also tweak the CPU usage?
Yes. There is no mechanism to tweak CPU usage. The addons currently get all the CPU they want.
If I remove my app, would the database including its data be removed as well? What if for some reason updating doesn't work, but re-installing does? I have had that before actually, but it seems like I would face a complete data loss in that case.
Yes, the database gets removed when the app is removed. If an update fails, the app just goes into a 'not responding' state. It's still installed, so the database is still there. At that point, you can either make another update to get the app working or you can restore to the previous backup. Cloudron always takes a backup before app update.
How is the data being backed up? I suppose it is included in the main backup, but can I somehow restore the backup separately from all other apps, e.g. in case of data loss inside my app?
The database is dumped as part of the app's backup. In Cloudron, each app is backed up separately. Inside the app's backup, you will see a file named
postgresqldump
. So, you can even take an app backup and import it into another Cloudron to move the app. -
Okay, thank you!
And can I somehow implement the database dump separately into my existing app - without re-instating the app backup?
Also, is there any best practice you recommend? Generally, this sounds like an attractive solution for a managed database for an app which I host anyway on Cloudron, but I am afraid of the lack of fail-safe just in case something goes wrong.
In an ideal scenario, I would be able to re-install the app and connect it to the existing database which just sits there with all its data.
I suppose I could make a separate database dump before every update I install, but that gets me back to square one, can I implement the backup separately.
-
-
@ekevu123 said in Postgres Addon:
In an ideal scenario, I would be able to re-install the app and connect it to the existing database which just sits there with all its data.
You can always put your database in another server altogether independent of Cloudron and make your app use that database . Just don't use the postgresql addon in your app.
The Cloudron backup and update flow is optimized for selfhosting apps. So, I guess you have to analyze if that flow works for your custom app.
-
Okay! And last question, when I connect to my database via ssh, can I manipulate the data as needed, e.g. import data if needed, back it up, restore it? Or is there any issue like access rights preventing me from that?
Because that would solve my problem and I would love to have my database on Cloudron.
-