mirror of
https://github.com/MisskeyIO/misskey
synced 2024-11-27 06:18:40 +09:00
テストなどにKeyDBを使うように (MisskeyIO#195)
This commit is contained in:
parent
42bc2817be
commit
db7a17d396
@ -72,7 +72,7 @@ dbReplications: false
|
|||||||
#───┘ Redis configuration └─────────────────────────────────────
|
#───┘ Redis configuration └─────────────────────────────────────
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
host: redis
|
host: keydb
|
||||||
port: 6379
|
port: 6379
|
||||||
#family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
#family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
||||||
#pass: example-pass
|
#pass: example-pass
|
||||||
@ -80,7 +80,7 @@ redis:
|
|||||||
#db: 1
|
#db: 1
|
||||||
|
|
||||||
#redisForPubsub:
|
#redisForPubsub:
|
||||||
# host: redis
|
# host: keydb
|
||||||
# port: 6379
|
# port: 6379
|
||||||
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
||||||
# #pass: example-pass
|
# #pass: example-pass
|
||||||
@ -88,7 +88,7 @@ redis:
|
|||||||
# #db: 1
|
# #db: 1
|
||||||
|
|
||||||
#redisForJobQueue:
|
#redisForJobQueue:
|
||||||
# host: redis
|
# host: keydb
|
||||||
# port: 6379
|
# port: 6379
|
||||||
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
||||||
# #pass: example-pass
|
# #pass: example-pass
|
||||||
|
@ -72,7 +72,7 @@ dbReplications: false
|
|||||||
#───┘ Redis configuration └─────────────────────────────────────
|
#───┘ Redis configuration └─────────────────────────────────────
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
host: redis
|
host: keydb
|
||||||
port: 6379
|
port: 6379
|
||||||
#family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
#family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
||||||
#pass: example-pass
|
#pass: example-pass
|
||||||
@ -80,7 +80,7 @@ redis:
|
|||||||
#db: 1
|
#db: 1
|
||||||
|
|
||||||
#redisForPubsub:
|
#redisForPubsub:
|
||||||
# host: redis
|
# host: keydb
|
||||||
# port: 6379
|
# port: 6379
|
||||||
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
||||||
# #pass: example-pass
|
# #pass: example-pass
|
||||||
@ -88,7 +88,7 @@ redis:
|
|||||||
# #db: 1
|
# #db: 1
|
||||||
|
|
||||||
#redisForJobQueue:
|
#redisForJobQueue:
|
||||||
# host: redis
|
# host: keydb
|
||||||
# port: 6379
|
# port: 6379
|
||||||
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
||||||
# #pass: example-pass
|
# #pass: example-pass
|
||||||
|
@ -15,15 +15,15 @@ services:
|
|||||||
- internal_network
|
- internal_network
|
||||||
- external_network
|
- external_network
|
||||||
|
|
||||||
redis:
|
keydb:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: redis:7-alpine
|
image: eqalpha/keydb:latest
|
||||||
networks:
|
networks:
|
||||||
- internal_network
|
- internal_network
|
||||||
volumes:
|
volumes:
|
||||||
- redis-data:/data
|
- keydb-data:/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: "redis-cli ping"
|
test: "keydb-cli ping"
|
||||||
interval: 5s
|
interval: 5s
|
||||||
retries: 20
|
retries: 20
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres-data:
|
postgres-data:
|
||||||
redis-data:
|
keydb-data:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
internal_network:
|
internal_network:
|
||||||
|
@ -11,6 +11,7 @@ docker-compose.yml
|
|||||||
node_modules/
|
node_modules/
|
||||||
packages/*/node_modules
|
packages/*/node_modules
|
||||||
redis/
|
redis/
|
||||||
|
keydb/
|
||||||
files/
|
files/
|
||||||
misskey-assets/
|
misskey-assets/
|
||||||
fluent-emojis/
|
fluent-emojis/
|
||||||
|
6
.github/workflows/test-backend.yml
vendored
6
.github/workflows/test-backend.yml
vendored
@ -17,14 +17,14 @@ jobs:
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:13
|
image: postgres:15
|
||||||
ports:
|
ports:
|
||||||
- 54312:5432
|
- 54312:5432
|
||||||
env:
|
env:
|
||||||
POSTGRES_DB: test-misskey
|
POSTGRES_DB: test-misskey
|
||||||
POSTGRES_HOST_AUTH_METHOD: trust
|
POSTGRES_HOST_AUTH_METHOD: trust
|
||||||
redis:
|
keydb:
|
||||||
image: redis:7
|
image: eqalpha/keydb:latest
|
||||||
ports:
|
ports:
|
||||||
- 56312:6379
|
- 56312:6379
|
||||||
|
|
||||||
|
6
.github/workflows/test-frontend.yml
vendored
6
.github/workflows/test-frontend.yml
vendored
@ -56,14 +56,14 @@ jobs:
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:13
|
image: postgres:15
|
||||||
ports:
|
ports:
|
||||||
- 54312:5432
|
- 54312:5432
|
||||||
env:
|
env:
|
||||||
POSTGRES_DB: test-misskey
|
POSTGRES_DB: test-misskey
|
||||||
POSTGRES_HOST_AUTH_METHOD: trust
|
POSTGRES_HOST_AUTH_METHOD: trust
|
||||||
redis:
|
keydb:
|
||||||
image: redis:7
|
image: eqalpha/keydb:latest
|
||||||
ports:
|
ports:
|
||||||
- 56312:6379
|
- 56312:6379
|
||||||
|
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -37,6 +37,7 @@ coverage
|
|||||||
!/.config/docker_example.env
|
!/.config/docker_example.env
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
!/.devcontainer/docker-compose.yml
|
!/.devcontainer/docker-compose.yml
|
||||||
|
!/packages/backend/test/docker-compose.yml
|
||||||
|
|
||||||
# misskey
|
# misskey
|
||||||
/build
|
/build
|
||||||
@ -51,6 +52,7 @@ run.bat
|
|||||||
api-docs.json
|
api-docs.json
|
||||||
*.log
|
*.log
|
||||||
/redis
|
/redis
|
||||||
|
/keydb
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/files
|
/files
|
||||||
|
@ -27,7 +27,7 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
- name: postgres
|
- name: postgres
|
||||||
image: postgres:14-alpine
|
image: postgres:15-alpine
|
||||||
env:
|
env:
|
||||||
- name: POSTGRES_USER
|
- name: POSTGRES_USER
|
||||||
value: "example-misskey-user"
|
value: "example-misskey-user"
|
||||||
@ -37,8 +37,8 @@ spec:
|
|||||||
value: "misskey"
|
value: "misskey"
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 5432
|
- containerPort: 5432
|
||||||
- name: redis
|
- name: keydb
|
||||||
image: redis:alpine
|
image: eqalpha/keydb:latest
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 6379
|
- containerPort: 6379
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -6,12 +6,12 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
links:
|
links:
|
||||||
- db
|
- db
|
||||||
- redis
|
- keydb
|
||||||
# - meilisearch
|
# - meilisearch
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
redis:
|
keydb:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
@ -22,15 +22,15 @@ services:
|
|||||||
- ./files:/misskey/files
|
- ./files:/misskey/files
|
||||||
- ./.config:/misskey/.config:ro
|
- ./.config:/misskey/.config:ro
|
||||||
|
|
||||||
redis:
|
keydb:
|
||||||
restart: always
|
restart: always
|
||||||
image: redis:7-alpine
|
image: eqalpha/keydb:latest
|
||||||
networks:
|
networks:
|
||||||
- internal_network
|
- internal_network
|
||||||
volumes:
|
volumes:
|
||||||
- ./redis:/data
|
- ./keydb:/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: "redis-cli ping"
|
test: "keydb-cli ping"
|
||||||
interval: 5s
|
interval: 5s
|
||||||
retries: 20
|
retries: 20
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ export class FeaturedService {
|
|||||||
redisTransaction.expire(
|
redisTransaction.expire(
|
||||||
`${name}:${currentWindow}`,
|
`${name}:${currentWindow}`,
|
||||||
(windowRange * 3) / 1000,
|
(windowRange * 3) / 1000,
|
||||||
'NX'); // "NX -- Set expiry only when the key has no expiry" = 有効期限がないときだけ設定
|
);
|
||||||
await redisTransaction.exec();
|
await redisTransaction.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,10 +48,10 @@ export class FeaturedService {
|
|||||||
const previousWindow = currentWindow - 1;
|
const previousWindow = currentWindow - 1;
|
||||||
|
|
||||||
const redisPipeline = this.redisClient.pipeline();
|
const redisPipeline = this.redisClient.pipeline();
|
||||||
redisPipeline.zrange(
|
redisPipeline.zrevrange(
|
||||||
`${name}:${currentWindow}`, 0, threshold, 'REV', 'WITHSCORES');
|
`${name}:${currentWindow}`, 0, threshold, 'WITHSCORES');
|
||||||
redisPipeline.zrange(
|
redisPipeline.zrevrange(
|
||||||
`${name}:${previousWindow}`, 0, threshold, 'REV', 'WITHSCORES');
|
`${name}:${previousWindow}`, 0, threshold, 'WITHSCORES');
|
||||||
const [currentRankingResult, previousRankingResult] = await redisPipeline.exec().then(result => result ? result.map(r => r[1] as string[]) : [[], []]);
|
const [currentRankingResult, previousRankingResult] = await redisPipeline.exec().then(result => result ? result.map(r => r[1] as string[]) : [[], []]);
|
||||||
|
|
||||||
const ranking = new Map<string, number>();
|
const ranking = new Map<string, number>();
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
redistest:
|
keydbtest:
|
||||||
image: redis:7
|
image: eqalpha/keydb:latest
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:56312:6379"
|
- "127.0.0.1:56312:6379"
|
||||||
|
|
||||||
dbtest:
|
dbtest:
|
||||||
image: postgres:13
|
image: postgres:15
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:54312:5432"
|
- "127.0.0.1:54312:5432"
|
||||||
environment:
|
environment:
|
||||||
|
Loading…
Reference in New Issue
Block a user