From 5659f06eb359892fe38dc95768e7f5c0f47f6511 Mon Sep 17 00:00:00 2001 From: Michael Li Date: Tue, 15 Aug 2023 20:12:29 +0800 Subject: [PATCH 1/2] update docker-compose.yaml use meili as default search engine --- config.yaml.sample | 2 +- docker-compose.yaml | 44 ++++++++++++++++++++++---------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/config.yaml.sample b/config.yaml.sample index ab3bfc8a..3e6c7f0f 100644 --- a/config.yaml.sample +++ b/config.yaml.sample @@ -12,7 +12,7 @@ Server: # 服务设置 ReadTimeout: 60 WriteTimeout: 60 Features: - Default: ["Web", "Frontend:EmbedWeb", "Zinc", "LocalOSS", "MySQL", "BigCacheIndex", "LoggerZinc", "Friendship", "Followship"] + Default: ["Web", "Frontend:EmbedWeb", "Meili", "LocalOSS", "MySQL", "BigCacheIndex", "LoggerFile", "Friendship", "Followship"] Develop: ["Base", "MySQL", "BigCacheIndex", "Meili", "Sms", "AliOSS", "LoggerMeili", "OSS:Retention"] Demo: ["Base", "MySQL", "Option", "Zinc", "Sms", "MinIO", "LoggerZinc", "Migration"] Slim: ["Base", "Sqlite3", "LocalOSS", "LoggerFile", "OSS:TempDir"] diff --git a/docker-compose.yaml b/docker-compose.yaml index 3aafafc9..f562109d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -41,7 +41,7 @@ services: # - paopao-network redis: - image: redis/redis-stack:7.0.6-RC8 + image: redis/redis-stack:7.2.0-RC3 restart: always ports: - 6379:6379 @@ -51,33 +51,33 @@ services: networks: - paopao-network - zinc: - image: public.ecr.aws/zinclabs/zinc:latest - user: root - restart: always - ports: - - 4080:4080 - volumes: - - ./custom/data/zinc/data:/data - environment: - ZINC_FIRST_ADMIN_USER: admin - ZINC_FIRST_ADMIN_PASSWORD: admin - DATA_PATH: /data - networks: - - paopao-network - - # meili: - # image: getmeili/meilisearch:v1.2 + # zinc: + # image: bitbus/zincsearch:latest + # user: zincsearch # restart: always # ports: - # - 7700:7700 + # - 4080:4080 # volumes: - # - ./custom/data/meili/data:/meili_data + # - ./custom/data/zinc/data:/data # environment: - # - MEILI_MASTER_KEY=paopao-meilisearch + # ZINC_FIRST_ADMIN_USER: admin + # ZINC_FIRST_ADMIN_PASSWORD: admin + # DATA_PATH: /data # networks: # - paopao-network + meili: + image: getmeili/meilisearch:v1.3 + restart: always + ports: + - 7700:7700 + volumes: + - ./custom/data/meili/data:/meili_data + environment: + - MEILI_MASTER_KEY=paopao-meilisearch + networks: + - paopao-network + # pyroscope: # image: pyroscope/pyroscope:latest # restart: always @@ -107,7 +107,7 @@ services: depends_on: - db - redis - - zinc + - meili # modify below to reflect your custom configure volumes: - ./config.yaml.sample:/app/paopao-ce/config.yaml From 325d271f91a1b1fa887f458664a66f39523753a0 Mon Sep 17 00:00:00 2001 From: Michael Li Date: Tue, 15 Aug 2023 20:27:02 +0800 Subject: [PATCH 2/2] optimize code initial for bigcache --- internal/dao/cache/bigcache.go | 4 +--- internal/dao/cache/cache.go | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/dao/cache/bigcache.go b/internal/dao/cache/bigcache.go index 202627e3..259ab660 100644 --- a/internal/dao/cache/bigcache.go +++ b/internal/dao/cache/bigcache.go @@ -14,9 +14,7 @@ var ( ) type bigCacheTweetsCache struct { - name string - version *semver.Version - bc *bigcache.BigCache + bc *bigcache.BigCache } func (s *bigCacheTweetsCache) getTweetsBytes(key string) ([]byte, error) { diff --git a/internal/dao/cache/cache.go b/internal/dao/cache/cache.go index 6c97d2ec..3a2938cb 100644 --- a/internal/dao/cache/cache.go +++ b/internal/dao/cache/cache.go @@ -5,6 +5,7 @@ package cache import ( + "context" "time" "github.com/allegro/bigcache/v3" @@ -28,7 +29,7 @@ func NewBigCacheIndexService(ips core.IndexPostsService, ams core.AuthorizationM c.MaxEntrySize = 10000 c.Logger = logrus.StandardLogger() - bc, err := bigcache.NewBigCache(c) + bc, err := bigcache.New(context.Background(), c) if err != nil { logrus.Fatalf("initial bigCahceIndex failure by err: %v", err) }