listmonk icon indicating copy to clipboard operation
listmonk copied to clipboard

Need of Automatic Backups in Listmonk CLI

Open mngshm opened this issue 1 year ago • 10 comments

Is your feature request related to a problem? Please describe. The problem is with Listmonk not having automated backups. I usually take backups with pg_dump which is insanely simple.

Describe the solution you'd like Utilizing go to write a command line tool for listmonk which include a bunch of stuff including backups in it would be a good decision and thing to work on. Or this could be inbuilt inside the listmonk binary itself with a ./listmonk --backup itself ?

mngshm avatar Jul 24 '24 19:07 mngshm

I would definitely use it if it existed but I feel like data retention/preservation policies are unique depending on each use case. Like you said you can select which properties you would like and just do your pg_dump as a cronjob/task in your server.

H0BB5 avatar Jul 25 '24 01:07 H0BB5

pg_dump is the safest and simplest way to backup indeed. Guaranteed to export the DB state as-is.

A built-in function would indeed be more convenient but that will involve trying to rebuild pg_dump inside listmonk. I’ll evaluate this nonetheless.

knadh avatar Jul 25 '24 04:07 knadh

There is no straightforward way of doing this from within the app. The best way is to backup using native tools such as pg_dump, although it's not as convenient as having an option directly within the app.

knadh avatar Jul 28 '24 05:07 knadh

Yes, I had noticed this already while I was working on taking the backup last year. A simple function call and use of flag in the listmonk binary should do good.

I will try working on this today, haven't worked with go in any previous projects though, would love to give a try.

mngshm avatar Jul 28 '24 06:07 mngshm

I had a query, is it mandatory to setup an instance to test or there are alternative ways of testing it ?

Edit: figured it out, and running a demo instance in local

mngshm avatar Jul 28 '24 06:07 mngshm

@knadh could you please assign this issue to me ?

mngshm avatar Jul 29 '24 18:07 mngshm

Hi @Mangeshrex. If the idea is to execute pg_dump from within the binary, that will not work in most environments, especially Docker. In most production setups, there is no guarantee that pg_dump would be installed and available in the same environment as the listmonk binary.

knadh avatar Jul 29 '24 18:07 knadh

It won't be possible even if we add validations and checks to see if pg_dump is installed in that particular environment ? But i'm guessing pg_dump would become another dependency

mngshm avatar Jul 29 '24 18:07 mngshm

We can check for the presence of pg_dump, but it won't be a universal for backups. It'll be an option that works in some environments and not in most, where we'll have to display a message saying ~ "Use pg_dump externally to take backups". Unsure of if we should ship a feature with uncertainty. It won't be good UX.

knadh avatar Jul 30 '24 16:07 knadh

Agreed @knadh. Leaving the decision up to you. Please close the issue once you're sure that this is an unnecessary feature which does no good.

mngshm avatar Jul 30 '24 18:07 mngshm