First Preview, Meilisearch

This commit is contained in:
CanbiZ 2025-03-19 15:00:21 +01:00
parent 1e7ea4f72c
commit 0bb66098d4
2 changed files with 137 additions and 0 deletions

42
ct/meilisearch.sh Normal file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://www.meilisearch.com/
APP="Meilisearch"
var_tags="full-text-search"
var_cpu="2"
var_ram="2048"
var_disk="5"
var_os="debian"
var_version="12"
var_unprivileged="1"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /var ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Updating $APP LXC"
$STD apt-get update
$STD apt-get -y upgrade
msg_ok "Updated $APP LXC"
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"

View File

@ -0,0 +1,95 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVED/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 \
curl \
sudo \
gnupg \
mc
msg_ok "Installed Dependencies"
msg_info "Setup ${APPLICATION}"
tmp_file=$(mktemp)
mkdir -p /opt/meilisearch
mkdir -p /opt/meilisearch_data
RELEASE=$(curl -s https://api.github.com/repos/meilisearch/meilisearch/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
wget -q "https://github.com/meilisearch/meilisearch/releases/download/${RELEASE}/meilisearch-linux-amd64" -O $tmp_file
mv $tmp_file /opt/meilisearch/meilisearch
chmod +x /opt/meilisearch/meilisearch
echo "MEILI_MASTER_KEY=\"$(openssl rand -base64 32)\"" >/opt/meilisearch_data/.env
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Setup ${APPLICATION}"
read -p "Do you want add meilisearch-ui? [y/n]: " -r
if [[ $REPLY =~ ^[Yy]$ ]]; 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) }')
wget -q "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
pnpm install
cat <<EOF > /opt/meilisearch_ui/.env.local
VITE_SINGLETON_MODE=true
VITE_SINGLETON_HOST=http://localhost:7700
VITE_SINGLETON_API_KEY="$(grep 'MEILI_MASTER_KEY' /opt/meilisearch_data/.env | cut -d '"' -f2)"
EOF
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
echo "${RELEASE_UI}" >/opt/${APPLICATION}-ui_version.txt
msg_ok "Setup ${APPLICATION}-ui"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"