hasura/skor là dự án C với 1.2k sao. Now part of Hasura GraphQL Engine. Listen to postgres events and forward them as JSON payloads to a webhook
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
New and improved version of Skor is now part of Hasura GraphQL Engine
A few months ago, we built the open source GraphQL Engine that gives you instant GraphQL APIs over any Postgres database. We have added all of Skor's existing features and even more to make it production ready:
Reliable: We capture every relevant action on the database as an event, even when Hasura is down! The events are delivered to your webhook as soon as possible with an atleast-once guarantee.
Scalable: What more, it even scales horizontally. If you are processing millions of events, just add more instances of GraphQL engine.
Use with Serverless: If you are using Skor, then avoid the pain of managing your webhook by moving to Serverless infrastructure. Check out these blog posts to get started
Use Hasura GraphQL Engine for production use cases
skor is a utility for Postgres which calls a webhook with row changes as JSON whenever an INSERT, UPDATE or DELETE event occurs on a particular table.
You can drop the docker image next to your Postgres database instance and configure a webhook that will be called.
It works using a pg_notify trigger function and a tiny C program skor that listens to the notifications and calls the configured webhook with a JSON payload.
When to use
When you want to trigger an action in an external application when a table row is modified.
When you want a lightweight notification system for changes in the database.
When you want to send the changes to a message queue such as AMQP, Kafka etc.
How it works
A PostgreSQL stored procedure is set up as a trigger on the required table(s). This trigger uses PostgreSQL's LISTEN and NOTIFY to publish change events as JSON to a notification channel. Skor watches this channel for messages and when a message is received, it makes an HTTP POST call to the webhook with the JSON payload. The webhook can then decide to take an action on this.
Caveats
Events are only captured when skor is running.
If a call to the webhook fails, it is not retried.
Getting started
1) Set up the triggers:
We need to setup triggers on the tables that we we are interested in. Create a triggers.json file (see sample.triggers.json) with the required tables and events.
To remove the skor related functions and triggers that were added to Postgres, run this in psql:
DO $$DECLARE r record;
BEGIN
FOR r IN SELECT routine_schema, routine_name FROM information_schema.routines
WHERE routine_name LIKE 'notify_skor%'
LOOP
EXECUTE 'DROP FUNCTION ' || quote_ident(r.routine_schema) || '.' || quote_ident(r.routine_name) || ' CASCADE';
END LOOP;
END$$;
Deploying Skor on Hasura
The pre-built Docker image with the skor binary is available at hasura/skor and can be deployed as a microservice with the sample k8s.yaml in this repo.
The webhook can be another microservice that exposes an endpoint.
To learn more on deploying microservices on Hasura you may check out the documentation.
Install the requirements specified in tests/requirements.txt
The tests assume that you have a local postgres instance at localhost:5432 and a database called skor_test which can be accessed by an admin user.
Run skor on this database with the webhook url set to http://localhost:5000
run run_tests.sh script in the tests directory.
Contributing
Contributions are welcome!
Please check out the contributing guide to learn about setting up the development environment and building the project. Also look at the issues page and help us in improving Skor!
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/hasura/skor là nguồn chính thức.
hasura/skor có phải mã nguồn mở không?
Có — hasura/skor phát hành theo license Apache-2.0, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/hasura/skor.
hasura/skor là gì?
hasura/skor (hasura/skor) là dự án C trên GitHub. Theo mô tả gốc: Now part of Hasura GraphQL Engine. Listen to postgres events and forward them as JSON payloads to a webhook
Đọc đầy đủ README ở tab phía trên.
Chưa chắc skor có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về skor.