-
-
Notifications
You must be signed in to change notification settings - Fork 385
Meilisearch Setup for UNIT3D
HDVinnie edited this page Nov 21, 2024
·
5 revisions
Note: This guide assumes you are using a sudo
user named ubuntu
.
-
Install Meilisearch:
sudo curl -L https://install.meilisearch.com | sudo sh sudo mv ./meilisearch /usr/local/bin/ sudo chmod +x /usr/local/bin/meilisearch
-
Set Up Directories:
sudo mkdir -p /var/lib/meilisearch/data /var/lib/meilisearch/dumps /var/lib/meilisearch/snapshots sudo chown -R ubuntu:ubuntu /var/lib/meilisearch sudo chmod -R 750 /var/lib/meilisearch
-
Generate and Record a Master Key:
Generate a 16-byte master key:
openssl rand -hex 16
Record this key, as it will be used in the configuration file.
-
Configure Meilisearch:
sudo curl https://raw.githubusercontent.com/meilisearch/meilisearch/latest/config.toml -o /etc/meilisearch.toml sudo nano /etc/meilisearch.toml
Update the following in
/etc/meilisearch.toml
:env = "production" master_key = "your_16_byte_master_key" db_path = "/var/lib/meilisearch/data" dump_dir = "/var/lib/meilisearch/dumps" snapshot_dir = "/var/lib/meilisearch/snapshots"
-
Create and Enable Service:
sudo nano /etc/systemd/system/meilisearch.service
Add the following:
[Unit] Description=Meilisearch After=systemd-user-sessions.service [Service] Type=simple WorkingDirectory=/var/lib/meilisearch ExecStart=/usr/local/bin/meilisearch --config-file-path /etc/meilisearch.toml User=ubuntu Group=ubuntu Restart=on-failure [Install] WantedBy=multi-user.target
Enable and start the service:
sudo systemctl enable meilisearch sudo systemctl start meilisearch sudo systemctl status meilisearch
-
Update
.env
:sudo nano /var/www/html/.env
Add the following:
SCOUT_DRIVER=meilisearch MEILISEARCH_HOST=http://127.0.0.1:7700 MEILISEARCH_KEY=your_16_byte_master_key
-
Clear Configuration and Restart Services:
sudo php artisan set:all_cache sudo systemctl restart php8.3-fpm sudo php artisan queue:restart
-
Reload Data and Sync Indexes:
-
Sync Index Settings: After UNIT3D updates, sync the index settings to ensure they are up to date:
sudo php artisan scout:sync-index-settings
-
Reload Data: Whenever Meilisearch is upgraded or during the initial setup, the database must be reloaded:
sudo php artisan scout:import "App\Models\Torrent"
-
For further details, refer to the official Meilisearch documentation.