Skip to content

Commit

Permalink
Adding Meilisearch feature, thanks to CorruptedCyborg for the gist
Browse files Browse the repository at this point in the history
  • Loading branch information
svpernova09 committed Feb 26, 2021
1 parent e004869 commit 646f19e
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions scripts/features/meilisearch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

if [ -f ~/.homestead-features/wsl_user_name ]; then
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
else
WSL_USER_NAME=vagrant
WSL_USER_GROUP=vagrant
fi

export DEBIAN_FRONTEND=noninteractive

if [ -f /home/$WSL_USER_NAME/.homestead-features/meilisearch ]
then
echo "meilisearch already installed."
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/meilisearch
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# add the sources for meilisearch
echo "deb [trusted=yes] https://apt.fury.io/meilisearch/ /" > /etc/apt/sources.list.d/fury.list

# update apt and install meilisearch
apt-get update && apt-get install meilisearch-http

# Create a service file
cat > /etc/systemd/system/meilisearch.service << EOF
[Unit]
Description=MeiliSearch
After=systemd-user-sessions.service
[Service]
Type=simple
ExecStart=meilisearch
[Install]
WantedBy=default.target
EOF

# Set the service meilisearch
systemctl daemon-reload
systemctl enable meilisearch

# Start the meilisearch service
systemctl start meilisearch

0 comments on commit 646f19e

Please sign in to comment.