ratus icon indicating copy to clipboard operation
ratus copied to clipboard

feature-request: postgres storage support

Open c-nv-s opened this issue 3 years ago • 11 comments
trafficstars

please add postgres support to the storage engine options

c-nv-s avatar Sep 14 '22 01:09 c-nv-s

We are currently implementing a in-memory storage and will work on adding relational database support when it is stable.

peakji avatar Sep 14 '22 02:09 peakji

Update: the in-memory store is available in v0.3.0, and now we have a roadmap for adding more storage engines.

peakji avatar Sep 21 '22 16:09 peakji

Hi @peakji Are you going to define tasks for the roadmap items, and if we are interested,could we be involved? Thanks

zeina1i avatar Oct 16 '22 22:10 zeina1i

@zeina1i The roadmap is just a rough plan, and contributions of any kind are always welcome!

In fact, I don't have much experience with Postgres, so I haven't started working on the relevant parts yet. If you are interested in implementing support for a new storage engine, you can refer to the engine package. And if the test cases in testsuite all pass, then it should work properly.

peakji avatar Oct 17 '22 03:10 peakji

@zeina1i did you decide to have a look?

c-nv-s avatar Jan 07 '23 23:01 c-nv-s

@c-nv-s unfortunately currently I don't have enough time to be involved.

zeina1i avatar Jan 07 '23 23:01 zeina1i

not sure why I didn't think of this earlier, but I'll see if I can test this with https://github.com/FerretDB/FerretDB sometime next week. Hopefully it will serve as a stop-gap until the final implementation.

c-nv-s avatar Feb 25 '23 20:02 c-nv-s

just to update on this... unfortunately not all features worked because it looks like the ferretdb team haven't yet implemented how to handle the hint query functionality from mongodb yet here is the docker-compose.yml file I used:

services:
  postgres:
    image: postgres
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=password
      - POSTGRES_DB=ferretdb
    volumes:
      - ./data:/var/lib/postgresql/data

  ferretdb:
    image: ghcr.io/ferretdb/ferretdb
    ports:
      - 27017:27017
    environment:
      - FERRETDB_POSTGRESQL_URL=postgres://postgres:password@postgres:5432/ferretdb

  ratus:
    image: hyperonym/ratus:0.6.2
    restart: unless-stopped
    depends_on:
      - ferretdb
    environment:
      ENGINE: "mongodb"
      MONGODB_URI: "mongodb://ferretdb:27017"
      MONGODB_DATABASE: "ferretdb"
      MONGODB_COLLECTION: "tasks"
      MONGODB_RETENTION_PERIOD: "72h"
    ports:
      - "8000:80"

networks:
  default:
    name: ferretdb

and you have to remember to add the ferretdb database to your search_path when in psql I did this using: ALTER ROLE postgres SET search_path = "$user", public, ferretdb ;

c-nv-s avatar Mar 22 '23 01:03 c-nv-s

still hoping this feature can be progressed... the intended workaround using ferretdb seems dependent on them developing the TimeToLive functionality but that ticket seems low priority at the moment, so integrating the feature directly in ratus still seems like the best approach at the moment

c-nv-s avatar Apr 18 '24 11:04 c-nv-s