Skip to content

Instantly share code, notes, and snippets.

@CorneilleEdi
Last active September 10, 2024 15:39
Show Gist options
  • Save CorneilleEdi/4ea9d53ffa4a682440a25f7e8533ea8e to your computer and use it in GitHub Desktop.
Save CorneilleEdi/4ea9d53ffa4a682440a25f7e8533ea8e to your computer and use it in GitHub Desktop.
install and setup meilisearch
#!/bin/bash
echo "Downloading MeiliSearch"
#
# Install MeiliSearch
# https://docs.meilisearch.com/create/how_to/running_production.html#step-2-run-meilisearch-as-a-service
#
# Update the list of available packages and their versions
sudo apt update
# Install curl which is required to install MeiliSearch in the next step
sudo apt install curl -y
# Install MeiliSearch latest version from the script
sudo curl -L https://install.meilisearch.com | sh
# Move MeiliSearch to the user bin
sudo mv ./meilisearch /usr/bin/
# Create the service
sudo cat << EOF > $(pwd)/meilisearch.service
[Unit]
Description=MeiliSearch
After=systemd-user-sessions.service
[Service]
Type=simple
ExecStart=/usr/bin/meilisearch --http-addr 0.0.0.0:7700 --env=development --master-key e5ef239d483405d9bb0dfbe3d900f47fadb6e6a3
[Install]
WantedBy=multi-user.target
EOF
# Move the service to your the system folder
sudo mv $(pwd)/meilisearch.service /etc/systemd/system/meilisearch.service
# Set the service meilisearch
sudo systemctl enable meilisearch
# Start the meilisearch service
sudo systemctl start meilisearch
# Reload the operating system daemons / services
sudo systemctl daemon-reload
sudo apt install nginx -y
rm -f /etc/nginx/sites-enabled/default
cat << EOF > /etc/nginx/sites-enabled/meilisearch
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location /meili {
proxy_pass http://127.0.0.1:7700;
}
}
EOF
# Reload the operating system daemons / services
sudo systemctl daemon-reload
# Enable and start Nginx service
sudo systemctl enable nginx
sudo systemctl restart nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment