mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-04-19 16:08:07 +00:00
meilisearch (#3638)
* 'Add new script' * change license * change license * Update install/meilisearch-install.sh Co-authored-by: Bas van den Berg <74251551+bvdberg01@users.noreply.github.com> * Update frontend/public/json/meilisearch.json --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> Co-authored-by: Bas van den Berg <74251551+bvdberg01@users.noreply.github.com> Co-authored-by: Slaviša Arežina <58952836+tremor021@users.noreply.github.com>
This commit is contained in:
parent
8b1cdd1f3f
commit
214d21f91e
95
ct/meilisearch.sh
Normal file
95
ct/meilisearch.sh
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: MickLesk (CanbiZ)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://www.meilisearch.com/
|
||||||
|
|
||||||
|
APP="Meilisearch"
|
||||||
|
var_tags="${var_tags:-full-text-search}"
|
||||||
|
var_cpu="${var_cpu:-2}"
|
||||||
|
var_ram="${var_ram:-4096}"
|
||||||
|
var_disk="${var_disk:-7}"
|
||||||
|
var_os="${var_os:-debian}"
|
||||||
|
var_version="${var_version:-12}"
|
||||||
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
|
||||||
|
header_info "$APP"
|
||||||
|
variables
|
||||||
|
color
|
||||||
|
catch_errors
|
||||||
|
|
||||||
|
function update_script() {
|
||||||
|
header_info
|
||||||
|
check_container_storage
|
||||||
|
check_container_resources
|
||||||
|
|
||||||
|
if [[ ! -f /opt/Meilisearch_version.txt ]]; then
|
||||||
|
msg_error "No Meilisearch Installation Found!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Meilisearch Update" --radiolist --cancel-button Exit-Script "Spacebar = Select" 10 58 2 \
|
||||||
|
"1" "Update Meilisearch" ON \
|
||||||
|
"2" "Update Meilisearch-UI" OFF \
|
||||||
|
3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
|
if [ "$UPD" == "1" ]; then
|
||||||
|
msg_info "Stopping Meilisearch"
|
||||||
|
systemctl stop meilisearch
|
||||||
|
msg_ok "Stopped Meilisearch"
|
||||||
|
|
||||||
|
msg_info "Updating Meilisearch"
|
||||||
|
tmp_file=$(mktemp)
|
||||||
|
RELEASE=$(curl -s https://api.github.com/repos/meilisearch/meilisearch/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
curl -fsSL https://github.com/meilisearch/meilisearch/releases/latest/download/meilisearch.deb -o $tmp_file
|
||||||
|
$STD dpkg -i $tmp_file
|
||||||
|
echo "$RELEASE" >/opt/meilisearch_version.txt
|
||||||
|
msg_ok "Updated Meilisearch"
|
||||||
|
|
||||||
|
msg_info "Starting Meilisearch"
|
||||||
|
systemctl start meilisearch
|
||||||
|
msg_ok "Started Meilisearch"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$UPD" == "2" ]; then
|
||||||
|
if [[ ! -f /opt/Meilisearch-ui_version.txt ]]; then
|
||||||
|
msg_error "No Meilisearch-UI Installation Found!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
msg_info "Stopping Meilisearch-UI"
|
||||||
|
systemctl stop meilisearch-ui
|
||||||
|
msg_ok "Stopped Meilisearch-UI"
|
||||||
|
|
||||||
|
msg_info "Updating Meilisearch-UI"
|
||||||
|
tmp_file=$(mktemp)
|
||||||
|
tmp_dir=$(mktemp -d)
|
||||||
|
RELEASE_UI=$(curl -s https://api.github.com/repos/riccox/meilisearch-ui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
cp /opt/meilisearch-ui/.env.local /tmp/.env.local.bak
|
||||||
|
rm -rf /opt/meilisearch-ui
|
||||||
|
mkdir -p /opt/meilisearch-ui
|
||||||
|
curl -fsSL "https://github.com/riccox/meilisearch-ui/archive/refs/tags/${RELEASE_UI}.zip" -o $tmp_file
|
||||||
|
unzip -q "$tmp_file" -d "$tmp_dir"
|
||||||
|
mv "$tmp_dir"/*/* /opt/meilisearch-ui/
|
||||||
|
cd /opt/meilisearch-ui
|
||||||
|
sed -i 's|const hash = execSync("git rev-parse HEAD").toString().trim();|const hash = "unknown";|' /opt/meilisearch-ui/vite.config.ts
|
||||||
|
mv /tmp/.env.local.bak /opt/meilisearch-ui/.env.local
|
||||||
|
$STD pnpm install
|
||||||
|
echo "$RELEASE_UI" >/opt/meilisearch-ui_version.txt
|
||||||
|
msg_ok "Updated Meilisearch-UI"
|
||||||
|
|
||||||
|
msg_info "Starting Meilisearch-UI"
|
||||||
|
systemctl start meilisearch-ui
|
||||||
|
msg_ok "Started Meilisearch-UI"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start
|
||||||
|
build_container
|
||||||
|
description
|
||||||
|
|
||||||
|
msg_ok "Completed Successfully!\n"
|
||||||
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
|
echo -e "${TAB}${GATEWAY}${BGN}meilisearch: http://${IP}:7700$ | meilisearch-ui: http://${IP}:24900${CL}"
|
43
frontend/public/json/meilisearch.json
Normal file
43
frontend/public/json/meilisearch.json
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"name": "Meilisearch",
|
||||||
|
"slug": "meilisearch",
|
||||||
|
"categories": [
|
||||||
|
8
|
||||||
|
],
|
||||||
|
"date_created": "2025-04-03",
|
||||||
|
"type": "ct",
|
||||||
|
"updateable": true,
|
||||||
|
"privileged": false,
|
||||||
|
"interface_port": 7700,
|
||||||
|
"documentation": "https://www.meilisearch.com/docs",
|
||||||
|
"website": "https://www.meilisearch.com/",
|
||||||
|
"logo": "https://raw.githubusercontent.com/selfhst/icons/refs/heads/main/svg/meilisearch.svg",
|
||||||
|
"description": "Meilisearch is a fast, open-source search engine designed for instant, full-text search with typo tolerance. It provides an API that allows developers to integrate powerful search features into applications. Meilisearch-UI is an optional web-based interface that provides a simple way to interact with Meilisearch, visualize indexed data, and test queries without needing to use the API directly.",
|
||||||
|
"install_methods": [
|
||||||
|
{
|
||||||
|
"type": "default",
|
||||||
|
"script": "ct/meilisearch.sh",
|
||||||
|
"resources": {
|
||||||
|
"cpu": 2,
|
||||||
|
"ram": 4096,
|
||||||
|
"hdd": 7,
|
||||||
|
"os": "debian",
|
||||||
|
"version": "12"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default_credentials": {
|
||||||
|
"username": null,
|
||||||
|
"password": null
|
||||||
|
},
|
||||||
|
"notes": [
|
||||||
|
{
|
||||||
|
"text": "Meilisearch-UI can optionally be installed for a web-based search interface",
|
||||||
|
"type": "info"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "Meilisearch-UI has early development status and can caused performance issues",
|
||||||
|
"type": "warn"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
122
install/meilisearch-install.sh
Normal file
122
install/meilisearch-install.sh
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: MickLesk (CanbiZ)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://www.meilisearch.com/
|
||||||
|
|
||||||
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||||
|
color
|
||||||
|
verb_ip6
|
||||||
|
catch_errors
|
||||||
|
setting_up_container
|
||||||
|
network_check
|
||||||
|
update_os
|
||||||
|
|
||||||
|
msg_info "Installing Dependencies"
|
||||||
|
$STD apt-get install -y \
|
||||||
|
gnupg
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
msg_info "Setup ${APPLICATION}"
|
||||||
|
tmp_file=$(mktemp)
|
||||||
|
RELEASE=$(curl -s https://api.github.com/repos/meilisearch/meilisearch/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
curl -fsSL https://github.com/meilisearch/meilisearch/releases/latest/download/meilisearch.deb -o $tmp_file
|
||||||
|
$STD dpkg -i $tmp_file
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/meilisearch/meilisearch/latest/config.toml -o /etc/meilisearch.toml
|
||||||
|
MASTER_KEY=$(openssl rand -base64 12)
|
||||||
|
LOCAL_IP="$(hostname -I | awk '{print $1}')"
|
||||||
|
sed -i \
|
||||||
|
-e 's|^env =.*|env = "production"|' \
|
||||||
|
-e "s|^# master_key =.*|master_key = \"$MASTER_KEY\"|" \
|
||||||
|
-e 's|^db_path =.*|db_path = "/var/lib/meilisearch/data"|' \
|
||||||
|
-e 's|^dump_dir =.*|dump_dir = "/var/lib/meilisearch/dumps"|' \
|
||||||
|
-e 's|^snapshot_dir =.*|snapshot_dir = "/var/lib/meilisearch/snapshots"|' \
|
||||||
|
-e 's|^# no_analytics = true|no_analytics = true|' \
|
||||||
|
-e 's|^http_addr =.*|http_addr = "0.0.0.0:7700"|' \
|
||||||
|
/etc/meilisearch.toml
|
||||||
|
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||||
|
msg_ok "Setup ${APPLICATION}"
|
||||||
|
|
||||||
|
read -r -p "Do you want add meilisearch-ui? [y/n]: " prompt
|
||||||
|
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||||
|
msg_info "Setting up Node.js Repository"
|
||||||
|
mkdir -p /etc/apt/keyrings
|
||||||
|
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||||
|
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
|
||||||
|
msg_ok "Set up Node.js Repository"
|
||||||
|
|
||||||
|
msg_info "Installing Node.js"
|
||||||
|
$STD apt-get update
|
||||||
|
$STD apt-get install -y nodejs
|
||||||
|
$STD npm install -g pnpm
|
||||||
|
msg_ok "Installed Node.js"
|
||||||
|
|
||||||
|
msg_info "Setup ${APPLICATION}-ui"
|
||||||
|
tmp_file=$(mktemp)
|
||||||
|
tmp_dir=$(mktemp -d)
|
||||||
|
mkdir -p /opt/meilisearch-ui
|
||||||
|
RELEASE_UI=$(curl -s https://api.github.com/repos/riccox/meilisearch-ui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
curl -fsSL "https://github.com/riccox/meilisearch-ui/archive/refs/tags/${RELEASE_UI}.zip" -o $tmp_file
|
||||||
|
unzip -q "$tmp_file" -d "$tmp_dir"
|
||||||
|
mv "$tmp_dir"/*/* /opt/meilisearch-ui/
|
||||||
|
cd /opt/meilisearch-ui
|
||||||
|
sed -i 's|const hash = execSync("git rev-parse HEAD").toString().trim();|const hash = "unknown";|' /opt/meilisearch-ui/vite.config.ts
|
||||||
|
$STD pnpm install
|
||||||
|
cat <<EOF > /opt/meilisearch-ui/.env.local
|
||||||
|
VITE_SINGLETON_MODE=true
|
||||||
|
VITE_SINGLETON_HOST=http://${LOCAL_IP}:7700
|
||||||
|
VITE_SINGLETON_API_KEY=${MASTER_KEY}
|
||||||
|
EOF
|
||||||
|
echo "${RELEASE_UI}" >/opt/${APPLICATION}-ui_version.txt
|
||||||
|
msg_ok "Setup ${APPLICATION}-ui"
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg_info "Setting up Services"
|
||||||
|
cat <<EOF >/etc/systemd/system/meilisearch.service
|
||||||
|
[Unit]
|
||||||
|
Description=Meilisearch
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/meilisearch --config-file-path /etc/meilisearch.toml
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
systemctl enable -q --now meilisearch
|
||||||
|
|
||||||
|
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||||
|
cat <<EOF > /etc/systemd/system/meilisearch-ui.service
|
||||||
|
[Unit]
|
||||||
|
Description=Meilisearch UI Service
|
||||||
|
After=network.target meilisearch.service
|
||||||
|
Requires=meilisearch.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=root
|
||||||
|
WorkingDirectory=/opt/meilisearch-ui
|
||||||
|
ExecStart=/usr/bin/pnpm start
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
|
StandardOutput=syslog
|
||||||
|
StandardError=syslog
|
||||||
|
SyslogIdentifier=meilisearch-ui
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
systemctl enable -q --now meilisearch-ui
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg_ok "Set up Services"
|
||||||
|
|
||||||
|
|
||||||
|
motd_ssh
|
||||||
|
customize
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
$STD apt-get -y autoremove
|
||||||
|
$STD apt-get -y autoclean
|
||||||
|
msg_ok "Cleaned"
|
Loading…
x
Reference in New Issue
Block a user