Azure / Azurite

A lightweight server clone of Azure Storage that simulates most of the commands supported by it with minimal dependencies
MIT License
1.8k stars 320 forks source link

Postgres support? #440

Open atrauzzi opened 4 years ago

atrauzzi commented 4 years ago

I see mention in the docs about mssql and mysql, but can I put in postgres for a dialect?

XiaoningLiu commented 4 years ago

Hi @atrauzzi

Azurite leverages sequelize as ORM managing access to different databases. It does support Postgres (https://sequelize.org/master/manual/getting-started.html). The thing is, Azurite doesn't have pg pg-hstore installed as default dependencies. Mostlikely you will get some errors when using postgres as dialect.

We can add the dependencies if they can pass our open source license validation. Before that, you can manually clone Azurite code and add pg pg-hstore to the dependency list and take a try. Weclome for contribution if it works.

BTW, I'd like to know more about your scenarios why using external database instead of built-in loki. It helps our future plan.

Thanks!

Best, Xiaoning

atrauzzi commented 4 years ago

Hey @XiaoningLiu! :smile:

I'd definitely prefer to see postgres support added to the project, but as an interim solution, I managed to get around having to clone or repackaging the container by creating my own entrypoint script:

#!/bin/sh

npm install pg;

azurite -l /data --blobHost 0.0.0.0 --queueHost 0.0.0.0;

The most obvious shortcoming of the loki-based storage is that when I restart my machine or the Azurite container, I end up losing all my data! We are using Azurite for local development as it's our best - and probably only - option on non-Windows platforms. As a result, I need Azurite to be able to survive restarts as losing data on any kind of host restart is effectively losing anything I had done prior, while leaving behind files in its volume.

This is also why I opened up https://github.com/Azure/Azurite/issues/443. I think it would be nice to see a little bit of quality-of-life prioritized in the very short term. None of this seems particularly back-breaking to fix. :wink: