diff --git a/.config/docker_example.yml b/.config/docker_example.yml index d457569167ab..b3d26ca5a68e 100644 --- a/.config/docker_example.yml +++ b/.config/docker_example.yml @@ -72,7 +72,7 @@ dbReplications: false #───┘ Redis configuration └───────────────────────────────────── redis: - host: redis + host: keydb port: 6379 #family: 0 # 0=Both, 4=IPv4, 6=IPv6 #pass: example-pass @@ -80,7 +80,7 @@ redis: #db: 1 #redisForPubsub: -# host: redis +# host: keydb # port: 6379 # #family: 0 # 0=Both, 4=IPv4, 6=IPv6 # #pass: example-pass @@ -88,7 +88,7 @@ redis: # #db: 1 #redisForJobQueue: -# host: redis +# host: keydb # port: 6379 # #family: 0 # 0=Both, 4=IPv4, 6=IPv6 # #pass: example-pass diff --git a/.devcontainer/devcontainer.yml b/.devcontainer/devcontainer.yml index 824a046dc0de..9e95ca4b4111 100644 --- a/.devcontainer/devcontainer.yml +++ b/.devcontainer/devcontainer.yml @@ -72,7 +72,7 @@ dbReplications: false #───┘ Redis configuration └───────────────────────────────────── redis: - host: redis + host: keydb port: 6379 #family: 0 # 0=Both, 4=IPv4, 6=IPv6 #pass: example-pass @@ -80,7 +80,7 @@ redis: #db: 1 #redisForPubsub: -# host: redis +# host: keydb # port: 6379 # #family: 0 # 0=Both, 4=IPv4, 6=IPv6 # #pass: example-pass @@ -88,7 +88,7 @@ redis: # #db: 1 #redisForJobQueue: -# host: redis +# host: keydb # port: 6379 # #family: 0 # 0=Both, 4=IPv4, 6=IPv6 # #pass: example-pass diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 2809cd2ca469..ece9e8f113a8 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -15,15 +15,15 @@ services: - internal_network - external_network - redis: + keydb: restart: unless-stopped - image: redis:7-alpine + image: eqalpha/keydb:latest networks: - internal_network volumes: - - redis-data:/data + - keydb-data:/data healthcheck: - test: "redis-cli ping" + test: "keydb-cli ping" interval: 5s retries: 20 @@ -45,7 +45,7 @@ services: volumes: postgres-data: - redis-data: + keydb-data: networks: internal_network: diff --git a/.dockerignore b/.dockerignore index 1de0c7982bcd..8ecffe1c7fc2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,6 +11,7 @@ docker-compose.yml node_modules/ packages/*/node_modules redis/ +keydb/ files/ misskey-assets/ fluent-emojis/ diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index d7be15bd4f09..06961ace19ae 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -17,14 +17,14 @@ jobs: services: postgres: - image: postgres:13 + image: postgres:15 ports: - 54312:5432 env: POSTGRES_DB: test-misskey POSTGRES_HOST_AUTH_METHOD: trust - redis: - image: redis:7 + keydb: + image: eqalpha/keydb:latest ports: - 56312:6379 diff --git a/.github/workflows/test-frontend.yml b/.github/workflows/test-frontend.yml index 4ea4ba462873..d7de19c65977 100644 --- a/.github/workflows/test-frontend.yml +++ b/.github/workflows/test-frontend.yml @@ -56,14 +56,14 @@ jobs: services: postgres: - image: postgres:13 + image: postgres:15 ports: - 54312:5432 env: POSTGRES_DB: test-misskey POSTGRES_HOST_AUTH_METHOD: trust - redis: - image: redis:7 + keydb: + image: eqalpha/keydb:latest ports: - 56312:6379 diff --git a/.gitignore b/.gitignore index a66e527db059..f66d6e134465 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ coverage !/.config/docker_example.env docker-compose.yml !/.devcontainer/docker-compose.yml +!/packages/backend/test/docker-compose.yml # misskey /build @@ -51,6 +52,7 @@ run.bat api-docs.json *.log /redis +/keydb *.code-workspace .DS_Store /files diff --git a/chart/templates/Deployment.yml b/chart/templates/Deployment.yml index d5dd14f59ece..a6ea8b216060 100644 --- a/chart/templates/Deployment.yml +++ b/chart/templates/Deployment.yml @@ -27,7 +27,7 @@ spec: ports: - containerPort: 3000 - name: postgres - image: postgres:14-alpine + image: postgres:15-alpine env: - name: POSTGRES_USER value: "example-misskey-user" @@ -37,8 +37,8 @@ spec: value: "misskey" ports: - containerPort: 5432 - - name: redis - image: redis:alpine + - name: keydb + image: eqalpha/keydb:latest ports: - containerPort: 6379 volumes: diff --git a/docker-compose.yml.example b/docker-compose.yml.example index a0061c5c20b1..e4f8a7f16759 100644 --- a/docker-compose.yml.example +++ b/docker-compose.yml.example @@ -6,12 +6,12 @@ services: restart: always links: - db - - redis + - keydb # - meilisearch depends_on: db: condition: service_healthy - redis: + keydb: condition: service_healthy ports: - "3000:3000" @@ -22,15 +22,15 @@ services: - ./files:/misskey/files - ./.config:/misskey/.config:ro - redis: + keydb: restart: always - image: redis:7-alpine + image: eqalpha/keydb:latest networks: - internal_network volumes: - - ./redis:/data + - ./keydb:/data healthcheck: - test: "redis-cli ping" + test: "keydb-cli ping" interval: 5s retries: 20 diff --git a/packages/backend/src/core/FeaturedService.ts b/packages/backend/src/core/FeaturedService.ts index 555a646cdcb2..0772dc689f2e 100644 --- a/packages/backend/src/core/FeaturedService.ts +++ b/packages/backend/src/core/FeaturedService.ts @@ -38,7 +38,7 @@ export class FeaturedService { redisTransaction.expire( `${name}:${currentWindow}`, (windowRange * 3) / 1000, - 'NX'); // "NX -- Set expiry only when the key has no expiry" = 有効期限がないときだけ設定 + ); await redisTransaction.exec(); } @@ -48,10 +48,10 @@ export class FeaturedService { const previousWindow = currentWindow - 1; const redisPipeline = this.redisClient.pipeline(); - redisPipeline.zrange( - `${name}:${currentWindow}`, 0, threshold, 'REV', 'WITHSCORES'); - redisPipeline.zrange( - `${name}:${previousWindow}`, 0, threshold, 'REV', 'WITHSCORES'); + redisPipeline.zrevrange( + `${name}:${currentWindow}`, 0, threshold, 'WITHSCORES'); + redisPipeline.zrevrange( + `${name}:${previousWindow}`, 0, threshold, 'WITHSCORES'); const [currentRankingResult, previousRankingResult] = await redisPipeline.exec().then(result => result ? result.map(r => r[1] as string[]) : [[], []]); const ranking = new Map(); diff --git a/packages/backend/test/docker-compose.yml b/packages/backend/test/docker-compose.yml index da6c01dda168..286a6607a5aa 100644 --- a/packages/backend/test/docker-compose.yml +++ b/packages/backend/test/docker-compose.yml @@ -1,13 +1,13 @@ version: "3" services: - redistest: - image: redis:7 + keydbtest: + image: eqalpha/keydb:latest ports: - "127.0.0.1:56312:6379" dbtest: - image: postgres:13 + image: postgres:15 ports: - "127.0.0.1:54312:5432" environment: