No internet connection
  1. Home
  2. Support

How can I connect external Postgresql Database to Talkyard-Prod

By Arjun @exam4india
    2018-06-28 09:41:00.587Z

    I am trying to connect my own PostgreSQL database to Talkyard-Prod after editing play.conf. Is it possible to connect external postgreSQL database ?

    • 3 replies
    1. Can I ask what's the use case for this?

      Is it about accessing the audit logs? Hmm I mentioned the database table in the GitHub issue (if this is about that), ... and now after having thought a bit longer, that's not a good idea (shouldn't expose the database or its structure to external apps). Instead, a HTTP endpoint that replies with JSON for audit log entries, and that has before/between date URL query params, and ?limit=NNN, or maybe webhooks somehow — those things would be simpler to keep more backwards compatible.

      Anyway, to answer the question: If the external database is on the host, I think not — the host's port aren't accessible to the Docker containers (unless one creates some special Docker network). If on another host, then should work I think (as long as the db hostname can be resolved).

      It'd be simpler to answer & think about this in a good way, if I know the end goals & big picture of what you're looking to do :- ) ?

      1. E
        In reply toexam4india:
        Arjun @exam4india
          2018-06-29 07:27:00.765Z

          Hello @KajMagnus,

          Yes you are right, HTTP endpoint will be great that replies with JSON for audit log entries.

          Can you let me know how can I do that in Talkyard -Prod ? For now, I am thinking to write a NodeJs program to connect to Postgres Database and create a endpoint from there using express or something.

          I have one more question, Now As I have accessed tables in talkyard database. Can you let me where is mapping for did_what column in the audit_log3 table?

          How can I know which number means what ?. Can you let me know where mapping of these values is stored ?

          For your last question about big picture, I would like to say. For Now I only know that I am looking for some way to track progress of a user on Talkyard or talkyard like forum

          1. Right now there isn't any interface for accessing the audit log. That's something I can add. If you want to get started anyway, before that's been done, ... and you're ok with updating your app later and change to use a HTTP JSON endpoint or Webhook (because accessing the database table directly = probably a bit fragile / risky) — then here're the audit log entry types for the did_what column:

            https://github.com/debiki/talkyard/blob/e9bcf021223831b8522553f6fbaab418323ab615/modules/ed-core/src/main/scala/com/debiki/core/AuditLogEntry.scala#L32

            Some types of events are missing — I'll start audit logging more different types of things, later on / soon.