
Ask HN: Moving from Cloud to Self-Hosted - GordonS
My business partner and I are building a bootstrapped B2B SaaS, and designed it from the start with the intention of running it on Azure (or AWS).<p>The use of Postgres and TimescaleDB is core to the product. But now we discover that Azure&#x27;s managed Postgres is still stuck on an antiquated version of TimescaleDB, and we&#x27;ve also realised that our compute requirements are much greater than originally anticipated. Aside from the managed Postgres issue, it would cost too much to host at a cloud provider, so we&#x27;re now considering self-hosting.<p>The components we need are fairly modest, but we need everything to be highly-available and backed up:<p><pre><code>  - Postgres
  - Blob storage
  - Message queue
  - Compute
</code></pre>
We&#x27;re struggling with HA for Postgres in particular. I&#x27;m looking for advice and OSS solutions that would simplify and give more of a &quot;semi-managed&quot; feel, to help us deploy our own HA stack somewhere like Hetzner.
======
avivallssa
Interesting. Would try to answer in short but rather ask you go through this
webinar video i have given sometime back.

[https://www.percona.com/resources/webinars/enterprise-
grade-...](https://www.percona.com/resources/webinars/enterprise-grade-
postgresql-built-open-source-tools)

Like some people mentioned - you could Patroni for HA. It is a template that
could be configured with etcd like distributed consensus key value stores for
leader election using the world famous RAFT algorithm. Could use
Watchdog/Softdog for avoiding split-brain. Now, we could also do some actions
before and after failover which can be scripted. Regarding HA on other pieces
such as Blob store, you could use CRR using the AWS S3. You could just mount
the S3 via NFS Gateway to DB servers and let the job be done in a more simpler
way. Similarly, all the problems you mentioned are solved, however, anything
you feel is still challenging after going through the webinar recording,
please reply back here.

------
verdverm
You could try Google Cloud and you may realize here are a lot more costs you
haven't considered which make self hosting more expensive (maintenance and
your time). Most SaaS and EE companies are running in the cloud, so why do you
think cloud is cost prohibitive? What would happen if 200 people wanted to use
your service tomorrow?

~~~
GordonS
I'm aware of the convenience of cloud, and I've been using both Azure and AWS
for some years - it's very true that it can save you a lot of time and
headache. I love working with Azure in particular.

But it's also very true that it's expensive - compute and bandwidth costs
elsewhere are a fraction of the cost. Fact is, we're just 2 blokes
bootstrapping a new small business with no guarantee of success - no VC
funding or massive AWS credit here! Given the current climate, it's also risky
timing to spend a small fortune on cloud every month.

And on the Postgres side, it would be wonderful to have full control over
extensions (we really kind of _need_ this).

~~~
verdverm
I run a fully capable system on GCloud for less than $200 a month. It can
scale quite readily if things take off and fits within budget as I too
bootstrap.

I'm working on https:/github.com/hofstadter-io

What are you working on? Anything we can check out?

~~~
GordonS
Still in stealth mode I'm afraid. I've worked mainly with Azure, a bit with
AWS, but never with GCP.

Just had a quick look at Postgres pricing on GCP. Not sure if I'm pricing it
wrong, but it looks like a very modest HA setup with 16GB RAM, 2vCPUs and 1TB
of storage would run to almost $600/m.

They have "shared CPU" instances too, but they max out at 1.7GB of RAM and
aren't covered by SLA. The pricing is also confusing, as it's not clear of the
"HA" editions include the secondary instance or not, and HA SSD storage prices
seem very expensive.

And the real killer, they don't support TimescaleDB at all :(

~~~
verdverm
If you use k8s, you might have a look at the Zolando Postgres operator. Not
sure if it supports TimescaleDB, but it should cover the rest of your needs.

------
ants_a
Patroni is a good choice for fully automated PostgreSQL HA. Depending on what
you are comfortable with, you could either deploy it using something like
Ansible on bare-metal or VMs, or with Spilo and postgres-operator on
Kubernetes.

------
tarun_anand
We use pg replication and Kafka for message queues - ie streaming data. An
alternative is pulsar which has less management overhead.

Haven't found a good alternative to blob but consider minion

~~~
GordonS
I use minio elsewhere and it's been rock solid (altho it's for personal use,
so only on a single node), so it would be my first choice for blob storage
assuming it supports HA.

