diff --git a/compose.local-db.yml b/compose.local-db.yml index 3835cb23db..5a82da30cd 100644 --- a/compose.local-db.yml +++ b/compose.local-db.yml @@ -26,6 +26,19 @@ services: test: "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB" interval: 5s retries: 20 + command: ["-c", "wal_level=logical"] + +# db-publish: +# restart: always +# image: alpine/socat +# ports: +# - "5433:5433" +# volumes: +# - ./replication:/data +# command: [ +# "OPENSSL-LISTEN:5433,openssl-min-proto-version=TLS1.2,cert=/data/certs/server.pub.pem,key=/data/certs/server.key.pem,cafile=/data/certs/ca.pem,fork,reuseaddr", +# "TCP4:db:5432" +# ] # meilisearch: # restart: always diff --git a/compose_example.yml b/compose_example.yml index c4964d3d97..98aa5fd18e 100644 --- a/compose_example.yml +++ b/compose_example.yml @@ -64,6 +64,24 @@ services: test: "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB" interval: 5s retries: 20 + command: ["-c", "wal_level=logical"] + + db-publish: + restart: always + image: alpine/socat + links: + - db + networks: + - internal_network + - external_network + ports: + - "5433:5433" + volumes: + - ./replication:/data + command: [ + "OPENSSL-LISTEN:5433,openssl-min-proto-version=TLS1.2,cert=/data/certs/server.pub.pem,key=/data/certs/server.key.pem,cafile=/data/certs/ca.pem,fork,reuseaddr", + "TCP4:db:5432" + ] # mcaptcha: # restart: always diff --git a/packages/backend/migration/1730447062213-logicalReplicatePublish.js b/packages/backend/migration/1730447062213-logicalReplicatePublish.js new file mode 100644 index 0000000000..358635d876 --- /dev/null +++ b/packages/backend/migration/1730447062213-logicalReplicatePublish.js @@ -0,0 +1,26 @@ +const { MigrationInterface, QueryRunner } = require("typeorm"); + +module.exports = class LogicalReplicatePublish1730447062213 { + + async up(queryRunner) { + await queryRunner.query( + [ + "CREATE PUBLICATION misskey_public", + "FOR TABLES IN SCHEMA public", + "WITH (publish = 'insert, update, delete')", + ].join(' ')); + + await queryRunner.query( + [ + "ALTER PUBLICATION misskey_public", + "DROP TABLE auth_session, password_reset_request, access_token" + ].join(' ')); + } + + async down(queryRunner) { + await queryRunner.query( + [ + "DROP PUBLICATION misskey_public" + ].join(' ')); + } +}