Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .github/workflows/turbo-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ jobs:
SCCACHE_DIR: ${{ needs.skip-if-clean.outputs.internal == 'true' && '/mnt/sccache' || '' }}
SCCACHE_CACHE_SIZE: ${{ needs.skip-if-clean.outputs.internal == 'true' && '10G' || '' }}
RUSTC_WRAPPER: ${{ needs.skip-if-clean.outputs.internal == 'true' && 'sccache' || '' }}
# Redis config for tests
REDIS_TOPOLOGY: cluster
REDIS_CONNECTION_TYPE: multiplexed
REDIS_URL: redis://127.0.0.1:7000,redis://127.0.0.1:7001,redis://127.0.0.1:7002,redis://127.0.0.1:7003,redis://127.0.0.1:7004,redis://127.0.0.1:7005
# Avoid stack overflows in tests
RUST_MIN_STACK: 16777216

steps:
- name: Check out code
Expand Down Expand Up @@ -185,7 +191,7 @@ jobs:

- name: Start services
if: steps.check-labrinth.outputs.needs_services == 'true'
run: docker compose up --wait
run: docker compose --profile clustered-redis up --wait

- name: Setup labrinth environment and database
if: steps.check-labrinth.outputs.needs_services == 'true'
Expand All @@ -197,6 +203,22 @@ jobs:
- name: Lint and test
run: pnpm run ci

# Test different Redis connection modes

- name: Test pooled Redis cluster backend
if: steps.check-labrinth.outputs.needs_services == 'true'
env:
REDIS_CONNECTION_TYPE: pooled
run: cargo nextest run --package labrinth --test redis --no-fail-fast

- name: Test pooled standalone Redis backend
if: steps.check-labrinth.outputs.needs_services == 'true'
env:
REDIS_TOPOLOGY: standalone
REDIS_CONNECTION_TYPE: pooled
REDIS_URL: redis://127.0.0.1:6379
run: cargo nextest run --package labrinth --test redis --no-fail-fast

- name: Verify intl:extract has been run
run: |
pnpm turbo run intl:extract --force
Expand Down
92 changes: 51 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ daedalus = { path = "packages/daedalus" }
darling = { version = "0.23" }
dashmap = "6.1.0"
data-url = "0.3.2"
deadpool-redis = { git = "https://github.com/modrinth/deadpool", rev = "db5fb00b036ecc8fe5f18853c559b745ffe47bde", version = "0.22.1" }
deadpool-redis = { git = "https://github.com/modrinth/deadpool", rev = "c7209b086829572f368f1194aba54bdea8dc540b", version = "0.23.0" }
derive_more = "2.1.1"
directories = "6.0.0"
dirs = "6.0.0"
Expand Down Expand Up @@ -152,7 +152,7 @@ quote = { version = "1.0" }
rand = "=0.8.5" # Locked on 0.8 until argon2 and p256 update to 0.9
rand_chacha = "=0.3.1" # Locked on 0.3 until we can update rand to 0.9
rdkafka = { version = "0.36.2", features = ["cmake-build"] }
redis = "0.32.7"
redis = "1.4.1"
regex = "1.12.2"
reqwest = { version = "0.12.24", default-features = false }
rgb = "0.8.52"
Expand Down
5 changes: 5 additions & 0 deletions apps/labrinth/.env.docker-compose
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@ TYPESENSE_URL=http://localhost:8108
TYPESENSE_API_KEY=modrinth
TYPESENSE_INDEX_PREFIX=labrinth

REDIS_MODE=standalone
REDIS_CONNECTION_TYPE=pooled
# Cache fill coordination is local to each process
REDIS_CACHE_LOCKING_STRATEGY=local
REDIS_URL=redis://labrinth-redis
REDIS_MIN_CONNECTIONS=0
REDIS_MAX_CONNECTIONS=10000
REDIS_BLOCKING_MAX_CONNECTIONS=8

KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
KAFKA_CLIENT_ID=labrinth
Expand Down
10 changes: 10 additions & 0 deletions apps/labrinth/.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,19 @@ TYPESENSE_URL=http://localhost:8108
TYPESENSE_API_KEY=modrinth
TYPESENSE_INDEX_PREFIX=labrinth

REDIS_MODE=standalone
REDIS_CONNECTION_TYPE=pooled
# Cache fill coordination is local to each process
REDIS_CACHE_LOCKING_STRATEGY=local
REDIS_URL=redis://localhost
REDIS_MIN_CONNECTIONS=0
REDIS_MAX_CONNECTIONS=10000
REDIS_BLOCKING_MAX_CONNECTIONS=8

# For a clustered Redis setup (`clustered-redis` Docker Compose profile)
# REDIS_MODE=cluster
# REDIS_CONNECTION_TYPE=multiplexed
# REDIS_URL=redis://127.0.0.1:7000,redis://127.0.0.1:7001,redis://127.0.0.1:7002,redis://127.0.0.1:7003,redis://127.0.0.1:7004,redis://127.0.0.1:7005

KAFKA_BOOTSTRAP_SERVERS=localhost:19092
KAFKA_CLIENT_ID=labrinth
Expand Down
11 changes: 9 additions & 2 deletions apps/labrinth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ color-eyre = { workspace = true }
color-thief = { workspace = true }
const_format = { workspace = true }
dashmap = { workspace = true }
deadpool-redis.workspace = true
deadpool-redis = { workspace = true, features = ["cluster-async"] }
derive_more = { workspace = true, features = ["deref", "deref_mut"] }
dotenvy = { workspace = true }
either = { workspace = true }
Expand Down Expand Up @@ -88,7 +88,13 @@ quick-xml = { workspace = true }
rand = { workspace = true }
rand_chacha = { workspace = true }
rdkafka = { workspace = true }
redis = { workspace = true, features = ["ahash", "r2d2", "tokio-comp"] }
redis = { workspace = true, features = [
"ahash",
"cluster",
"cluster-async",
"r2d2",
"tokio-comp"
] }
regex = { workspace = true }
reqwest = { workspace = true, features = [
"http2",
Expand Down Expand Up @@ -147,6 +153,7 @@ zxcvbn = { workspace = true }

[dev-dependencies]
labrinth = { path = ".", features = ["test"] }
tokio = { workspace = true, features = ["test-util"] }

[build-dependencies]
chrono = { workspace = true }
Expand Down
Loading
Loading