version: "3.8" x-refs: restart: &restart deploy: replicas: 1 restart_policy: condition: on-failure rollback_config: parallelism: 2 update_config: parallelism: 2 server: &server # Pinned, and it has to stay pinned. A snapshot is written by one version of # Meilisearch and read by that same version; `latest` moving under a database that # was built by an older build is how the index disappears rather than how it # upgrades. Moving this pin is a migration, not a version bump: dump or re-import # the documents, do not expect the snapshot to carry across. image: getmeili/meilisearch:v1.53.1 # No command. It used to be # sh -c 'rm -rf /database/data.ms; meilisearch --import-snapshot ...' # which deleted the database on every single boot and rebuilt it from the snapshot, # so the snapshot was the only copy of the data and the volume held nothing that # outlived a restart. Meilisearch keeps its own database in the volume; the # scheduled snapshots below are the backup, not the storage. user: root <<: *restart networks: - meili ports: - 7700:7700 environment: MEILI_ENV: production # Explicit, not the bare pass-through form: under Portainer and Swarm the bare # form reads the daemon's environment rather than the stack's. MEILI_MASTER_KEY: ${MEILI_MASTER_KEY} MEILI_NO_SENTRY: "true" MEILI_DUMP_DIR: /dumps MEILI_DB_PATH: /database/data.ms MEILI_SNAPSHOT_DIR: /snapshots MEILI_SCHEDULE_SNAPSHOT: "1800" networks: meili: volumes: data0: data1: data2: dumps0: dumps1: dumps2: snapshots0: snapshots1: snapshots2: services: server0: <<: *server ports: - 7700:7700 volumes: - data0:/database - dumps0:/dumps - snapshots0:/snapshots server1: <<: *server ports: - 7701:7700 volumes: - data1:/database - dumps1:/dumps - snapshots1:/snapshots server2: <<: *server ports: - 7702:7700 volumes: - data2:/database - dumps2:/dumps - snapshots2:/snapshots # dashboard: # build: # context: . # args: # - BUILDKIT_INLINE_CACHE=1 # cache_from: # - alinpanaitiu/meilidash:latest # image: alinpanaitiu/meilidash:latest # container_name: meilidash # <<: *restart # networks: # - meili # ports: # - 5002:5000 # environment: # NODE_ENV: production