vitabaks / autobase

Automated database platform for PostgreSQL® — the open-source alternative to cloud-managed databases.
https://autobase.tech
MIT License
1.89k stars 420 forks source link

Add the ability to deploy Postgres in containers #751

Open ruslanloman opened 2 months ago

ruslanloman commented 2 months ago

Hello,

Thank you for your great project.

Have you considered the option to deploy Postgres/Patroni/etcd/Haproxy in containers instead of installing packages. This approach has many advantages.

  1. Easier cluster upgrades without worrying about package dependencies.
  2. Provides an OS-agnostic setup.
  3. Use docker upstream images for postgres, etcd.

Thank you!

vitabaks commented 2 months ago

Hello @ruslanloman

Have you considered the option to deploy Postgres/Patroni/etcd/Haproxy in containers instead of installing packages.

Adding Docker support to the postgresql_cluster project would require significant changes to the automation code.

We believe Docker is not an ideal solution for databases in production environments, as it introduces unnecessary abstraction and an additional maintenance point. There are already Kubernetes operators for containerized solutions, but the strength of postgresql_cluster lies in its independence from Docker or Kubernetes.

This approach sets us apart from other HA solutions and, with its high-quality automation, it can serve as a solid alternative to both Kubernetes-based systems and managed databases from cloud providers.

ruslanloman commented 2 months ago

Hello @vitabaks

Thank you for your reply.

Adding Docker support to the postgresql_cluster project would require significant changes to the automation code.

The postgresql_cluster ansible code is well written, so it shouldn't be a big problem to add an option to run the process in a container. I can help with adding such functionality as I'm very interested in it. I like the approach used in the Kubespray project, for example, for etcd

We believe Docker is not an ideal solution for databases in production environments, as it introduces unnecessary abstraction and an additional maintenance point. There are already Kubernetes operators for containerized solutions, but the strength of postgresql_cluster lies in its independence from Docker or Kubernetes.

I understand your point of view and partially agree. What I would like to achieve from using Docker/containerd is an operating system-agnostic PostgreSQL installation, as well as atomic upgrades and rollbacks, without worrying about potential package dependency issues. Using Docker/containerd would be an option, like having deb/rpm/docker.

This approach sets us apart from other HA solutions and, with its high-quality automation, it can serve as a solid alternative to both Kubernetes-based systems and managed databases from cloud providers.

That's why I like your project. We have a PostgreSQL cluster that is managed by a Kubernetes operator, but it becomes a challenge when we need to upgrade Kubernetes itself and manage the database.

Thank you!

vitabaks commented 2 months ago

The postgresql_cluster ansible code is well written, so it shouldn't be a big problem to add an option to run the process in a container. I can help with adding such functionality as I'm very interested in it.

I appreciate your initiative, you can try to do it. I still think that it will not be easy because postgresql_cluster not only a tool for deployment but also for management. How will you implement support for e.g. pg_upgrade for containers?

Using Docker/containerd would be an option, like having deb/rpm/docker.

Yes, if you add it, then it should be an option that is not used by default. There is a variable installation_method that has the default value "repo", I think we can use it.

vitabaks commented 6 days ago

@ruslanloman Let me know if you are ready to start adding docker support.